Prevent the last valid pokemon from being forced to switch (#4481)
This commit is contained in:
parent
1b6593d242
commit
7eb755ca9c
|
@ -5226,6 +5226,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
*/
|
||||
const switchOutTarget = this.selfSwitch ? user : target;
|
||||
if (switchOutTarget instanceof PlayerPokemon) {
|
||||
if (switchOutTarget.scene.getParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||
return false;
|
||||
}
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
|
||||
if (switchOutTarget.hp > 0) {
|
||||
|
@ -5234,6 +5237,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
}
|
||||
return false;
|
||||
} else if (user.scene.currentBattle.battleType !== BattleType.WILD) {
|
||||
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||
return false;
|
||||
}
|
||||
// Switch out logic for trainer battles
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
|
||||
|
|
Loading…
Reference in New Issue