Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
class GachaMachine
import { GachaMachine } from "https://deno.land/x/fortuna@v2.0.1/history/v1.ts";

Gacha machine setup to roll items from.

Constructors

new
GachaMachine(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.