From 45f3709c85de842c6b9a27257c0c754ee08dea18 Mon Sep 17 00:00:00 2001 From: DustinLin Date: Fri, 10 May 2024 14:26:32 -0400 Subject: [PATCH] fix sturdy ability endure condition --- src/field/pokemon.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 8afff1b2724..46eef83c076 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -134,7 +134,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.exp = dataSource?.exp || getLevelTotalExp(this.level, species.growthRate); this.levelExp = dataSource?.levelExp || 0; if (dataSource) { - this.id = dataSource.id; + this.id = dataSource.id this.hp = dataSource.hp; this.stats = dataSource.stats; this.ivs = dataSource.ivs; @@ -1528,9 +1528,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const surviveDamage = new Utils.BooleanHolder(false); if (!preventEndure && this.hp - damage <= 0) { + // Endure prevents HP from going below 1 for the turn, Sturdy only prevents getting 100 to 0'ed by a single move if(this.hp >= 1 && this.getTag(BattlerTagType.ENDURING)) surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING) - else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY)) + else if (this.hp == this.getMaxHp() && this.getTag(BattlerTagType.STURDY)) surviveDamage.value = this.lapseTag(BattlerTagType.STURDY) if (!surviveDamage.value) this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage);