Smoothed out tracking, but it isn't satisfactory. Still unable to retrieve Wave 1.

This commit is contained in:
frutescens 2024-11-11 18:48:10 -08:00
parent 949e4b67a1
commit 9fda107145

View File

@ -1108,7 +1108,7 @@ export default class BattleScene extends SceneBase {
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false)); [ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN); this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN, false);
this.field.setVisible(true); this.field.setVisible(true);
@ -1274,7 +1274,7 @@ export default class BattleScene extends SceneBase {
if (!waveIndex && lastBattle) { if (!waveIndex && lastBattle) {
const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10); const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10);
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily; const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
const isEndlessFifthWave = this.gameMode.hasShortBiomes && (lastBattle.waveIndex % 5) === 0; const isEndlessFifthWave = this.gameMode.hasShortBiomes && (lastBattle.waveIndex % 2) === 0;
const isWaveIndexMultipleOfFiftyMinusOne = (lastBattle.waveIndex % 50) === 49; const isWaveIndexMultipleOfFiftyMinusOne = (lastBattle.waveIndex % 50) === 49;
const isNewBiome = isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne); const isNewBiome = isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne);
const resetArenaState = isNewBiome || [ BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER ].includes(this.currentBattle.battleType) || this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS; const resetArenaState = isNewBiome || [ BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER ].includes(this.currentBattle.battleType) || this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS;
@ -1324,18 +1324,17 @@ export default class BattleScene extends SceneBase {
return this.currentBattle; return this.currentBattle;
} }
newArena(biome: Biome): Arena { newArena(biome: Biome, isReset: boolean = true): Arena {
const biomeTrackerLimit = 22; const biomeTrackerLimit = 22;
if (Utils.isNullOrUndefined(this.biomeTracker)) { if (Utils.isNullOrUndefined(this.biomeTracker)) {
this.biomeTracker = {}; this.biomeTracker = {};
} }
if (this.currentBattle) { if (isReset) {
this.biomeTracker[this.currentBattle.waveIndex] = biome; if (this.currentBattle) {
} else { this.biomeTracker[this.currentBattle.waveIndex] = biome;
this.biomeTracker[1] = biome; }
} }
const biomeTrackerKeys = Object.keys(this.biomeTracker).map(Number); const biomeTrackerKeys = Object.keys(this.biomeTracker).map(Number);
console.log(this.biomeTracker);
// Arbitrary limit of 22 entries per session --> Can increase or decrease // Arbitrary limit of 22 entries per session --> Can increase or decrease
while (biomeTrackerKeys.length >= biomeTrackerLimit ) { while (biomeTrackerKeys.length >= biomeTrackerLimit ) {
const smallestWave = Math.min.apply(Math, biomeTrackerKeys); const smallestWave = Math.min.apply(Math, biomeTrackerKeys);