From 426f6daccfa5e4682b3321617b2a345239013312 Mon Sep 17 00:00:00 2001 From: Temps Ray Date: Mon, 6 May 2024 17:06:24 -0400 Subject: [PATCH] Implement innards out --- src/data/ability.ts | 21 ++++++++++++++++++++- src/phases.ts | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 07aecbdcc91..e1068ae7e6d 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2275,6 +2275,24 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { } } +export class PostFaintHPDamageAbAttr extends PostFaintAbAttr { + constructor() { + super (); + } + + applyPostFaint(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { + console.log(args); + let damage = args[0]; + attacker.damageAndUpdate((damage), HitResult.OTHER); + attacker.turnData.damageTaken += damage; + return true; + } + + getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { + return getPokemonMessage(pokemon, `'s ${abilityName} hurt\nits attacker!`); + } +} + export class RedirectMoveAbAttr extends AbAttr { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { if (this.canRedirect(args[0] as Moves)) { @@ -3316,7 +3334,8 @@ export function initAbilities() { .attr(FieldPriorityMoveImmunityAbAttr) .ignorable(), new Ability(Abilities.INNARDS_OUT, 7) - .unimplemented(), + .attr(PostFaintHPDamageAbAttr) + .bypassFaint(), new Ability(Abilities.DANCER, 7) .unimplemented(), new Ability(Abilities.BATTERY, 7) diff --git a/src/phases.ts b/src/phases.ts index fc6af354a2d..3aad11de596 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -3135,7 +3135,7 @@ export class FaintPhase extends PokemonPhase { if (pokemon.turnData?.attacksReceived?.length) { const lastAttack = pokemon.turnData.attacksReceived[0]; - applyPostFaintAbAttrs(PostFaintAbAttr, pokemon, this.scene.getPokemonById(lastAttack.sourceId), new PokemonMove(lastAttack.move), lastAttack.result); + applyPostFaintAbAttrs(PostFaintAbAttr, pokemon, this.scene.getPokemonById(lastAttack.sourceId), new PokemonMove(lastAttack.move), lastAttack.result, lastAttack.damage); } const alivePlayField = this.scene.getField(true);