From 16ea12cc5b8e0120f34c9c7db7aa386ee1ab9fa3 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:43:23 -0500 Subject: [PATCH] Remove passing of grudge and destiny bond tags to faint phase --- src/field/pokemon.ts | 6 ++++-- src/phases/faint-phase.ts | 35 +++++++---------------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 781427ca926..5ae7d227b3c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -128,6 +128,7 @@ import { TarShotTag, AutotomizedTag, PowerTrickTag, + type GrudgeTag, } from "../data/battler-tags"; import { WeatherType } from "#enums/weather-type"; import { @@ -4754,8 +4755,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { new FaintPhase( this.getBattlerIndex(), false, - destinyTag, - grudgeTag, source, ), ); @@ -4990,6 +4989,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return false; } + /**@overload */ + getTag(tagType: BattlerTagType.GRUDGE): GrudgeTag | nil; + /** @overload */ getTag(tagType: BattlerTagType): BattlerTag | nil; diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index 2e297704501..d1856c9331c 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -9,7 +9,6 @@ import { PostKnockOutAbAttr, PostVictoryAbAttr, } from "#app/data/abilities/ability"; -import type { DestinyBondTag, GrudgeTag } from "#app/data/battler-tags"; import { BattlerTagLapseType } from "#app/data/battler-tags"; import { battleSpecDialogue } from "#app/data/dialogue"; import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/moves/move"; @@ -32,6 +31,7 @@ import { ToggleDoublePositionPhase } from "./toggle-double-position-phase"; import { VictoryPhase } from "./victory-phase"; import { isNullOrUndefined } from "#app/utils"; import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters"; +import { BattlerTagType } from "#enums/battler-tag-type"; export class FaintPhase extends PokemonPhase { /** @@ -39,33 +39,15 @@ export class FaintPhase extends PokemonPhase { */ private preventEndure: boolean; - /** - * Destiny Bond tag belonging to the currently fainting Pokemon, if applicable - */ - private destinyTag?: DestinyBondTag | null; - - /** - * Grudge tag belonging to the currently fainting Pokemon, if applicable - */ - private grudgeTag?: GrudgeTag | null; - /** * The source Pokemon that dealt fatal damage */ private source?: Pokemon; - constructor( - battlerIndex: BattlerIndex, - preventEndure = false, - destinyTag?: DestinyBondTag | null, - grudgeTag?: GrudgeTag | null, - source?: Pokemon, - ) { + constructor(battlerIndex: BattlerIndex, preventEndure = false, source?: Pokemon) { super(battlerIndex); this.preventEndure = preventEndure; - this.destinyTag = destinyTag; - this.grudgeTag = grudgeTag; this.source = source; } @@ -74,16 +56,13 @@ export class FaintPhase extends PokemonPhase { const faintPokemon = this.getPokemon(); + if (this.source) { + faintPokemon.getTag(BattlerTagType.DESTINY_BOND)?.lapse(this.source, BattlerTagLapseType.CUSTOM); + faintPokemon.getTag(BattlerTagType.GRUDGE)?.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source); + } + faintPokemon.resetSummonData(); - if (!isNullOrUndefined(this.destinyTag) && !isNullOrUndefined(this.source)) { - this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM); - } - - if (!isNullOrUndefined(this.grudgeTag) && !isNullOrUndefined(this.source)) { - this.grudgeTag.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source); - } - if (!this.preventEndure) { const instantReviveModifier = globalScene.applyModifier( PokemonInstantReviveModifier,