mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-29 13:03:48 +01:00
[Bug][Misc] Moved SelectBiomePhase
in front of NewBattlePhase
(#5694)
* Moved SelectBiomePhase in front of NewBattlePhase * disguise test now has to go to QuietFormChangePhase --------- Co-authored-by: Jimmybald1 <147992650+IBBCalc@users.noreply.github.com>
This commit is contained in:
parent
110fd2f0a1
commit
b848777880
@ -151,7 +151,6 @@ import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
|
|||||||
import { PokemonAnimPhase } from "#app/phases/pokemon-anim-phase";
|
import { PokemonAnimPhase } from "#app/phases/pokemon-anim-phase";
|
||||||
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
||||||
import { ReturnPhase } from "#app/phases/return-phase";
|
import { ReturnPhase } from "#app/phases/return-phase";
|
||||||
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
|
|
||||||
import { ShowTrainerPhase } from "#app/phases/show-trainer-phase";
|
import { ShowTrainerPhase } from "#app/phases/show-trainer-phase";
|
||||||
import { SummonPhase } from "#app/phases/summon-phase";
|
import { SummonPhase } from "#app/phases/summon-phase";
|
||||||
import { SwitchPhase } from "#app/phases/switch-phase";
|
import { SwitchPhase } from "#app/phases/switch-phase";
|
||||||
@ -1298,6 +1297,16 @@ export default class BattleScene extends SceneBase {
|
|||||||
return Math.max(doubleChance.value, 1);
|
return Math.max(doubleChance.value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isNewBiome(currentBattle = this.currentBattle) {
|
||||||
|
const isWaveIndexMultipleOfTen = !(currentBattle.waveIndex % 10);
|
||||||
|
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
|
||||||
|
const isEndlessFifthWave = this.gameMode.hasShortBiomes && currentBattle.waveIndex % 5 === 0;
|
||||||
|
const isWaveIndexMultipleOfFiftyMinusOne = currentBattle.waveIndex % 50 === 49;
|
||||||
|
const isNewBiome =
|
||||||
|
isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne);
|
||||||
|
return isNewBiome;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: ...this never actually returns `null`, right?
|
// TODO: ...this never actually returns `null`, right?
|
||||||
newBattle(
|
newBattle(
|
||||||
waveIndex?: number,
|
waveIndex?: number,
|
||||||
@ -1461,12 +1470,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!waveIndex && lastBattle) {
|
if (!waveIndex && lastBattle) {
|
||||||
const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10);
|
const isNewBiome = this.isNewBiome(lastBattle);
|
||||||
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
|
|
||||||
const isEndlessFifthWave = this.gameMode.hasShortBiomes && lastBattle.waveIndex % 5 === 0;
|
|
||||||
const isWaveIndexMultipleOfFiftyMinusOne = lastBattle.waveIndex % 50 === 49;
|
|
||||||
const isNewBiome =
|
|
||||||
isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne);
|
|
||||||
const resetArenaState =
|
const resetArenaState =
|
||||||
isNewBiome ||
|
isNewBiome ||
|
||||||
[BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(this.currentBattle.battleType) ||
|
[BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(this.currentBattle.battleType) ||
|
||||||
@ -1515,7 +1519,6 @@ export default class BattleScene extends SceneBase {
|
|||||||
if (!this.gameMode.hasRandomBiomes && !isNewBiome) {
|
if (!this.gameMode.hasRandomBiomes && !isNewBiome) {
|
||||||
this.pushPhase(new NextEncounterPhase());
|
this.pushPhase(new NextEncounterPhase());
|
||||||
} else {
|
} else {
|
||||||
this.pushPhase(new SelectBiomePhase());
|
|
||||||
this.pushPhase(new NewBiomeEncounterPhase());
|
this.pushPhase(new NewBiomeEncounterPhase());
|
||||||
|
|
||||||
const newMaxExpLevel = this.getMaxExpLevel();
|
const newMaxExpLevel = this.getMaxExpLevel();
|
||||||
|
@ -72,6 +72,7 @@ import type { AbAttrCondition, PokemonDefendCondition, PokemonStatStageChangeCon
|
|||||||
import type { BattlerIndex } from "#app/battle";
|
import type { BattlerIndex } from "#app/battle";
|
||||||
import type Move from "#app/data/moves/move";
|
import type Move from "#app/data/moves/move";
|
||||||
import type { ArenaTrapTag, SuppressAbilitiesTag } from "#app/data/arena-tag";
|
import type { ArenaTrapTag, SuppressAbilitiesTag } from "#app/data/arena-tag";
|
||||||
|
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
|
||||||
|
|
||||||
export class BlockRecoilDamageAttr extends AbAttr {
|
export class BlockRecoilDamageAttr extends AbAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -5483,6 +5484,11 @@ class ForceSwitchOutHelper {
|
|||||||
|
|
||||||
if (switchOutTarget.hp) {
|
if (switchOutTarget.hp) {
|
||||||
globalScene.pushPhase(new BattleEndPhase(false));
|
globalScene.pushPhase(new BattleEndPhase(false));
|
||||||
|
|
||||||
|
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
|
globalScene.pushPhase(new SelectBiomePhase());
|
||||||
|
}
|
||||||
|
|
||||||
globalScene.pushPhase(new NewBattlePhase());
|
globalScene.pushPhase(new NewBattlePhase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ import { MoveEffectTrigger } from "#enums/MoveEffectTrigger";
|
|||||||
import { MultiHitType } from "#enums/MultiHitType";
|
import { MultiHitType } from "#enums/MultiHitType";
|
||||||
import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves } from "./invalid-moves";
|
import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves } from "./invalid-moves";
|
||||||
import { TrainerVariant } from "#app/field/trainer";
|
import { TrainerVariant } from "#app/field/trainer";
|
||||||
|
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
|
||||||
|
|
||||||
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
|
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
|
||||||
type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean;
|
type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean;
|
||||||
@ -6332,6 +6333,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
|
|
||||||
if (!allyPokemon?.isActive(true) && switchOutTarget.hp) {
|
if (!allyPokemon?.isActive(true) && switchOutTarget.hp) {
|
||||||
globalScene.pushPhase(new BattleEndPhase(false));
|
globalScene.pushPhase(new BattleEndPhase(false));
|
||||||
|
|
||||||
|
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
|
globalScene.pushPhase(new SelectBiomePhase());
|
||||||
|
}
|
||||||
|
|
||||||
globalScene.pushPhase(new NewBattlePhase());
|
globalScene.pushPhase(new NewBattlePhase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import { BattleEndPhase } from "./battle-end-phase";
|
|||||||
import { NewBattlePhase } from "./new-battle-phase";
|
import { NewBattlePhase } from "./new-battle-phase";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
import { SelectBiomePhase } from "./select-biome-phase";
|
||||||
|
|
||||||
export class AttemptRunPhase extends PokemonPhase {
|
export class AttemptRunPhase extends PokemonPhase {
|
||||||
/** For testing purposes: this is to force the pokemon to fail and escape */
|
/** For testing purposes: this is to force the pokemon to fail and escape */
|
||||||
@ -59,6 +60,11 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
globalScene.pushPhase(new BattleEndPhase(false));
|
globalScene.pushPhase(new BattleEndPhase(false));
|
||||||
|
|
||||||
|
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
|
globalScene.pushPhase(new SelectBiomePhase());
|
||||||
|
}
|
||||||
|
|
||||||
globalScene.pushPhase(new NewBattlePhase());
|
globalScene.pushPhase(new NewBattlePhase());
|
||||||
} else {
|
} else {
|
||||||
playerPokemon.turnData.failedRunAway = true;
|
playerPokemon.turnData.failedRunAway = true;
|
||||||
|
@ -27,6 +27,7 @@ import { IvScannerModifier } from "../modifier/modifier";
|
|||||||
import { Phase } from "../phase";
|
import { Phase } from "../phase";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import { isNullOrUndefined, randSeedItem } from "#app/utils/common";
|
import { isNullOrUndefined, randSeedItem } from "#app/utils/common";
|
||||||
|
import { SelectBiomePhase } from "./select-biome-phase";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will handle (in order):
|
* Will handle (in order):
|
||||||
@ -612,6 +613,10 @@ export class PostMysteryEncounterPhase extends Phase {
|
|||||||
*/
|
*/
|
||||||
continueEncounter() {
|
continueEncounter() {
|
||||||
const endPhase = () => {
|
const endPhase = () => {
|
||||||
|
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
|
globalScene.pushPhase(new SelectBiomePhase());
|
||||||
|
}
|
||||||
|
|
||||||
globalScene.pushPhase(new NewBattlePhase());
|
globalScene.pushPhase(new NewBattlePhase());
|
||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
@ -14,9 +14,10 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
const currentBiome = globalScene.arena.biomeType;
|
const currentBiome = globalScene.arena.biomeType;
|
||||||
|
const nextWaveIndex = globalScene.currentBattle.waveIndex + 1;
|
||||||
|
|
||||||
const setNextBiome = (nextBiome: Biome) => {
|
const setNextBiome = (nextBiome: Biome) => {
|
||||||
if (globalScene.currentBattle.waveIndex % 10 === 1) {
|
if (nextWaveIndex % 10 === 1) {
|
||||||
globalScene.applyModifiers(MoneyInterestModifier, true);
|
globalScene.applyModifiers(MoneyInterestModifier, true);
|
||||||
globalScene.unshiftPhase(new PartyHealPhase(false));
|
globalScene.unshiftPhase(new PartyHealPhase(false));
|
||||||
}
|
}
|
||||||
@ -25,13 +26,13 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(globalScene.gameMode.isClassic && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex + 9)) ||
|
(globalScene.gameMode.isClassic && globalScene.gameMode.isWaveFinal(nextWaveIndex + 9)) ||
|
||||||
(globalScene.gameMode.isDaily && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) ||
|
(globalScene.gameMode.isDaily && globalScene.gameMode.isWaveFinal(nextWaveIndex)) ||
|
||||||
(globalScene.gameMode.hasShortBiomes && !(globalScene.currentBattle.waveIndex % 50))
|
(globalScene.gameMode.hasShortBiomes && !(nextWaveIndex % 50))
|
||||||
) {
|
) {
|
||||||
setNextBiome(Biome.END);
|
setNextBiome(Biome.END);
|
||||||
} else if (globalScene.gameMode.hasRandomBiomes) {
|
} else if (globalScene.gameMode.hasRandomBiomes) {
|
||||||
setNextBiome(this.generateNextBiome());
|
setNextBiome(this.generateNextBiome(nextWaveIndex));
|
||||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||||
const biomes: Biome[] = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
const biomes: Biome[] = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter(b => !Array.isArray(b) || !randSeedInt(b[1]))
|
.filter(b => !Array.isArray(b) || !randSeedInt(b[1]))
|
||||||
@ -59,14 +60,14 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
|
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
|
||||||
setNextBiome(biomeLinks[currentBiome] as Biome);
|
setNextBiome(biomeLinks[currentBiome] as Biome);
|
||||||
} else {
|
} else {
|
||||||
setNextBiome(this.generateNextBiome());
|
setNextBiome(this.generateNextBiome(nextWaveIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generateNextBiome(): Biome {
|
generateNextBiome(waveIndex: number): Biome {
|
||||||
if (!(globalScene.currentBattle.waveIndex % 50)) {
|
if (!(waveIndex % 50)) {
|
||||||
return Biome.END;
|
return Biome.END;
|
||||||
}
|
}
|
||||||
return globalScene.generateRandomBiome(globalScene.currentBattle.waveIndex);
|
return globalScene.generateRandomBiome(waveIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@ export class SwitchBiomePhase extends BattlePhase {
|
|||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before switching biomes, make sure to set the last encounter for other phases that need it too.
|
||||||
|
globalScene.lastEnemyTrainer = globalScene.currentBattle?.trainer ?? null;
|
||||||
|
globalScene.lastMysteryEncounter = globalScene.currentBattle?.mysteryEncounter;
|
||||||
|
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: [globalScene.arenaEnemy, globalScene.lastEnemyTrainer],
|
targets: [globalScene.arenaEnemy, globalScene.lastEnemyTrainer],
|
||||||
x: "+=300",
|
x: "+=300",
|
||||||
|
@ -15,6 +15,7 @@ import { TrainerVictoryPhase } from "./trainer-victory-phase";
|
|||||||
import { handleMysteryEncounterVictory } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import { handleMysteryEncounterVictory } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { timedEventManager } from "#app/global-event-manager";
|
import { timedEventManager } from "#app/global-event-manager";
|
||||||
|
import { SelectBiomePhase } from "./select-biome-phase";
|
||||||
|
|
||||||
export class VictoryPhase extends PokemonPhase {
|
export class VictoryPhase extends PokemonPhase {
|
||||||
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
||||||
@ -111,6 +112,11 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
globalScene.pushPhase(new AddEnemyBuffModifierPhase());
|
globalScene.pushPhase(new AddEnemyBuffModifierPhase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
|
||||||
|
globalScene.pushPhase(new SelectBiomePhase());
|
||||||
|
}
|
||||||
|
|
||||||
globalScene.pushPhase(new NewBattlePhase());
|
globalScene.pushPhase(new NewBattlePhase());
|
||||||
} else {
|
} else {
|
||||||
globalScene.currentBattle.battleType = BattleType.CLEAR;
|
globalScene.currentBattle.battleType = BattleType.CLEAR;
|
||||||
|
@ -186,7 +186,7 @@ describe("Abilities - Disguise", () => {
|
|||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.doKillOpponents();
|
await game.doKillOpponents();
|
||||||
await game.phaseInterceptor.to("PartyHealPhase");
|
await game.phaseInterceptor.to("QuietFormChangePhase");
|
||||||
|
|
||||||
expect(mimikyu1.formIndex).toBe(disguisedForm);
|
expect(mimikyu1.formIndex).toBe(disguisedForm);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user