mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-30 21:42:20 +02:00
https://github.com/pagefaultgames/pokerogue/pull/5513
* Add prependToPhaseWithCondition and use it in SummonPhase to determine speed order
* Move logic to PostSummonPhase
* Add test base
* Pivot to using sort strategy instead
* Add and update tests
* Support priority ability activations
* Ensure priority abilities are still activated on switch in
* Add test for priority
* Update to use priority numbers instead of a boolean
* Add ability priorities to constructors
* Move sorting to BattleScene
* Rename phase file
* Update import
* Move application to applyPostSummonAbAttrs and stop assuming no other phases in queue
* Ensure all PostSummonPhases from encounters are added at the same time
* Switch to priority queue approach
* Ensure that zero/negative priority activations happen after postsummonphase
* Revert 07646fe
(not needed due to stable sort)
* Always create separate ability phases for passive and use boolean instead of priority number when applying
* Add test for dynamic updates
* Add BattlerIndex import
* Clear queues for testing
* Benjie suggestion
* Split files
* Update import in battlescene
* Remove extra spaces added by VSCode
* Fix other conflicts
* Update PhaseManager
* Update to use PhaseManager
* Immediately start postsummons
* Fix test
* Fix BattlerIndex import
* Remove unused imports
* Fix postsummon application
* Make priority readonly
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { ArenaTrapTag } from "#app/data/arena-tag";
|
|
import { StatusEffect } from "#app/enums/status-effect";
|
|
import { PokemonPhase } from "./pokemon-phase";
|
|
import { MysteryEncounterPostSummonTag } from "#app/data/battler-tags";
|
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
|
import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
|
|
|
export class PostSummonPhase extends PokemonPhase {
|
|
public readonly phaseName = "PostSummonPhase";
|
|
start() {
|
|
super.start();
|
|
|
|
const pokemon = this.getPokemon();
|
|
|
|
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
|
pokemon.status.toxicTurnCount = 0;
|
|
}
|
|
globalScene.arena.applyTags(ArenaTrapTag, false, pokemon);
|
|
|
|
// If this is mystery encounter and has post summon phase tag, apply post summon effects
|
|
if (
|
|
globalScene.currentBattle.isBattleMysteryEncounter() &&
|
|
pokemon.findTags(t => t instanceof MysteryEncounterPostSummonTag).length > 0
|
|
) {
|
|
pokemon.lapseTag(BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON);
|
|
}
|
|
|
|
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
|
for (const p of field) {
|
|
applyAbAttrs("CommanderAbAttr", p, null, false);
|
|
}
|
|
|
|
this.end();
|
|
}
|
|
|
|
public getPriority() {
|
|
return 0;
|
|
}
|
|
}
|