From 09a7655dd868684fe547b1b7cd700c984f82e1e0 Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Wed, 15 May 2024 01:24:00 +1000 Subject: [PATCH] Update to a daily cycle --- src/data/egg.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/data/egg.ts b/src/data/egg.ts index 30dd5aee8b6..fd8f8026fcc 100644 --- a/src/data/egg.ts +++ b/src/data/egg.ts @@ -95,10 +95,12 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta let ret: Species; - // 604800000 is the number of miliseconds in one week - const weekOffset = Utils.getSunday(new Date(timestamp)).getTime(); // Timestamp of current week - const offset = Math.floor(Math.floor(weekOffset / 604800000)/legendarySpecies.length); // Cycle number - const index = Math.floor(weekOffset / 604800000)%legendarySpecies.length // Index within cycle + // 86400000 is the number of miliseconds in one day + const timeDate = new Date(timestamp); + const dayDate = new Date(Date.UTC(timeDate.getUTCFullYear(), timeDate.getUTCMonth(), timeDate.getUTCDate())); + 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(() => { ret = Phaser.Math.RND.shuffle(legendarySpecies)[index];