This commit is contained in:
2026-09-28 20:58:29 +08:00
parent c3e83a700a
commit 8045e3c63f
49 changed files with 4582 additions and 441 deletions
+12
View File
@@ -0,0 +1,12 @@
import config from "../config.js";
import { nextRandom } from "../state.js";
export const getRandomRewardChoices = (run, poolId, count = 3) => {
const fallbackId = "shared.pool.battle.normal";
const pool = (config.rewardPools[poolId] || config.rewardPools[fallbackId]).slice();
for (let index = pool.length - 1; index > 0; index--) {
const target = Math.floor(nextRandom(run) * (index + 1));
[pool[index], pool[target]] = [pool[target], pool[index]];
}
return pool.slice(0, count).map(id => ({ id, ...config.rewards[id] }));
};