mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Update comments slightly, replace ||
chain with .includes()
This commit is contained in:
parent
94c837a033
commit
ba5e9bca79
@ -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
|
* 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 it did, the user of U-turn or Volt Switch will not be switched out.
|
||||||
*/
|
*/
|
||||||
if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) &&
|
if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr)
|
||||||
(move.id === Moves.U_TURN || move.id === Moves.VOLT_SWITCH || move.id === Moves.FLIP_TURN)
|
&& [ Moves.U_TURN, Moves.VOLT_SWITCH, Moves.FLIP_TURN ].includes(move.id)
|
||||||
) {
|
) {
|
||||||
if (this.hpDroppedBelowHalf(target)) {
|
if (this.hpDroppedBelowHalf(target)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Switch out logic for the player's Pokemon
|
|
||||||
if (switchOutTarget.scene.getPlayerParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
if (switchOutTarget.scene.getPlayerParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -6010,11 +6010,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (user.scene.currentBattle.battleType !== BattleType.WILD) {
|
} else if (user.scene.currentBattle.battleType !== BattleType.WILD) { // Switch out logic for enemy trainers
|
||||||
// Switch out logic for trainer battles
|
|
||||||
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switchOutTarget.hp > 0) {
|
if (switchOutTarget.hp > 0) {
|
||||||
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
||||||
switchOutTarget.leaveField(true);
|
switchOutTarget.leaveField(true);
|
||||||
@ -6031,7 +6031,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
MoveEndPhase
|
MoveEndPhase
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// for opponent switching out
|
|
||||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||||
user.scene.prependToPhase(
|
user.scene.prependToPhase(
|
||||||
new SwitchSummonPhase(
|
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
|
* 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 it did, the user of U-turn or Volt Switch will not be switched out.
|
||||||
*/
|
*/
|
||||||
if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) &&
|
if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr)
|
||||||
(move.id === Moves.U_TURN || move.id === Moves.VOLT_SWITCH) || move.id === Moves.FLIP_TURN) {
|
&& [ Moves.U_TURN, Moves.VOLT_SWITCH, Moves.FLIP_TURN ].includes(move.id)
|
||||||
|
) {
|
||||||
if (this.hpDroppedBelowHalf(target)) {
|
if (this.hpDroppedBelowHalf(target)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch out logic for everything else (eg: WILD battles)
|
|
||||||
if (user.scene.currentBattle.waveIndex % 10 === 0) {
|
if (user.scene.currentBattle.waveIndex % 10 === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user