Minor changes

This commit is contained in:
Flashfyre 2024-04-09 18:04:52 -04:00
parent 61161ae386
commit 9ef87f0929
2 changed files with 6 additions and 5 deletions

View File

@ -1566,8 +1566,10 @@ export class PostFaintAbAttr extends AbAttr {
export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
private damageRatio: integer; private damageRatio: integer;
constructor(damageRatio: integer) { constructor(damageRatio: integer) {
super(); super();
this.damageRatio = damageRatio; this.damageRatio = damageRatio;
} }
@ -1576,11 +1578,12 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
attacker.damageAndUpdate(Math.ceil(attacker.getMaxHp() * (1 / this.damageRatio)), HitResult.OTHER); attacker.damageAndUpdate(Math.ceil(attacker.getMaxHp() * (1 / this.damageRatio)), HitResult.OTHER);
return true; return true;
} }
return false; return false;
} }
getTriggerMessage(pokemon: Pokemon, ...args: any[]): string { 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!`);
} }
} }

View File

@ -2878,10 +2878,8 @@ export class FaintPhase extends PokemonPhase {
if (pokemon.getAbility().hasAttr(PostFaintAbAttr)) { if (pokemon.getAbility().hasAttr(PostFaintAbAttr)) {
if (pokemon.turnData?.attacksReceived?.length) { if (pokemon.turnData?.attacksReceived?.length) {
const defeatSource = this.scene.getPokemonById(pokemon.turnData.attacksReceived[0].sourceId); const lastAttack = pokemon.turnData.attacksReceived[0];
const defeatMove = new PokemonMove(pokemon.turnData.attacksReceived[0].move); applyPostFaintAbAttrs(PostFaintAbAttr,pokemon, this.scene.getPokemonById(lastAttack.sourceId), new PokemonMove(lastAttack.move), lastAttack.result);
const defeatResult = pokemon.turnData.attacksReceived[0].result;
applyPostFaintAbAttrs(PostFaintAbAttr,pokemon,defeatSource,defeatMove,defeatResult);
} }
} }