Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fortuna/src/limited_machine.ts>LimitedGachaMachine

A TypeScript module for random events and gacha.
Latest
class LimitedGachaMachine
import { LimitedGachaMachine } from "https://deno.land/x/fortuna@v4.1.4/src/limited_machine.ts";

Gacha system for rolling n distinct items from the weighted collection.

Constructors

new
LimitedGachaMachine(items: GachaChoice<T>[])

Properties

writeonly
items: GachaChoice<T>[]

Methods

get(count: number): T[]

Roll distinct items from the gacha machine.

const machine = new GachaMachine(items);
machine.get(11)

However, rolling distinct items does not mutate the pool. The items rolled are only distinct within the n items.