UNPKG

@allemandi/gacha-engine

Version:

Practical, type-safe toolkit for simulating and understanding gacha rates and rate-ups.

34 lines (33 loc) 1.06 kB
import { GachaEngineConfig } from './types'; export declare class GachaEngine { private static readonly SCALE; private static readonly MAX_SAFE_SCALE; private mode; private pools; private rarityRatesScaled; private flatRateMap; private dropRateCacheScaled; private flatRateRateUpItems; constructor(config: GachaEngineConfig); private scaleRarityRates; private toScaled; private fromScaled; private validateConfig; getItemDropRate(name: string): number; getCumulativeProbabilityForItem(name: string, rolls: number): number; getRollsForTargetProbability(name: string, targetProbability: number): number; getRateUpItems(): string[]; getAllItemDropRates(): { name: string; dropRate: number; rarity: string; }[]; roll(count?: number): string[]; private selectRarity; private selectItemFromPool; getDebugInfo(): { scale: number; rarityRatesScaled: Record<string, number>; rarityRatesFloat: Record<string, number>; }; }