Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/fortuna/src/limited_machine.ts>LimitedGachaMachine

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