From 3e9fdc2d0ac1f309c57e9a985ec303910027990a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 11 Apr 2024 20:01:43 -0400 Subject: [PATCH] Fix rest not overriding status --- src/data/move.ts | 2 +- src/field/pokemon.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index a9f84dd41..1d6b40c69 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3416,7 +3416,7 @@ export function initMoves() { new SelfStatusMove(Moves.REST, "Rest", Type.PSYCHIC, -1, 5, "The user goes to sleep for two turns. This fully restores the user's HP and heals any status conditions.", -1, 0, 1) .attr(StatusEffectAttr, StatusEffect.SLEEP, true, 3, true) .attr(HealAttr, 1, true) - .condition((user, target, move) => user.getHpRatio() < 1 && user.canSetStatus(StatusEffect.SLEEP, true)) + .condition((user, target, move) => user.getHpRatio() < 1 && user.canSetStatus(StatusEffect.SLEEP, true, true)) .triageMove(), new AttackMove(Moves.ROCK_SLIDE, "Rock Slide", Type.ROCK, MoveCategory.PHYSICAL, 75, 90, 10, "Large boulders are hurled at opposing Pokémon to inflict damage. This may also make the opposing Pokémon flinch.", 30, 0, 1) .attr(FlinchAttr) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 209713adc..06ff004b1 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1688,9 +1688,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return this.gender !== Gender.GENDERLESS && pokemon.gender === (this.gender === Gender.MALE ? Gender.FEMALE : Gender.MALE); } - canSetStatus(effect: StatusEffect, quiet: boolean = false): boolean { + canSetStatus(effect: StatusEffect, quiet: boolean = false, overrideStatus: boolean = false): boolean { if (effect !== StatusEffect.FAINT) { - if (this.status) + if (overrideStatus ? this.status?.effect === effect : this.status) return false; if (this.isGrounded() && this.scene.arena.terrain?.terrainType === TerrainType.MISTY) return false;