Skip to main content
Module

x/fortuna/mod.ts>Fortuna

Weighted gacha system
Go to Latest
class Fortuna
import { Fortuna } from "https://deno.land/x/fortuna@v1.2.2/mod.ts";

Gacha machine setup to roll items from.

Constructors

new
Fortuna(items: GachaData<ItemType>[])

Properties

readonly
pool: number[]
tiers: GachaTier[]

Methods

choose(pool: number[], detailed: boolean): GachaChoice<ItemType>

Get one item from the machine.

choose(pool: number[]): ItemType
configItems(items: GachaData<ItemType>[]): void

Configure gacha items (meant for internal use)

configTiers(items: GachaData<ItemType>[]): void

Configure gacha tiers (meant for internal use).

get(
num?,
detailed?,
pool?: number[],
): GachaChoice<ItemType>[] | ItemType[]

Roll a number of items from the machine.

Static Methods

createItem<ItemType>(
result: ItemType,
chance?,
tier?,
): GachaData<ItemType>

Create a gacha item to add to the machine.

createRollChoice<ItemType>(result: ItemType, chance?): GachaChoice<ItemType>

Create a gacha choice to directly roll using the static roll method.

roll<ItemType>(choices: GachaChoice<ItemType>[], totalChance?: number): GachaChoice<ItemType>

Roll one from an array of gacha choices.