diff --git a/src/data/ability.ts b/src/data/ability.ts index 41f60be96..8801ba807 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -204,7 +204,7 @@ export class PreDefendFullHpEndureAbAttr extends PreDefendAbAttr { if (pokemon.getHpRatio() < 1 || (args[0] as Utils.NumberHolder).value < pokemon.hp) return false; - return pokemon.addTag(BattlerTagType.ENDURING, 1); + return pokemon.addTag(BattlerTagType.STURDY, 1); } } diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index c4fb18cb4..3ef72331c 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -721,6 +721,21 @@ export class EnduringTag extends BattlerTag { } } +export class SturdyTag extends BattlerTag { + constructor(sourceMove: Moves) { + super(BattlerTagType.STURDY, BattlerTagLapseType.TURN_END, 0, sourceMove); + } + + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + if (lapseType === BattlerTagLapseType.CUSTOM) { + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' endured\nthe hit!')); + return true; + } + + return super.lapse(pokemon, lapseType); + } +} + export class PerishSongTag extends BattlerTag { constructor(turnCount: integer) { super(BattlerTagType.PERISH_SONG, BattlerTagLapseType.TURN_END, turnCount, Moves.PERISH_SONG); @@ -1013,6 +1028,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new ContactBurnProtectedTag(sourceMove); case BattlerTagType.ENDURING: return new EnduringTag(sourceMove); + case BattlerTagType.STURDY: + return new SturdyTag(sourceMove); case BattlerTagType.PERISH_SONG: return new PerishSongTag(turnCount); case BattlerTagType.TRUANT: diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index 4021100a2..0ce106187 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -29,6 +29,7 @@ export enum BattlerTagType { BANEFUL_BUNKER = "BANEFUL_BUNKER", BURNING_BULWARK = "BURNING_BULWARK", ENDURING = "ENDURING", + STURDY = "STURDY", PERISH_SONG = "PERISH_SONG", TRUANT = "TRUANT", SLOW_START = "SLOW_START", diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 241f74add..76996dcc0 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1284,11 +1284,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false): integer { if (this.isFainted()) return 0; + const surviveDamage = new Utils.BooleanHolder(false); - if (this.hp >= 1 && this.hp - damage <= 0 && !preventEndure) { - const surviveDamage = new Utils.BooleanHolder(false); - if (this.lapseTag(BattlerTagType.ENDURING)) - surviveDamage.value = true; + if (!preventEndure && this.hp - damage <= 0) { + if(this.hp >= 1 && this.getTag(BattlerTagType.ENDURING)) + surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING) + else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY)) + surviveDamage.value = this.lapseTag(BattlerTagType.STURDY) if (!surviveDamage.value) this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage); if (surviveDamage.value)