mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-17 23:35:22 +01:00
[Bug] Fix CheckSwitchPhase on single -> double and reload (#6594)
This commit is contained in:
parent
985b0ea483
commit
abf2df5147
@ -579,21 +579,22 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
currentBattle.battleType !== BattleType.TRAINER
|
currentBattle.battleType !== BattleType.TRAINER
|
||||||
&& (currentBattle.waveIndex > 1 || !globalScene.gameMode.isDaily)
|
&& (currentBattle.waveIndex > 1 || !globalScene.gameMode.isDaily)
|
||||||
&& availablePartyMembers.length > minPartySize;
|
&& availablePartyMembers.length > minPartySize;
|
||||||
|
const checkSwitchIndices: number[] = [];
|
||||||
|
|
||||||
const phaseManager = globalScene.phaseManager;
|
const phaseManager = globalScene.phaseManager;
|
||||||
if (!availablePartyMembers[0].isOnField()) {
|
if (!availablePartyMembers[0].isOnField()) {
|
||||||
phaseManager.pushNew("SummonPhase", 0, true, false, checkSwitch);
|
phaseManager.pushNew("SummonPhase", 0, true, false, checkSwitch);
|
||||||
} else if (checkSwitch) {
|
} else if (checkSwitch) {
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
|
checkSwitchIndices.push(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentBattle.double) {
|
if (currentBattle.double) {
|
||||||
if (availablePartyMembers.length > 1) {
|
if (availablePartyMembers.length > 1) {
|
||||||
phaseManager.pushNew("ToggleDoublePositionPhase", true);
|
phaseManager.pushNew("ToggleDoublePositionPhase", true);
|
||||||
if (!availablePartyMembers[1].isOnField()) {
|
if (!availablePartyMembers[1].isOnField()) {
|
||||||
phaseManager.pushNew("SummonPhase", 1);
|
phaseManager.pushNew("SummonPhase", 1, true, false, checkSwitch);
|
||||||
} else if (checkSwitch) {
|
} else if (checkSwitch) {
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 1, globalScene.currentBattle.double);
|
checkSwitchIndices.push(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -602,6 +603,9 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
phaseManager.pushNew("ToggleDoublePositionPhase", false);
|
phaseManager.pushNew("ToggleDoublePositionPhase", false);
|
||||||
}
|
}
|
||||||
|
checkSwitchIndices.forEach(i => {
|
||||||
|
phaseManager.pushNew("CheckSwitchPhase", i, globalScene.currentBattle.double);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
handleTutorial(Tutorial.Access_Menu).then(() => super.end());
|
handleTutorial(Tutorial.Access_Menu).then(() => super.end());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -414,11 +414,12 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||||||
encounterMode !== MysteryEncounterMode.TRAINER_BATTLE
|
encounterMode !== MysteryEncounterMode.TRAINER_BATTLE
|
||||||
&& !this.disableSwitch
|
&& !this.disableSwitch
|
||||||
&& availablePartyMembers.length > minPartySize;
|
&& availablePartyMembers.length > minPartySize;
|
||||||
|
const checkSwitchIndices: number[] = [];
|
||||||
|
|
||||||
if (!availablePartyMembers[0].isOnField()) {
|
if (!availablePartyMembers[0].isOnField()) {
|
||||||
globalScene.phaseManager.pushNew("SummonPhase", 0, true, false, checkSwitch);
|
globalScene.phaseManager.pushNew("SummonPhase", 0, true, false, checkSwitch);
|
||||||
} else if (checkSwitch) {
|
} else if (checkSwitch) {
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
|
checkSwitchIndices.push(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalScene.currentBattle.double) {
|
if (globalScene.currentBattle.double) {
|
||||||
@ -427,7 +428,7 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||||||
if (!availablePartyMembers[1].isOnField()) {
|
if (!availablePartyMembers[1].isOnField()) {
|
||||||
globalScene.phaseManager.pushNew("SummonPhase", 1, true, false, checkSwitch);
|
globalScene.phaseManager.pushNew("SummonPhase", 1, true, false, checkSwitch);
|
||||||
} else if (checkSwitch) {
|
} else if (checkSwitch) {
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
|
checkSwitchIndices.push(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -438,16 +439,9 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||||||
globalScene.phaseManager.pushNew("ToggleDoublePositionPhase", false);
|
globalScene.phaseManager.pushNew("ToggleDoublePositionPhase", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encounterMode !== MysteryEncounterMode.TRAINER_BATTLE && !this.disableSwitch) {
|
checkSwitchIndices.forEach(i => {
|
||||||
const minPartySize = globalScene.currentBattle.double ? 2 : 1;
|
globalScene.phaseManager.pushNew("CheckSwitchPhase", i, globalScene.currentBattle.double);
|
||||||
if (availablePartyMembers.length > minPartySize) {
|
});
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
|
|
||||||
if (globalScene.currentBattle.double) {
|
|
||||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 1, globalScene.currentBattle.double);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -279,6 +279,14 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
|
|
||||||
pokemon.resetTurnData();
|
pokemon.resetTurnData();
|
||||||
|
|
||||||
|
if (this.checkSwitch) {
|
||||||
|
globalScene.phaseManager.pushNew(
|
||||||
|
"CheckSwitchPhase",
|
||||||
|
this.getPokemon().getFieldIndex(),
|
||||||
|
globalScene.currentBattle.double,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.loaded
|
!this.loaded
|
||||||
|| [BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(globalScene.currentBattle.battleType)
|
|| [BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(globalScene.currentBattle.battleType)
|
||||||
@ -290,13 +298,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
queuePostSummon(): void {
|
queuePostSummon(): void {
|
||||||
if (this.checkSwitch) {
|
if (!this.checkSwitch) {
|
||||||
globalScene.phaseManager.pushNew(
|
|
||||||
"CheckSwitchPhase",
|
|
||||||
this.getPokemon().getFieldIndex(),
|
|
||||||
globalScene.currentBattle.double,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
globalScene.phaseManager.pushNew("PostSummonPhase", this.getPokemon().getBattlerIndex(), this.phaseName);
|
globalScene.phaseManager.pushNew("PostSummonPhase", this.getPokemon().getBattlerIndex(), this.phaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user