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

x/fortuna/mod.ts>GachaMachine

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

Gacha system.

Constructors

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

Properties

writeonly
items: GachaChoice<T>[]

Update items in the pool.

Methods

get(count: number): T[]

Roll items from the gacha machine.

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

If you are looking for the distinct rolls, try importing LimitedGachaMachine instead of GachaMachine.