Fixed entry hazard crash

Having Spikes or Stealth Rock on the field when a new wild battle starts no longer crashes the game.
This commit is contained in:
InfernoVulpix 2024-04-26 00:57:31 -04:00 committed by Samuel H
parent d4c265443f
commit 587197dac4
1 changed files with 2 additions and 2 deletions

View File

@ -252,7 +252,7 @@ class SpikesTag extends ArenaTrapTag {
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is hurt\nby the spikes!')); pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is hurt\nby the spikes!'));
pokemon.damageAndUpdate(damage, HitResult.OTHER); pokemon.damageAndUpdate(damage, HitResult.OTHER);
pokemon.turnData.damageTaken += damage; if (pokemon.turnData) pokemon.turnData.damageTaken += damage;
return true; return true;
} }
} }
@ -383,7 +383,7 @@ class StealthRockTag extends ArenaTrapTag {
const damage = Math.ceil(pokemon.getMaxHp() * damageHpRatio); const damage = Math.ceil(pokemon.getMaxHp() * damageHpRatio);
pokemon.scene.queueMessage(`Pointed stones dug into\n${pokemon.name}!`); pokemon.scene.queueMessage(`Pointed stones dug into\n${pokemon.name}!`);
pokemon.damageAndUpdate(damage, HitResult.OTHER); pokemon.damageAndUpdate(damage, HitResult.OTHER);
pokemon.turnData.damageTaken += damage; if (pokemon.turnData) pokemon.turnData.damageTaken += damage;
} }
return false; return false;