Fix sturdy (#604)
* Fixes sturdy to stop popping up even if not used * Made changes to better the code, also added a check for wonder_guard 1hp * Refined code, as requested by bennybroseph * Made a small fix and added better comments in relation to interaction with Wonder_guard abilitypull/766/head^2
parent
512cc5b965
commit
9e453c5b0f
|
@ -249,11 +249,14 @@ export class PreDefendFormChangeAbAttr extends PreDefendAbAttr {
|
||||||
}
|
}
|
||||||
export class PreDefendFullHpEndureAbAttr extends PreDefendAbAttr {
|
export class PreDefendFullHpEndureAbAttr extends PreDefendAbAttr {
|
||||||
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
if (pokemon.getMaxHp() <= 1 && (pokemon.getHpRatio() < 1 || (args[0] as Utils.NumberHolder).value < pokemon.hp))
|
if (pokemon.hp === pokemon.getMaxHp() &&
|
||||||
return false;
|
pokemon.getMaxHp() > 1 && //Checks if pokemon has wonder_guard (which forces 1hp)
|
||||||
|
(args[0] as Utils.NumberHolder).value >= pokemon.hp){ //Damage >= hp
|
||||||
return pokemon.addTag(BattlerTagType.STURDY, 1);
|
return pokemon.addTag(BattlerTagType.STURDY, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BlockItemTheftAbAttr extends AbAttr {
|
export class BlockItemTheftAbAttr extends AbAttr {
|
||||||
|
|
Loading…
Reference in New Issue