From 8082e6dc58ecdc1961c412e1312fbc037f942161 Mon Sep 17 00:00:00 2001 From: innerthunder <168692175+innerthunder@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:29:49 -0700 Subject: [PATCH] [Hotfix] Fix harsh weather cancelling moves based on base type (#4097) --- src/data/weather.ts | 8 +++++--- src/field/arena.ts | 4 ++-- src/phases/move-phase.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/data/weather.ts b/src/data/weather.ts index 2421f719e6e..afdd0a958cf 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -88,12 +88,14 @@ export class Weather { return 1; } - isMoveWeatherCancelled(move: Move): boolean { + isMoveWeatherCancelled(user: Pokemon, move: Move): boolean { + const moveType = user.getMoveType(move); + switch (this.weatherType) { case WeatherType.HARSH_SUN: - return move instanceof AttackMove && move.type === Type.WATER; + return move instanceof AttackMove && moveType === Type.WATER; case WeatherType.HEAVY_RAIN: - return move instanceof AttackMove && move.type === Type.FIRE; + return move instanceof AttackMove && moveType === Type.FIRE; } return false; diff --git a/src/field/arena.ts b/src/field/arena.ts index e8defbd1a8e..1e1df38af21 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -391,8 +391,8 @@ export class Arena { return true; } - isMoveWeatherCancelled(move: Move) { - return this.weather && !this.weather.isEffectSuppressed(this.scene) && this.weather.isMoveWeatherCancelled(move); + isMoveWeatherCancelled(user: Pokemon, move: Move) { + return this.weather && !this.weather.isEffectSuppressed(this.scene) && this.weather.isMoveWeatherCancelled(user, move); } isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move) { diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 0ccf19a462f..975e3d32185 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -204,7 +204,7 @@ export class MovePhase extends BattlePhase { let success = this.move.getMove().applyConditions(this.pokemon, targets[0], this.move.getMove()); const cancelled = new Utils.BooleanHolder(false); let failedText = this.move.getMove().getFailedText(this.pokemon, targets[0], this.move.getMove(), cancelled); - if (success && this.scene.arena.isMoveWeatherCancelled(this.move.getMove())) { + if (success && this.scene.arena.isMoveWeatherCancelled(this.pokemon, this.move.getMove())) { success = false; } else if (success && this.scene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, this.move.getMove())) { success = false;