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

x/fortuna/mod.ts>LimitedGachaMachine

A TypeScript module for random events and gacha.
Latest
class LimitedGachaMachine
import { LimitedGachaMachine } from "https://deno.land/x/fortuna@v4.1.4/mod.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.