Update to a daily cycle

This commit is contained in:
Xavion3 2024-05-15 01:24:00 +10:00
parent c8961869bf
commit 09a7655dd8

View File

@ -95,10 +95,12 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
let ret: Species; let ret: Species;
// 604800000 is the number of miliseconds in one week // 86400000 is the number of miliseconds in one day
const weekOffset = Utils.getSunday(new Date(timestamp)).getTime(); // Timestamp of current week const timeDate = new Date(timestamp);
const offset = Math.floor(Math.floor(weekOffset / 604800000)/legendarySpecies.length); // Cycle number const dayDate = new Date(Date.UTC(timeDate.getUTCFullYear(), timeDate.getUTCMonth(), timeDate.getUTCDate()));
const index = Math.floor(weekOffset / 604800000)%legendarySpecies.length // Index within cycle const dayTimestamp = timeDate.getTime(); // Timestamp of current week
const offset = Math.floor(Math.floor(dayTimestamp / 86400000)/legendarySpecies.length); // Cycle number
const index = Math.floor(dayTimestamp / 86400000)%legendarySpecies.length // Index within cycle
scene.executeWithSeedOffset(() => { scene.executeWithSeedOffset(() => {
ret = Phaser.Math.RND.shuffle(legendarySpecies)[index]; ret = Phaser.Math.RND.shuffle(legendarySpecies)[index];