From 587197dac441337ed74d5d4ee6f6fc6b3b0e86a8 Mon Sep 17 00:00:00 2001 From: InfernoVulpix Date: Fri, 26 Apr 2024 00:57:31 -0400 Subject: [PATCH] Fixed entry hazard crash Having Spikes or Stealth Rock on the field when a new wild battle starts no longer crashes the game. --- src/data/arena-tag.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 669971da37c..bb76a9880b3 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -252,7 +252,7 @@ class SpikesTag extends ArenaTrapTag { pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is hurt\nby the spikes!')); pokemon.damageAndUpdate(damage, HitResult.OTHER); - pokemon.turnData.damageTaken += damage; + if (pokemon.turnData) pokemon.turnData.damageTaken += damage; return true; } } @@ -383,7 +383,7 @@ class StealthRockTag extends ArenaTrapTag { const damage = Math.ceil(pokemon.getMaxHp() * damageHpRatio); pokemon.scene.queueMessage(`Pointed stones dug into\n${pokemon.name}!`); pokemon.damageAndUpdate(damage, HitResult.OTHER); - pokemon.turnData.damageTaken += damage; + if (pokemon.turnData) pokemon.turnData.damageTaken += damage; } return false;