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)