Made changes to better the code, also added

a check for wonder_guard 1hp
This commit is contained in:
Tiduzz 2024-05-08 00:58:00 -03:00
parent 69481e0acc
commit 6f54c99cb2

View File

@ -249,10 +249,10 @@ export class PreDefendFormChangeAbAttr extends PreDefendAbAttr {
}
export class PreDefendFullHpEndureAbAttr extends PreDefendAbAttr {
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (pokemon.hp === pokemon.getMaxHp() && (args[0] as Utils.NumberHolder).value >= pokemon.hp){ //Checks if pokemon hp is full and if the damage is higher or equal to defender hp
if (pokemon.hp === pokemon.getMaxHp() && pokemon.getMaxHp() >= 1 && (args[0] as Utils.NumberHolder).value >= pokemon.hp){ //Checks if pokemon hp is full and if the damage is higher or equal to defender hp
return pokemon.addTag(BattlerTagType.STURDY, 1); //activates sturdy
} else {
return
return false
}
}
}