diff --git a/src/battle.ts b/src/battle.ts index ed185a2ae..cd62afbf4 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -1255,16 +1255,9 @@ class Battle { if (turnNum === this.turn + 1) { this.endLastTurnPending = true; } - if (this.turn && !this.usesUpkeep) this.updatePseudoWeatherLeft(); // for compatibility with old replays + if (this.turn && !this.usesUpkeep) this.updateTurnCounters(); // for compatibility with old replays this.turn = turnNum; - if (this.mySide.active[0]) this.mySide.active[0]!.clearTurnstatuses(); - if (this.mySide.active[1]) this.mySide.active[1]!.clearTurnstatuses(); - if (this.mySide.active[2]) this.mySide.active[2]!.clearTurnstatuses(); - if (this.yourSide.active[0]) this.yourSide.active[0]!.clearTurnstatuses(); - if (this.yourSide.active[1]) this.yourSide.active[1]!.clearTurnstatuses(); - if (this.yourSide.active[2]) this.yourSide.active[2]!.clearTurnstatuses(); - if (!this.fastForward) this.turnsSinceMoved++; this.scene.incrementTurn(); @@ -1284,13 +1277,6 @@ class Battle { this.turnsSinceMoved = 0; this.scene.updateAcceleration(); } - updateToxicTurns() { - for (const side of this.sides) { - for (const poke of side.active) { - if (poke?.status === 'tox') poke.statusData.toxicTurns++; - } - } - } changeWeather(weatherName: string, poke?: Pokemon, isUpkeep?: boolean, ability?: Effect) { let weather = toID(weatherName); if (!weather || weather === 'none') { @@ -1325,7 +1311,7 @@ class Battle { this.weather = weather; this.scene.updateWeather(); } - updatePseudoWeatherLeft() { + updateTurnCounters() { for (const pWeather of this.pseudoWeather) { if (pWeather[1]) pWeather[1]--; if (pWeather[2]) pWeather[2]--; @@ -1336,6 +1322,12 @@ class Battle { if (cond[2]) cond[2]--; if (cond[3]) cond[3]--; } + for (const poke of side.active) { + if (poke) { + if (poke.status === 'tox') poke.statusData.toxicTurns++; + poke.clearTurnstatuses(); + } + } } this.scene.updateWeather(); } @@ -3097,8 +3089,7 @@ class Battle { } case 'upkeep': { this.usesUpkeep = true; - this.updatePseudoWeatherLeft(); - this.updateToxicTurns(); + this.updateTurnCounters(); break; } case 'turn': {