lootastic
Version:
a loot rolling system
34 lines (33 loc) • 1.06 kB
TypeScript
export declare enum LootFunction {
WithReplacement = "chooseWithReplacement",
WithoutReplacement = "chooseWithoutReplacement",
EachItem = "tryToDropEachItem"
}
export interface LootRollerConfig {
table: LootTable;
func: LootFunction;
args: number;
}
export interface LootTableOptions {
rollModifier: number;
seed?: number;
}
export interface Rollable {
result: string;
chance: number;
maxChance?: number;
}
export declare class LootRoller {
static rollTables(lootTableConfigs: LootRollerConfig[]): any[];
static rollTable(lootTableConfig: LootRollerConfig): any[];
}
export declare class LootTable {
private choices;
private rollModifier;
constructor(choices: string[] | Rollable[], { rollModifier }?: LootTableOptions);
private getFormattedChoices;
private configureChoices;
chooseWithReplacement(numItems?: number): string[];
chooseWithoutReplacement(numItems?: number): string[];
tryToDropEachItem(comparisonValue: number): string[];
}