work smart, not hard

This commit is contained in:
Sainan 2025-01-18 14:16:22 +01:00
parent 2f7f2ae4a5
commit b6cb000078

View File

@ -55,21 +55,15 @@ const randomiseStats = (randomModType: string, fingerprint: IUnveiledRivenFinger
fingerprint.buffs = []; fingerprint.buffs = [];
const numBuffs = 2 + Math.trunc(Math.random() * 2); // 2 or 3 const numBuffs = 2 + Math.trunc(Math.random() * 2); // 2 or 3
const buffEntries = meta.upgradeEntries!.filter(x => x.canBeBuff);
for (let i = 0; i != numBuffs; ++i) { for (let i = 0; i != numBuffs; ++i) {
let entry = getRandomElement(meta.upgradeEntries!); const entry = getRandomElement(buffEntries);
while (!entry.canBeBuff) {
entry = getRandomElement(meta.upgradeEntries!);
}
fingerprint.buffs.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) }); fingerprint.buffs.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) });
} }
fingerprint.curses = []; fingerprint.curses = [];
const numCurses = Math.trunc(Math.random() * 2); // 0 or 1 if (Math.random() < 0.5) {
for (let i = 0; i != numCurses; ++i) { const entry = getRandomElement(meta.upgradeEntries!.filter(x => x.canBeCurse));
let entry = getRandomElement(meta.upgradeEntries!);
while (!entry.canBeCurse) {
entry = getRandomElement(meta.upgradeEntries!);
}
fingerprint.curses.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) }); fingerprint.curses.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) });
} }
}; };