diff --git a/src/data/ability.ts b/src/data/ability.ts index e25af8ceccc..6c00f86d5ad 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -1566,8 +1566,10 @@ export class PostFaintAbAttr extends AbAttr { export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { private damageRatio: integer; + constructor(damageRatio: integer) { super(); + this.damageRatio = damageRatio; } @@ -1576,11 +1578,12 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { attacker.damageAndUpdate(Math.ceil(attacker.getMaxHp() * (1 / this.damageRatio)), HitResult.OTHER); return true; } + return false; } getTriggerMessage(pokemon: Pokemon, ...args: any[]): string { - return `${pokemon.name}${(pokemon.name.endsWith('s')?`'`:`'s`)} ${pokemon.getAbility().name} hurt\nits attacker!` + return getPokemonMessage(pokemon, `'s ${pokemon.getAbility().name} hurt\nits attacker!`); } } diff --git a/src/phases.ts b/src/phases.ts index 59834e840df..489a8c76815 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2878,10 +2878,8 @@ export class FaintPhase extends PokemonPhase { if (pokemon.getAbility().hasAttr(PostFaintAbAttr)) { if (pokemon.turnData?.attacksReceived?.length) { - const defeatSource = this.scene.getPokemonById(pokemon.turnData.attacksReceived[0].sourceId); - const defeatMove = new PokemonMove(pokemon.turnData.attacksReceived[0].move); - const defeatResult = pokemon.turnData.attacksReceived[0].result; - applyPostFaintAbAttrs(PostFaintAbAttr,pokemon,defeatSource,defeatMove,defeatResult); + const lastAttack = pokemon.turnData.attacksReceived[0]; + applyPostFaintAbAttrs(PostFaintAbAttr,pokemon, this.scene.getPokemonById(lastAttack.sourceId), new PokemonMove(lastAttack.move), lastAttack.result); } }