/
test.ts
30 lines (26 loc) · 876 Bytes
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { GachaMachine } from "./mod.ts";
import { default as genString } from "https://deno.land/x/lala@v2.1.2/functions/generator/string/index.js";
/*
const items = [];
for (let i = 0; i < 100; ++i) {
items.push({
chance: Math.ceil(Math.random() * 12),
result: genString(7),
tier: 1,
featured: false,
});
}
const machine = new GachaMachine(items, [1]);
console.log(machine)
console.log(machine.get(5, true));
*/
const items = [
GachaMachine.createItem("SSR cool character", 1, 2),
GachaMachine.createItem("Rare cool character", 5, 2),
GachaMachine.createItem("Kinda rare character", 8, 1),
GachaMachine.createItem("Mob character 1", 10, 1),
GachaMachine.createItem("Mob character 2", 10, 1),
GachaMachine.createItem("Mob character 3", 10, 1),
]
const machine = new GachaMachine(items)
console.log(machine.get(10, false, [5])) // Rolls 10x