#3772 refactored according to schmidtc1 comments

This commit is contained in:
Jesse Chung 2024-09-01 20:42:42 -04:00
parent 168a6cdbef
commit 5256d95830

View File

@ -822,11 +822,11 @@ export class DrowsyTag extends BattlerTag {
} }
canAdd(pokemon: Pokemon): boolean { canAdd(pokemon: Pokemon): boolean {
const isNotElectricTerrainProtected = pokemon.scene.arena.terrain?.terrainType !== TerrainType.ELECTRIC || !pokemon.isGrounded(); const isElectricTerrainProtected = pokemon.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC && !pokemon.isGrounded();
if (!isNotElectricTerrainProtected) { if (isElectricTerrainProtected) {
pokemon.scene.queueMessage(i18next.t("terrain:defaultBlockMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(TerrainType.ELECTRIC) })); pokemon.scene.queueMessage(i18next.t("terrain:defaultBlockMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(TerrainType.ELECTRIC) }));
} }
return isNotElectricTerrainProtected; return !isElectricTerrainProtected;
} }
onAdd(pokemon: Pokemon): void { onAdd(pokemon: Pokemon): void {