mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 22:12:16 +02:00
Move logic to PostSummonPhase
This commit is contained in:
parent
3ab6f15e49
commit
2e2864c0f1
@ -6,6 +6,7 @@ import { StatusEffect } from "#app/enums/status-effect";
|
|||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
import { MysteryEncounterPostSummonTag } from "#app/data/battler-tags";
|
import { MysteryEncounterPostSummonTag } from "#app/data/battler-tags";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
import { Stat } from "#enums/stat";
|
||||||
|
|
||||||
export class PostSummonPhase extends PokemonPhase {
|
export class PostSummonPhase extends PokemonPhase {
|
||||||
start() {
|
start() {
|
||||||
@ -13,6 +14,24 @@ export class PostSummonPhase extends PokemonPhase {
|
|||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
|
// If another PostSummonPhase exists which should go first, move this one back
|
||||||
|
globalScene.phaseQueue;
|
||||||
|
const fasterPhase = globalScene.findPhase(
|
||||||
|
phase =>
|
||||||
|
phase instanceof PostSummonPhase &&
|
||||||
|
phase.getPokemon().getEffectiveStat(Stat.SPD) > pokemon.getEffectiveStat(Stat.SPD),
|
||||||
|
);
|
||||||
|
if (fasterPhase) {
|
||||||
|
globalScene.prependToPhaseWithCondition(
|
||||||
|
new PostSummonPhase(this.getPokemon().getBattlerIndex()),
|
||||||
|
PostSummonPhase,
|
||||||
|
(newPhase: PostSummonPhase, prependPhase: PostSummonPhase) =>
|
||||||
|
prependPhase.getPokemon().getEffectiveStat(Stat.SPD) < newPhase.getPokemon().getEffectiveStat(Stat.SPD),
|
||||||
|
);
|
||||||
|
this.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
||||||
pokemon.status.toxicTurnCount = 0;
|
pokemon.status.toxicTurnCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import { GameOverPhase } from "./game-over-phase";
|
|||||||
import { ShinySparklePhase } from "./shiny-sparkle-phase";
|
import { ShinySparklePhase } from "./shiny-sparkle-phase";
|
||||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { Stat } from "#enums/stat";
|
|
||||||
|
|
||||||
export class SummonPhase extends PartyMemberPokemonPhase {
|
export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
@ -284,13 +283,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
queuePostSummon(): void {
|
queuePostSummon(): void {
|
||||||
// Insert PostSummonPhase in speed order
|
globalScene.pushPhase(new PostSummonPhase(this.getPokemon().getBattlerIndex()));
|
||||||
globalScene.prependToPhaseWithCondition(
|
|
||||||
new PostSummonPhase(this.getPokemon().getBattlerIndex()),
|
|
||||||
PostSummonPhase,
|
|
||||||
(newPhase: PostSummonPhase, prependPhase: PostSummonPhase) =>
|
|
||||||
prependPhase.getPokemon().getEffectiveStat(Stat.SPD) < newPhase.getPokemon().getEffectiveStat(Stat.SPD),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end() {
|
end() {
|
||||||
|
Loading…
Reference in New Issue
Block a user