From fbc08005715ac1b1bdb4a3e38e6bf468ad3625e7 Mon Sep 17 00:00:00 2001 From: Matt Ross <13306707+mattrossdev@users.noreply.github.com> Date: Thu, 2 May 2024 22:20:41 -0700 Subject: [PATCH] Issue/smack down should cancel fly (#407) * Smack down and thousand arrows should cancel charging fly * Remove console log * Update interruptible check to use flying tag instead of move history * Remove extra comma --- src/data/battler-tags.ts | 25 +++++++++++++++++++++++++ src/data/enums/battler-tag-type.ts | 1 + src/data/move.ts | 4 ++++ src/phases.ts | 2 +- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index aaab9f9a4..2521a0e03 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -163,6 +163,29 @@ export class FlinchedTag extends BattlerTag { } } +export class InterruptedTag extends BattlerTag { + constructor(sourceMove: Moves){ + super(BattlerTagType.INTERRUPTED, BattlerTagLapseType.PRE_MOVE, 0, sourceMove) + } + + canAdd(pokemon: Pokemon): boolean { + return !!pokemon.getTag(BattlerTagType.FLYING) + } + + onAdd(pokemon: Pokemon): void { + super.onAdd(pokemon); + + pokemon.getMoveQueue().shift() + pokemon.pushMoveHistory({move: Moves.NONE, result: MoveResult.OTHER}) + } + + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + super.lapse(pokemon, lapseType); + (pokemon.scene.getCurrentPhase() as MovePhase).cancel(); + return true + } +} + export class ConfusedTag extends BattlerTag { constructor(turnCount: integer, sourceMove: Moves) { super(BattlerTagType.CONFUSED, BattlerTagLapseType.MOVE, turnCount, sourceMove); @@ -1081,6 +1104,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new RechargingTag(sourceMove); case BattlerTagType.FLINCHED: return new FlinchedTag(sourceMove); + case BattlerTagType.INTERRUPTED: + return new InterruptedTag(sourceMove); case BattlerTagType.CONFUSED: return new ConfusedTag(turnCount, sourceMove); case BattlerTagType.INFATUATED: diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index 4d810b737..f76e5526f 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -3,6 +3,7 @@ export enum BattlerTagType { NONE = "NONE", RECHARGING = "RECHARGING", FLINCHED = "FLINCHED", + INTERRUPTED = "INTERRUPTED", CONFUSED = "CONFUSED", INFATUATED = "INFATUATED", SEEDED = "SEEDED", diff --git a/src/data/move.ts b/src/data/move.ts index b26af03fc..a227c522a 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5106,6 +5106,8 @@ export function initMoves() { .unimplemented(), new AttackMove(Moves.SMACK_DOWN, Type.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, 100, 0, 5) .attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, false, false, 5) + .attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED) + .attr(RemoveBattlerTagAttr, [BattlerTagType.FLYING]) .attr(HitsTagAttr, BattlerTagType.FLYING, false) .makesContact(false), new AttackMove(Moves.STORM_THROW, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 100, 10, -1, 0, 5) @@ -5469,6 +5471,8 @@ export function initMoves() { new AttackMove(Moves.THOUSAND_ARROWS, Type.GROUND, MoveCategory.PHYSICAL, 90, 100, 10, 100, 0, 6) .attr(NeutralDamageAgainstFlyingTypeMultiplierAttr) .attr(HitsTagAttr, BattlerTagType.FLYING, false) + .attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED) + .attr(RemoveBattlerTagAttr, [BattlerTagType.FLYING]) .makesContact(false) .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.THOUSAND_WAVES, Type.GROUND, MoveCategory.PHYSICAL, 90, 100, 10, -1, 0, 6) diff --git a/src/phases.ts b/src/phases.ts index 4c2f55362..40ab1f306 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2333,7 +2333,7 @@ export class MovePhase extends BattlePhase { return; } - if (this.pokemon.getTag(BattlerTagType.RECHARGING)) + if (this.pokemon.getTag(BattlerTagType.RECHARGING|| BattlerTagType.INTERRUPTED)) return; this.scene.queueMessage(getPokemonMessage(this.pokemon, ` used\n${this.move.getName()}!`), 500);