From 4beb8d47ef00c414612e58ed57f38fff9718d612 Mon Sep 17 00:00:00 2001 From: Adrienn Tindall <33725376+adrienntindall@users.noreply.github.com> Date: Wed, 24 Apr 2024 16:18:56 -0400 Subject: [PATCH] Heal Block Implementation pre-testing --- src/data/battler-tags.ts | 20 ++++++++++++++++++++ src/data/enums/battler-tag-type.ts | 1 + src/data/move.ts | 4 ++-- src/phases.ts | 6 ++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index b12d15968f6..6c8badad7a1 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1071,6 +1071,24 @@ export class CursedTag extends BattlerTag { } } +export class HealBlockTag extends BattlerTag { + constructor(turnCount : integer, sourceMove : Moves) { + super(BattlerTagType.HEAL_BLOCKED, BattlerTagLapseType.TURN_END, turnCount, sourceMove); + } + + onAdd(pokemon: Pokemon) { + super.onAdd(pokemon); + + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' was prevented from healing!')); + } + + onRemove(pokemon: Pokemon): void { + super.onRemove(pokemon); + + pokemon.scene.queueMessage(getPokemonMessage(pokemon, '\'s ' + super.getMoveName() + ' wore off!')); + } +} + export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourceMove: Moves, sourceId: integer): BattlerTag { switch (tagType) { case BattlerTagType.RECHARGING: @@ -1174,6 +1192,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new CursedTag(sourceId); case BattlerTagType.CHARGED: return new TypeBoostTag(tagType, sourceMove, Type.ELECTRIC, 2, true); + case BattlerTagType.HEAL_BLOCKED: + return new HealBlockTag(turnCount, sourceMove); case BattlerTagType.NONE: default: return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index 4d810b737aa..2a0ff61f289 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -52,5 +52,6 @@ export enum BattlerTagType { SALT_CURED = "SALT_CURED", CURSED = "CURSED", CHARGED = "CHARGED", + HEAL_BLOCKED = "HEAL_BLOCKED", GROUNDED = "GROUNDED" } diff --git a/src/data/move.ts b/src/data/move.ts index 53244082bd3..cf76f37268a 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4727,7 +4727,7 @@ export function initMoves() { .unimplemented(), new StatusMove(Moves.HEAL_BLOCK, Type.PSYCHIC, 100, 15, -1, 0, 4) .target(MoveTarget.ALL_NEAR_ENEMIES) - .unimplemented(), + .attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCKED, false, true, 5), new AttackMove(Moves.WRING_OUT, Type.NORMAL, MoveCategory.SPECIAL, -1, 100, 5, -1, 0, 4) .attr(OpponentHighHpPowerAttr) .makesContact(), @@ -6320,7 +6320,7 @@ export function initMoves() { .attr(NoEffectAttr, crashDamageFunc), new AttackMove(Moves.PSYCHIC_NOISE, Type.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, -1, 0, 9) .soundBased() - .partial(), + .attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCKED, false, true, 2), new AttackMove(Moves.UPPER_HAND, Type.FIGHTING, MoveCategory.PHYSICAL, 65, 100, 15, -1, 3, 9) .partial(), new AttackMove(Moves.MALIGNANT_CHAIN, Type.POISON, MoveCategory.SPECIAL, 100, 100, 5, 50, 0, 9) diff --git a/src/phases.ts b/src/phases.ts index e6e72b355ac..07fa63e859d 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -3857,6 +3857,12 @@ export class PokemonHealPhase extends CommonAnimPhase { return; } + if (pokemon.getTag(HealBlockTag)) { + this.scene.queueMessage(getPokemonMessage(pokemon, ' was prevented from healing!')); + super.end(); + return; + } + const fullHp = pokemon.getHpRatio() >= 1; const hasMessage = !!this.message;