From ba5e9bca79dbf1c7851673fdf734b54ad846d846 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sat, 16 Nov 2024 19:48:58 -0800 Subject: [PATCH] Update comments slightly, replace `||` chain with `.includes()` --- src/data/move.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index ed9b2ad0f15..17f5a1088ea 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5967,14 +5967,14 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { * Check if Wimp Out/Emergency Exit activates due to being hit by U-turn or Volt Switch * If it did, the user of U-turn or Volt Switch will not be switched out. */ - if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) && - (move.id === Moves.U_TURN || move.id === Moves.VOLT_SWITCH || move.id === Moves.FLIP_TURN) + if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) + && [ Moves.U_TURN, Moves.VOLT_SWITCH, Moves.FLIP_TURN ].includes(move.id) ) { if (this.hpDroppedBelowHalf(target)) { return false; } } - // Switch out logic for the player's Pokemon + if (switchOutTarget.scene.getPlayerParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) { return false; } @@ -6010,11 +6010,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } } return false; - } else if (user.scene.currentBattle.battleType !== BattleType.WILD) { - // Switch out logic for trainer battles + } else if (user.scene.currentBattle.battleType !== BattleType.WILD) { // Switch out logic for enemy trainers if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) { return false; } + if (switchOutTarget.hp > 0) { if (this.switchType === SwitchType.FORCE_SWITCH) { switchOutTarget.leaveField(true); @@ -6031,7 +6031,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { MoveEndPhase ); } else { - // for opponent switching out switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH); user.scene.prependToPhase( new SwitchSummonPhase( @@ -6046,19 +6045,19 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { ); } } - } else { + } else { // Switch out logic for wild pokemon /** * Check if Wimp Out/Emergency Exit activates due to being hit by U-turn or Volt Switch * If it did, the user of U-turn or Volt Switch will not be switched out. */ - if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) && - (move.id === Moves.U_TURN || move.id === Moves.VOLT_SWITCH) || move.id === Moves.FLIP_TURN) { + if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) + && [ Moves.U_TURN, Moves.VOLT_SWITCH, Moves.FLIP_TURN ].includes(move.id) + ) { if (this.hpDroppedBelowHalf(target)) { return false; } } - // Switch out logic for everything else (eg: WILD battles) if (user.scene.currentBattle.waveIndex % 10 === 0) { return false; }