diff --git a/src/battle-scene.ts b/src/battle-scene.ts index b30a0ac7b3d..d431bff603e 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -153,6 +153,7 @@ export default class BattleScene extends Phaser.Scene { public seed: string; public waveSeed: string; public waveCycleOffset: integer; + public offsetGym: boolean; public damageNumberHandler: DamageNumberHandler private spriteSparkleHandler: PokemonSpriteSparkleHandler; @@ -764,15 +765,16 @@ export default class BattleScene extends Phaser.Scene { setSeed(seed: string): void { this.seed = seed; - this.waveCycleOffset = this.getGenerateWaveCycleOffset(); + this.waveCycleOffset = this.getGeneratedWaveCycleOffset(); + this.offsetGym = this.gameMode.isClassic && this.getGeneratedOffsetGym(); } reset(clearScene?: boolean): void { + this.gameMode = gameModes[GameModes.CLASSIC]; + this.setSeed(Utils.randomString(24)); console.log('Seed:', this.seed); - this.gameMode = gameModes[GameModes.CLASSIC]; - this.score = 0; this.money = 0; @@ -1021,7 +1023,15 @@ export default class BattleScene extends Phaser.Scene { return this.arena.getSpeciesFormIndex(species); } - private getGenerateWaveCycleOffset(): integer { + private getGeneratedOffsetGym(): boolean { + let ret = false; + this.executeWithSeedOffset(() => { + ret = !Utils.randSeedInt(2); + }, 0, this.seed.toString()); + return ret; + } + + private getGeneratedWaveCycleOffset(): integer { let ret = 0; this.executeWithSeedOffset(() => { ret = Utils.randSeedInt(8) * 5; diff --git a/src/field/arena.ts b/src/field/arena.ts index 221790c598f..f874eeaaf21 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -128,7 +128,7 @@ export class Arena { randomTrainerType(waveIndex: integer): TrainerType { const isBoss = !!this.trainerPool[BiomePoolTier.BOSS].length - && this.scene.gameMode.isTrainerBoss(waveIndex, this.biomeType); + && this.scene.gameMode.isTrainerBoss(waveIndex, this.biomeType, this.scene.offsetGym); console.log(isBoss, this.trainerPool) const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64); let tier = !isBoss diff --git a/src/game-mode.ts b/src/game-mode.ts index d054007777e..f06c658266e 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -78,7 +78,7 @@ export class GameMode implements GameModeConfig { isWaveTrainer(waveIndex: integer, arena: Arena): boolean { if (this.isDaily) return waveIndex % 10 === 5 || (!(waveIndex % 10) && waveIndex > 10 && !this.isWaveFinal(waveIndex)); - if ((waveIndex % 30) === 20 && !this.isWaveFinal(waveIndex)) + if ((waveIndex % 30) === (arena.scene.offsetGym ? 0 : 20) && !this.isWaveFinal(waveIndex)) return true; else if (waveIndex % 10 !== 1 && waveIndex % 10) { const trainerChance = arena.getTrainerChance(); @@ -88,7 +88,7 @@ export class GameMode implements GameModeConfig { for (let w = Math.max(waveIndex - 3, waveBase + 2); w <= Math.min(waveIndex + 3, waveBase + 9); w++) { if (w === waveIndex) continue; - if ((w % 30) === 20 || fixedBattles.hasOwnProperty(w)) { + if ((w % 30) === (arena.scene.offsetGym ? 0 : 20) || fixedBattles.hasOwnProperty(w)) { allowTrainerBattle = false; break; } else if (w < waveIndex) { @@ -107,12 +107,12 @@ export class GameMode implements GameModeConfig { return false; } - isTrainerBoss(waveIndex: integer, biomeType: Biome): boolean { + isTrainerBoss(waveIndex: integer, biomeType: Biome, offsetGym: boolean): boolean { switch (this.modeId) { case GameModes.DAILY: return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10); default: - return (waveIndex % 30) === 20 && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex)); + return (waveIndex % 30) === (offsetGym ? 0 : 20) && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex)); } } diff --git a/src/phases.ts b/src/phases.ts index 7e4e76ca156..cba4d4d0f50 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -221,10 +221,11 @@ export class TitlePhase extends Phase { this.scene.sessionSlotId = slotId; fetchDailyRunSeed().then(seed => { + this.scene.gameMode = gameModes[GameModes.DAILY]; + this.scene.setSeed(seed); this.scene.resetSeed(1); - this.scene.gameMode = gameModes[GameModes.DAILY]; this.scene.money = this.scene.gameMode.getStartingMoney(); const starters = getDailyRunStarters(this.scene, seed); @@ -2980,7 +2981,7 @@ export class VictoryPhase extends PokemonPhase { if (this.scene.currentBattle.waveIndex > 10 && !this.scene.gameMode.isWaveFinal(this.scene.currentBattle.waveIndex)) this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.GOLDEN_POKEBALL)); } else { - const superExpWave = !this.scene.gameMode.isEndless ? 20 : 10; + const superExpWave = !this.scene.gameMode.isEndless ? (this.scene.offsetGym ? 0 : 20) : 10; if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex === 10) this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.EXP_SHARE)); if (this.scene.currentBattle.waveIndex <= 750 && (this.scene.currentBattle.waveIndex <= 500 || (this.scene.currentBattle.waveIndex % 30) === superExpWave)) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index e4f59f3e890..b12cdda1099 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -543,13 +543,13 @@ export class GameData { const initSessionFromData = async sessionData => { console.debug(sessionData); + scene.gameMode = gameModes[sessionData.gameMode || GameModes.CLASSIC]; + scene.setSeed(sessionData.seed || scene.game.config.seed[0]); scene.resetSeed(); scene.sessionPlayTime = sessionData.playTime || 0; - scene.gameMode = gameModes[sessionData.gameMode || GameModes.CLASSIC]; - const loadPokemonAssets: Promise[] = []; const party = scene.getParty(); diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index a74bc7c53b1..337236756c2 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -114,7 +114,8 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container { this.pokemonGenderText.setShadowColor(getGenderColor(pokemon.gender, true)); this.pokemonGenderLabelText.setVisible(true); this.pokemonGenderText.setVisible(true); - } + } else + this.pokemonGenderText.setVisible(false); this.pokemonAbilityText.setText(pokemon.getAbility(true).name); this.pokemonNatureText.setText(getNatureName(pokemon.nature, true));