From a691c43d33b3faef5c24519eef59c5a3d0606c08 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Fri, 8 Aug 2025 13:47:30 -0400 Subject: [PATCH] Fixed bugs --- src/data/abilities/ability.ts | 17 +++++++++++------ src/data/positional-tags/positional-tag.ts | 1 + src/phases/pokemon-heal-phase.ts | 4 +--- src/phases/turn-end-phase.ts | 16 +++++++++++----- test/moves/wish.test.ts | 5 +++++ test/test-utils/phase-interceptor.ts | 2 +- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 2184b4b38df..4ea08bbbd58 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -748,12 +748,17 @@ export class TypeImmunityHealAbAttr extends TypeImmunityAbAttr { const { pokemon, cancelled, simulated, passive } = params; if (!pokemon.isFullHp() && !simulated) { const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; - globalScene.phaseManager.unshiftNew("PokemonHealPhase", pokemon.getBattlerIndex(), pokemon.getMaxHp() / 4, { - message: i18next.t("abilityTriggers:typeImmunityHeal", { - pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName, - }), - }); + globalScene.phaseManager.unshiftNew( + "PokemonHealPhase", + pokemon.getBattlerIndex(), + toDmgValue(pokemon.getMaxHp() / 4), + { + message: i18next.t("abilityTriggers:typeImmunityHeal", { + pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), + abilityName, + }), + }, + ); cancelled.value = true; // Suppresses "No Effect" message } } diff --git a/src/data/positional-tags/positional-tag.ts b/src/data/positional-tags/positional-tag.ts index 2c5e270a65f..2dc76601ed4 100644 --- a/src/data/positional-tags/positional-tag.ts +++ b/src/data/positional-tags/positional-tag.ts @@ -160,6 +160,7 @@ export class WishTag extends PositionalTag implements WishArgs { message: i18next.t("arenaTag:wishTagOnAdd", { pokemonNameWithAffix: this.pokemonName, }), + showFullHpMessage: false, }); } diff --git a/src/phases/pokemon-heal-phase.ts b/src/phases/pokemon-heal-phase.ts index cbb5b3d6d9e..9fccdf03ec4 100644 --- a/src/phases/pokemon-heal-phase.ts +++ b/src/phases/pokemon-heal-phase.ts @@ -90,14 +90,12 @@ export class PokemonHealPhase extends CommonAnimPhase { } override start() { - // Only play animation if not skipped and target is at full HP + // Only play animation if not skipped and target is not at full HP if (!this.skipAnim && !this.getPokemon().isFullHp()) { super.start(); } this.heal(); - - super.end(); } private heal() { diff --git a/src/phases/turn-end-phase.ts b/src/phases/turn-end-phase.ts index 1a994acca49..11e8c7dea80 100644 --- a/src/phases/turn-end-phase.ts +++ b/src/phases/turn-end-phase.ts @@ -14,6 +14,7 @@ import { TurnStatusEffectModifier, } from "#modifiers/modifier"; import { FieldPhase } from "#phases/field-phase"; +import { toDmgValue } from "#utils/common"; import i18next from "i18next"; export class TurnEndPhase extends FieldPhase { @@ -35,11 +36,16 @@ export class TurnEndPhase extends FieldPhase { globalScene.applyModifiers(TurnHealModifier, pokemon.isPlayer(), pokemon); if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) { - globalScene.phaseManager.unshiftNew("PokemonHealPhase", pokemon.getBattlerIndex(), pokemon.getMaxHp() / 16, { - message: i18next.t("battle:turnEndHpRestore", { - pokemonName: getPokemonNameWithAffix(pokemon), - }), - }); + globalScene.phaseManager.unshiftNew( + "PokemonHealPhase", + pokemon.getBattlerIndex(), + toDmgValue(pokemon.getMaxHp() / 16), + { + message: i18next.t("battle:turnEndHpRestore", { + pokemonName: getPokemonNameWithAffix(pokemon), + }), + }, + ); } if (!pokemon.isPlayer()) { diff --git a/test/moves/wish.test.ts b/test/moves/wish.test.ts index 147c598106b..9b005c3d479 100644 --- a/test/moves/wish.test.ts +++ b/test/moves/wish.test.ts @@ -144,6 +144,11 @@ describe("Move - Wish", () => { expectWishActive(0); const healPhases = game.scene.phaseManager.phaseQueue.filter(p => p.is("PokemonHealPhase")); + // account for phase interceptor stopping jank + const currPhase = game.scene.phaseManager.getCurrentPhase()!; + if (currPhase.is("PokemonHealPhase")) { + healPhases.unshift(currPhase); + } expect(healPhases).toHaveLength(4); expect.soft(healPhases.map(php => php.getPokemon())).toEqual(oldOrder); diff --git a/test/test-utils/phase-interceptor.ts b/test/test-utils/phase-interceptor.ts index dacd0f3fdc6..3473204cbea 100644 --- a/test/test-utils/phase-interceptor.ts +++ b/test/test-utils/phase-interceptor.ts @@ -101,6 +101,7 @@ export class PhaseInterceptor { * `initPhases()` so that its subclasses can use `super.start()` properly. */ private PHASES = [ + [PokemonHealPhase, this.startPhase], [LoginPhase, this.startPhase], [TitlePhase, this.startPhase], [SelectGenderPhase, this.startPhase], @@ -147,7 +148,6 @@ export class PhaseInterceptor { [PositionalTagPhase, this.startPhase], [PokemonTransformPhase, this.startPhase], [MysteryEncounterPhase, this.startPhase], - [PokemonHealPhase, this.startPhase], [MysteryEncounterOptionSelectedPhase, this.startPhase], [MysteryEncounterBattlePhase, this.startPhase], [MysteryEncounterRewardsPhase, this.startPhase],