From e61c63f6c8e4ec68ed4d01c340bf613ca78e8a2a Mon Sep 17 00:00:00 2001 From: Tempoanon <163687446+TempsRay@users.noreply.github.com> Date: Sun, 12 May 2024 17:07:31 -0400 Subject: [PATCH] Implement innards out (#569) * Implement innards out * remove log statement * Some cleanup * Added comment --- src/data/ability.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index cad625715..fa5f8ec75 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2347,6 +2347,26 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { } } +/** + * Attribute used for abilities (Innards Out) that damage the opponent based on how much HP the last attack used to knock out the owner of the ability. + */ +export class PostFaintHPDamageAbAttr extends PostFaintAbAttr { + constructor() { + super (); + } + + applyPostFaint(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { + const damage = pokemon.turnData.attacksReceived[0].damage; + 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)) { @@ -3398,7 +3418,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)