mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Merge pull request #1 from DayKev/true-force-switch-patch-1
PR review suggestions
This commit is contained in:
commit
ade805d628
@ -5979,10 +5979,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (switchOutTarget.hp && SwitchType.FORCE_SWITCH) {
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.FORCE_SWITCH);
|
||||
if (switchOutTarget.hp > 0) {
|
||||
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
||||
switchOutTarget.leaveField(true);
|
||||
const slotIndex = Utils.randIntRange(user.scene.currentBattle.getBattlerCount(), user.scene.getPlayerParty().length);
|
||||
user.scene.unshiftPhase(
|
||||
user.scene.prependToPhase(
|
||||
new SwitchSummonPhase(
|
||||
user.scene,
|
||||
this.switchType,
|
||||
@ -5990,24 +5991,35 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
slotIndex,
|
||||
false,
|
||||
true
|
||||
)
|
||||
),
|
||||
MoveEndPhase
|
||||
);
|
||||
}
|
||||
if (switchOutTarget.hp > 0 && !SwitchType.FORCE_SWITCH) {
|
||||
} else {
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
user.scene.prependToPhase(new SwitchPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(), true, true), MoveEndPhase);
|
||||
user.scene.prependToPhase(
|
||||
new SwitchPhase(
|
||||
user.scene,
|
||||
this.switchType,
|
||||
switchOutTarget.getFieldIndex(),
|
||||
true,
|
||||
true
|
||||
),
|
||||
MoveEndPhase
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (user.scene.currentBattle.battleType !== BattleType.WILD) {
|
||||
// Switch out logic for trainer battles
|
||||
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||
return false;
|
||||
}
|
||||
if (switchOutTarget.hp && SwitchType.FORCE_SWITCH) {
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.FORCE_SWITCH);
|
||||
if (switchOutTarget.hp > 0) {
|
||||
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
||||
switchOutTarget.leaveField(true);
|
||||
const slotIndex = Utils.randIntRange(user.scene.currentBattle.getBattlerCount(), user.scene.getEnemyParty().length);
|
||||
user.scene.unshiftPhase(
|
||||
user.scene.prependToPhase(
|
||||
new SwitchSummonPhase(
|
||||
user.scene,
|
||||
this.switchType,
|
||||
@ -6015,15 +6027,24 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
slotIndex,
|
||||
false,
|
||||
false
|
||||
)
|
||||
),
|
||||
MoveEndPhase
|
||||
);
|
||||
}
|
||||
if (switchOutTarget.hp > 0 && !SwitchType.FORCE_SWITCH) {
|
||||
} else {
|
||||
// for opponent switching out
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
user.scene.prependToPhase(new SwitchSummonPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(),
|
||||
user.scene.prependToPhase(
|
||||
new SwitchSummonPhase(
|
||||
user.scene,
|
||||
this.switchType,
|
||||
switchOutTarget.getFieldIndex(),
|
||||
(user.scene.currentBattle.trainer ? user.scene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot) : 0),
|
||||
false, false), MoveEndPhase);
|
||||
false,
|
||||
false
|
||||
),
|
||||
MoveEndPhase
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
|
@ -12,6 +12,5 @@ export enum SwitchType {
|
||||
/** Transfers the returning Pokemon's Substitute to the switched in Pokemon */
|
||||
SHED_TAIL,
|
||||
/** Force switchout to a random party member */
|
||||
FORCE_SWITCH
|
||||
|
||||
FORCE_SWITCH,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user