Applies ClearWeatherAbAttr and PostFaintAbAttr separately for edge case of fused pokemon

This commit is contained in:
Christopher Schmidt 2024-08-27 11:23:11 -04:00
parent 0e6194992d
commit b2ec961294

View File

@ -62,7 +62,10 @@ export class FaintPhase extends PokemonPhase {
if (pokemon.turnData?.attacksReceived?.length) {
const lastAttack = pokemon.turnData.attacksReceived[0];
if (pokemon.hasAbilityWithAttr(PostFaintClearWeatherAbAttr) || lastAttack.sourceId !== pokemon.id) { // prevent applying faint abilities to self unless its clear weather
if (pokemon.hasAbilityWithAttr(PostFaintClearWeatherAbAttr)) {
applyPostFaintAbAttrs(PostFaintClearWeatherAbAttr, pokemon, this.scene.getPokemonById(lastAttack.sourceId)!, new PokemonMove(lastAttack.move).getMove(), lastAttack.result);
}
if (lastAttack.sourceId !== pokemon.id) { // prevent applying faint abilities to self unless its clear weather
applyPostFaintAbAttrs(PostFaintAbAttr, pokemon, this.scene.getPokemonById(lastAttack.sourceId)!, new PokemonMove(lastAttack.move).getMove(), lastAttack.result);
}
}