From fab415c1563f86261bc64b9579d49ab4b863322f Mon Sep 17 00:00:00 2001 From: Stophles <71789013+Stophles@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:33:07 -0500 Subject: [PATCH] Toxic Spikes - Properly removed by statused Poison types Toxic spikes should now be removed by poison types who are statused before they are switched to, instead of ignoring their entry --- src/data/arena-tag.ts | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index b34205db3f1..d8adec26840 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -17,7 +17,21 @@ export enum ArenaTagSide { ENEMY } -export abstract class ArenaTag { +export abstract class ArenaTag {activateTrap(pokemon: Pokemon): boolean { + if (pokemon.isOfType(Type.POISON) && pokemon.isGrounded()) { + this.neutralized = true; + if (pokemon.scene.arena.removeTag(this.tagType)) { + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` absorbed the ${this.getMoveName()}!`)); + return true; + } + } + else if (!pokemon.status && pokemon.isGrounded()) { + const toxic = this.layers > 1; + if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, `the ${this.getMoveName()}`)) + return true; + } + return false; + } public tagType: ArenaTagType; public turnCount: integer; public sourceMove: Moves; @@ -211,18 +225,20 @@ class ToxicSpikesTag extends ArenaTrapTag { } activateTrap(pokemon: Pokemon): boolean { - if (!pokemon.status && pokemon.isGrounded()) { - const toxic = this.layers > 1; - if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, `the ${this.getMoveName()}`)) + if (pokemon.isOfType(Type.POISON) && pokemon.isGrounded()) { + this.neutralized = true; + if (pokemon.scene.arena.removeTag(this.tagType)) { + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` absorbed the ${this.getMoveName()}!`)); return true; - else if (pokemon.isOfType(Type.POISON)) { - this.neutralized = true; - if (pokemon.scene.arena.removeTag(this.tagType)) { - pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` absorbed the ${this.getMoveName()}!`)); - return true; - } } } + else if (!pokemon.status && pokemon.isGrounded()) { + const toxic = this.layers > 1; + if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, `the ${this.getMoveName()}`)) + return true; + } + return false; + } return false; } @@ -378,4 +394,4 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov case ArenaTagType.GRAVITY: return new GravityTag(turnCount); } -} \ No newline at end of file +}