Reuse prevent endure for status move damage

pull/850/head
Griffin Zody 2024-05-14 17:37:59 -06:00
parent 8e911ed39e
commit 3583174ac9
2 changed files with 4 additions and 4 deletions

View File

@ -630,7 +630,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
let value = Math.floor(((2 * baseStat + this.ivs[s]) * this.level) * 0.01); let value = Math.floor(((2 * baseStat + this.ivs[s]) * this.level) * 0.01);
if (isHp) { if (isHp) {
value = value + this.level + 10; value = value + this.level + 10;
if (this.hasAbility(Abilities.WONDER_GUARD, false, true) || this.species.speciesId == Species.SHEDINJA) if (this.hasAbility(Abilities.WONDER_GUARD, false, true))
value = 1; value = 1;
if (this.hp > value || this.hp === undefined) if (this.hp > value || this.hp === undefined)
this.hp = value; this.hp = value;
@ -1657,7 +1657,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return result; return result;
} }
damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false, statusDamage: boolean = false): integer { damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false): integer {
if (this.isFainted()) if (this.isFainted())
return 0; return 0;
const surviveDamage = new Utils.BooleanHolder(false); const surviveDamage = new Utils.BooleanHolder(false);
@ -1667,7 +1667,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING) surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING)
else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY)) else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY))
surviveDamage.value = this.lapseTag(BattlerTagType.STURDY) surviveDamage.value = this.lapseTag(BattlerTagType.STURDY)
if (!statusDamage && !surviveDamage.value) if (!surviveDamage.value)
this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage); this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage);
if (surviveDamage.value) if (surviveDamage.value)
damage = this.hp - 1; damage = this.hp - 1;

View File

@ -2992,7 +2992,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
break; break;
} }
if (damage) { if (damage) {
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage, statusDamage)); this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage, false, statusDamage));
pokemon.updateInfo(); pokemon.updateInfo();
} }
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end());