diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index af6d53bfda9..a89a141bca5 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -5540,24 +5540,6 @@ function applySingleAbAttrs( } } -/** - * Calculates the amount of recovery from the Shell Bell item. - * - * If the Pokémon is holding a Shell Bell, this function computes the amount of health - * recovered based on the damage dealt in the current turn. The recovery is multiplied by the - * Shell Bell's modifier (if any). - * - * @param pokemon - The Pokémon whose Shell Bell recovery is being calculated. - * @returns The amount of health recovered by Shell Bell, or `0` if none are present. - */ -function calculateShellBellRecovery(pokemon: Pokemon): number { - const shellBellModifier = pokemon.getHeldItems().find(m => m instanceof HitHealModifier); - if (shellBellModifier) { - return toDmgValue(pokemon.turnData.lastMoveDamageDealt / 8) * shellBellModifier.stackCount; - } - return 0; -} - /** * Triggers after the Pokemon takes any damage * @extends AbAttr @@ -5645,7 +5627,7 @@ export class PostDamageForceSwitchAbAttr extends ForceSwitch(PostDamageAbAttr) { return false; } - return this.canSwitchOut(pokemon, oppponent) + return this.canSwitchOut(pokemon, undefined) } /** diff --git a/src/data/mixins/force-switch.ts b/src/data/mixins/force-switch.ts index 12e9b34e43b..964c11bf1e1 100644 --- a/src/data/mixins/force-switch.ts +++ b/src/data/mixins/force-switch.ts @@ -34,7 +34,7 @@ export function ForceSwitch(Base: TBase) { * @param switchOutTarget - The {@linkcode Pokemon} attempting to switch out. * @param opponent - The {@linkcode Pokemon} opposing the currently switched out Pokemon. - * Unused if {@linkcode selfSwitch} is `true`, in which case it should conventionally be set to `undefined`. + * Unused if {@linkcode selfSwitch} is `true`, as it is only used to check Suction Cups. * @returns Whether {@linkcode switchOutTarget} can be switched out by the current Move or Ability. */ protected canSwitchOut(switchOutTarget: Pokemon, opponent: Pokemon | undefined): boolean { diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index c5079ee9c48..534bdc2fa01 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -1633,6 +1633,7 @@ export class CelebrateAttr extends MoveEffectAttr { } export class RecoilAttr extends MoveEffectAttr { + /** Whether the recoil damage should use the user's max HP (`true`) or damage dealt `false`. */ private useHp: boolean; private damageRatio: number; private unblockable: boolean; @@ -1665,8 +1666,8 @@ export class RecoilAttr extends MoveEffectAttr { return false; } - const damageValue = (!this.useHp ? user.turnData.lastMoveDamageDealt : user.getMaxHp()) * this.damageRatio; - const minValue = user.turnData.lastMoveDamageDealt ? 1 : 0; + const damageValue = (!this.useHp ? user.turnData.singleHitDamageDealt : user.getMaxHp()) * this.damageRatio; + const minValue = user.turnData.singleHitDamageDealt ? 1 : 0; const recoilDamage = toDmgValue(damageValue, minValue); if (!recoilDamage) { return false; diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 7a7208ecd07..5f1c487f1b8 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -10,6 +10,7 @@ import { IgnoreMoveEffectsAbAttr, MaxMultiHitAbAttr, PostAttackAbAttr, + PostDamageAbAttr, PostDefendAbAttr, ReflectStatusMoveAbAttr, } from "#app/data/abilities/ability"; @@ -100,9 +101,6 @@ export class MoveEffectPhase extends PokemonPhase { /** Phases queued during moves */ private queuedPhases: Phase[] = []; - /** The amount of direct attack damage taken by each of this Phase's targets. */ - private targetDamageTaken: number[] = []; - /** * @param reflected Indicates that the move was reflected by the user due to magic coat or magic bounce * @param virtual Indicates that the move is a virtual move (i.e. called by metronome) @@ -125,7 +123,6 @@ export class MoveEffectPhase extends PokemonPhase { this.targets = targets; this.hitChecks = Array(this.targets.length).fill([HitCheckResult.PENDING, 0]); - this.targetDamageTaken = Array(this.targets.length).fill(0); } /** @@ -788,6 +785,7 @@ export class MoveEffectPhase extends PokemonPhase { } if (this.lastHit) { globalScene.triggerPokemonFormChange(user, SpeciesFormChangePostMoveTrigger); + applyPostDamageAbAttrs(PostDamageAbAttr, target, target.turnData.lastMoveDamageDealt); } } diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index e704b040d20..3b8405621f2 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -160,6 +160,7 @@ export class MovePhase extends BattlePhase { } this.pokemon.turnData.acted = true; + this.pokemon.turnData.lastMoveDamageDealt = 0; // Reset hit-related turn data when starting follow-up moves (e.g. Metronomed moves, Dancer repeats) if (this.followUp) {