[Bug Fix] Corrected PostSummonPhase Trigger Timing for Accurate Stat Changes (#2057)
* fix postSummonPhase when opponent does not summon and fix the statsChange from push to unshift * added switch pokemon helper method * added on switch tests for intimidate * fix test by overriding passive in tests * remove a test not needed * cleanup imports
This commit is contained in:
parent
670ea01cb4
commit
0faccad49e
|
@ -1625,7 +1625,9 @@ export class PostSummonStatChangeAbAttr extends PostSummonAbAttr {
|
||||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||||
queueShowAbility(pokemon, passive); // TODO: Better solution than manually showing the ability here
|
queueShowAbility(pokemon, passive); // TODO: Better solution than manually showing the ability here
|
||||||
if (this.selfTarget) {
|
if (this.selfTarget) {
|
||||||
pokemon.scene.pushPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.levels));
|
// we unshift the StatChangePhase to put it right after the showAbility and not at the end of the
|
||||||
|
// phase list (which could be after CommandPhase for example)
|
||||||
|
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.levels));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (const opponent of pokemon.getOpponents()) {
|
for (const opponent of pokemon.getOpponents()) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ export const VARIANT_OVERRIDE: Variant = 0;
|
||||||
export const OPP_SPECIES_OVERRIDE: Species | integer = 0;
|
export const OPP_SPECIES_OVERRIDE: Species | integer = 0;
|
||||||
export const OPP_LEVEL_OVERRIDE: number = 0;
|
export const OPP_LEVEL_OVERRIDE: number = 0;
|
||||||
export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
export const OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
export const OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
export const OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
||||||
export const OPP_GENDER_OVERRIDE: Gender = null;
|
export const OPP_GENDER_OVERRIDE: Gender = null;
|
||||||
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
|
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
|
||||||
|
|
|
@ -1024,7 +1024,6 @@ export class EncounterPhase extends BattlePhase {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.scene.currentBattle.battleType !== BattleType.TRAINER) {
|
if (this.scene.currentBattle.battleType !== BattleType.TRAINER) {
|
||||||
enemyField.map(p => this.scene.pushPhase(new PostSummonPhase(this.scene, p.getBattlerIndex())));
|
|
||||||
const ivScannerModifier = this.scene.findModifier(m => m instanceof IvScannerModifier);
|
const ivScannerModifier = this.scene.findModifier(m => m instanceof IvScannerModifier);
|
||||||
if (ivScannerModifier) {
|
if (ivScannerModifier) {
|
||||||
enemyField.map(p => this.scene.pushPhase(new ScanIvsPhase(this.scene, p.getBattlerIndex(), Math.min(ivScannerModifier.getStackCount() * 2, 6))));
|
enemyField.map(p => this.scene.pushPhase(new ScanIvsPhase(this.scene, p.getBattlerIndex(), Math.min(ivScannerModifier.getStackCount() * 2, 6))));
|
||||||
|
@ -1480,7 +1479,10 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
|
|
||||||
if (!this.loaded || this.scene.currentBattle.battleType === BattleType.TRAINER || (this.scene.currentBattle.waveIndex % 10) === 1) {
|
if (!this.loaded || this.scene.currentBattle.battleType === BattleType.TRAINER || (this.scene.currentBattle.waveIndex % 10) === 1) {
|
||||||
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);
|
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);
|
||||||
|
}
|
||||||
|
if (pokemon.isPlayer()) {
|
||||||
|
// postSummon for player only here, since we want the postSummon from opponent to be call in the turnInitPhase
|
||||||
|
// covering both wild & trainer battles
|
||||||
this.queuePostSummon();
|
this.queuePostSummon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1795,6 +1797,8 @@ export class TurnInitPhase extends FieldPhase {
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
const enemyField = this.scene.getEnemyField().filter(p => p.isActive()) as Pokemon[];
|
||||||
|
enemyField.map(p => this.scene.unshiftPhase(new PostSummonPhase(this.scene, p.getBattlerIndex())));
|
||||||
|
|
||||||
this.scene.getPlayerField().forEach(p => {
|
this.scene.getPlayerField().forEach(p => {
|
||||||
// If this pokemon is in play and evolved into something illegal under the current challenge, force a switch
|
// If this pokemon is in play and evolved into something illegal under the current challenge, force a switch
|
||||||
|
|
|
@ -5,16 +5,11 @@ import * as overrides from "#app/overrides";
|
||||||
import {Abilities} from "#app/data/enums/abilities";
|
import {Abilities} from "#app/data/enums/abilities";
|
||||||
import {Species} from "#app/data/enums/species";
|
import {Species} from "#app/data/enums/species";
|
||||||
import {
|
import {
|
||||||
CheckSwitchPhase, CommandPhase, MessagePhase,
|
CommandPhase, TurnInitPhase
|
||||||
PostSummonPhase,
|
|
||||||
ShinySparklePhase,
|
|
||||||
ShowAbilityPhase,
|
|
||||||
StatChangePhase,
|
|
||||||
SummonPhase,
|
|
||||||
ToggleDoublePositionPhase, TurnInitPhase
|
|
||||||
} from "#app/phases";
|
} from "#app/phases";
|
||||||
import {Mode} from "#app/ui/ui";
|
import {Mode} from "#app/ui/ui";
|
||||||
import {BattleStat} from "#app/data/battle-stat";
|
import {BattleStat} from "#app/data/battle-stat";
|
||||||
|
import {Moves} from "#app/data/enums/moves";
|
||||||
|
|
||||||
|
|
||||||
describe("Abilities - Intimidate", () => {
|
describe("Abilities - Intimidate", () => {
|
||||||
|
@ -34,50 +29,161 @@ describe("Abilities - Intimidate", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA);
|
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA);
|
||||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE);
|
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE);
|
||||||
|
vi.spyOn(overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION);
|
||||||
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE);
|
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE);
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3);
|
||||||
|
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("INTIMIDATE", async() => {
|
it("single - wild with switch", async() => {
|
||||||
await game.runToSummon([
|
await game.runToSummon([
|
||||||
Species.MIGHTYENA,
|
Species.MIGHTYENA,
|
||||||
Species.MIGHTYENA,
|
Species.POOCHYENA,
|
||||||
]);
|
]);
|
||||||
await game.phaseInterceptor.run(PostSummonPhase);
|
|
||||||
|
|
||||||
|
|
||||||
expect(game.scene.getParty()[0].summonData).not.toBeUndefined();
|
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
||||||
expect(battleStatsPokemon[BattleStat.ATK]).toBe(0);
|
|
||||||
await game.phaseInterceptor.run(ShowAbilityPhase);
|
|
||||||
await game.phaseInterceptor.run(StatChangePhase);
|
|
||||||
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
||||||
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
|
||||||
|
|
||||||
|
|
||||||
await game.phaseInterceptor.run(SummonPhase);
|
|
||||||
await game.phaseInterceptor.run(ShinySparklePhase, () => game.isCurrentPhase(ToggleDoublePositionPhase));
|
|
||||||
await game.phaseInterceptor.run(ToggleDoublePositionPhase);
|
|
||||||
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
game.setMode(Mode.MESSAGE);
|
game.setMode(Mode.MESSAGE);
|
||||||
game.endPhase();
|
game.endPhase();
|
||||||
});
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
await game.phaseInterceptor.run(CheckSwitchPhase);
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
await game.phaseInterceptor.run(PostSummonPhase);
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.MIGHTYENA);
|
||||||
|
|
||||||
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(0);
|
|
||||||
await game.phaseInterceptor.run(ShowAbilityPhase);
|
|
||||||
game.scene.moveAnimations = null; // Mandatory to avoid crash
|
|
||||||
await game.phaseInterceptor.run(StatChangePhase);
|
|
||||||
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
await game.switchPokemon(1);
|
||||||
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.POOCHYENA);
|
||||||
|
|
||||||
|
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
|
||||||
await game.phaseInterceptor.run(MessagePhase);
|
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
await game.phaseInterceptor.run(TurnInitPhase);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
await game.phaseInterceptor.run(CommandPhase);
|
}, 20000);
|
||||||
|
|
||||||
|
it("single - boss should only trigger once then switch", async() => {
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10);
|
||||||
|
await game.runToSummon([
|
||||||
|
Species.MIGHTYENA,
|
||||||
|
Species.POOCHYENA,
|
||||||
|
]);
|
||||||
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
|
game.setMode(Mode.MESSAGE);
|
||||||
|
game.endPhase();
|
||||||
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
await game.switchPokemon(1);
|
||||||
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.POOCHYENA);
|
||||||
|
|
||||||
|
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
|
||||||
|
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
it("single - trainer should only trigger once with switch", async() => {
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5);
|
||||||
|
await game.runToSummon([
|
||||||
|
Species.MIGHTYENA,
|
||||||
|
Species.POOCHYENA,
|
||||||
|
]);
|
||||||
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
|
game.setMode(Mode.MESSAGE);
|
||||||
|
game.endPhase();
|
||||||
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||||
|
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
await game.switchPokemon(1);
|
||||||
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.POOCHYENA);
|
||||||
|
|
||||||
|
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-1);
|
||||||
|
|
||||||
|
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
|
}, 200000);
|
||||||
|
|
||||||
|
it("double - trainer should only trigger once per pokemon", async() => {
|
||||||
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(false);
|
||||||
|
vi.spyOn(overrides, "DOUBLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5);
|
||||||
|
await game.runToSummon([
|
||||||
|
Species.MIGHTYENA,
|
||||||
|
Species.POOCHYENA,
|
||||||
|
]);
|
||||||
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
|
game.setMode(Mode.MESSAGE);
|
||||||
|
game.endPhase();
|
||||||
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
|
const battleStatsOpponent2 = game.scene.currentBattle.enemyParty[1].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent2[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon2 = game.scene.getParty()[1].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon2[BattleStat.ATK]).toBe(-2);
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
it("double - wild: should only trigger once per pokemon", async() => {
|
||||||
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(false);
|
||||||
|
vi.spyOn(overrides, "DOUBLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3);
|
||||||
|
await game.runToSummon([
|
||||||
|
Species.MIGHTYENA,
|
||||||
|
Species.POOCHYENA,
|
||||||
|
]);
|
||||||
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
|
game.setMode(Mode.MESSAGE);
|
||||||
|
game.endPhase();
|
||||||
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
|
const battleStatsOpponent2 = game.scene.currentBattle.enemyParty[1].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent2[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon2 = game.scene.getParty()[1].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon2[BattleStat.ATK]).toBe(-2);
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
it("double - boss: should only trigger once per pokemon", async() => {
|
||||||
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(false);
|
||||||
|
vi.spyOn(overrides, "DOUBLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||||
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10);
|
||||||
|
await game.runToSummon([
|
||||||
|
Species.MIGHTYENA,
|
||||||
|
Species.POOCHYENA,
|
||||||
|
]);
|
||||||
|
game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||||
|
game.setMode(Mode.MESSAGE);
|
||||||
|
game.endPhase();
|
||||||
|
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(TurnInitPhase));
|
||||||
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-2);
|
||||||
|
const battleStatsOpponent2 = game.scene.currentBattle.enemyParty[1].summonData.battleStats;
|
||||||
|
expect(battleStatsOpponent2[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(-2);
|
||||||
|
|
||||||
|
const battleStatsPokemon2 = game.scene.getParty()[1].summonData.battleStats;
|
||||||
|
expect(battleStatsPokemon2[BattleStat.ATK]).toBe(-2);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,11 +5,7 @@ import * as overrides from "#app/overrides";
|
||||||
import {Abilities} from "#app/data/enums/abilities";
|
import {Abilities} from "#app/data/enums/abilities";
|
||||||
import {Species} from "#app/data/enums/species";
|
import {Species} from "#app/data/enums/species";
|
||||||
import {
|
import {
|
||||||
MessagePhase,
|
CommandPhase,
|
||||||
PostSummonPhase,
|
|
||||||
ShowAbilityPhase,
|
|
||||||
StatChangePhase,
|
|
||||||
ToggleDoublePositionPhase
|
|
||||||
} from "#app/phases";
|
} from "#app/phases";
|
||||||
import {BattleStat} from "#app/data/battle-stat";
|
import {BattleStat} from "#app/data/battle-stat";
|
||||||
|
|
||||||
|
@ -40,26 +36,10 @@ describe("Abilities - Intrepid Sword", () => {
|
||||||
await game.runToSummon([
|
await game.runToSummon([
|
||||||
Species.ZACIAN,
|
Species.ZACIAN,
|
||||||
]);
|
]);
|
||||||
await game.phaseInterceptor.runFrom(PostSummonPhase).to(PostSummonPhase);
|
await game.phaseInterceptor.to(CommandPhase, false);
|
||||||
expect(game.scene.getParty()[0].summonData).not.toBeUndefined();
|
const battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
||||||
expect(battleStatsPokemon[BattleStat.ATK]).toBe(0);
|
|
||||||
await game.phaseInterceptor.run(ShowAbilityPhase);
|
|
||||||
await game.phaseInterceptor.run(StatChangePhase);
|
|
||||||
battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
|
||||||
expect(battleStatsPokemon[BattleStat.ATK]).toBe(1);
|
expect(battleStatsPokemon[BattleStat.ATK]).toBe(1);
|
||||||
}, 20000);
|
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||||
|
|
||||||
it("INTREPID SWORD on opponent", async() => {
|
|
||||||
await game.runToSummon([
|
|
||||||
Species.ZACIAN,
|
|
||||||
]);
|
|
||||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(0);
|
|
||||||
await game.phaseInterceptor.runFrom(PostSummonPhase).to(ToggleDoublePositionPhase);
|
|
||||||
await game.phaseInterceptor.run(StatChangePhase);
|
|
||||||
await game.phaseInterceptor.run(MessagePhase);
|
|
||||||
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
||||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(1);
|
expect(battleStatsOpponent[BattleStat.ATK]).toBe(1);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export default class TextInterceptor {
|
export default class TextInterceptor {
|
||||||
private scene;
|
private scene;
|
||||||
private logs = [];
|
public logs = [];
|
||||||
constructor(scene) {
|
constructor(scene) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
scene.messageWrapper = this;
|
scene.messageWrapper = this;
|
||||||
|
|
|
@ -28,6 +28,7 @@ import {MockClock} from "#app/test/utils/mocks/mockClock";
|
||||||
import {Command} from "#app/ui/command-ui-handler";
|
import {Command} from "#app/ui/command-ui-handler";
|
||||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||||
import {Button} from "#app/enums/buttons";
|
import {Button} from "#app/enums/buttons";
|
||||||
|
import PartyUiHandler, {PartyUiMode} from "#app/ui/party-ui-handler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage the game state and transitions between phases.
|
* Class to manage the game state and transitions between phases.
|
||||||
|
@ -279,4 +280,15 @@ export default class GameManager {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async switchPokemon(pokemonIndex: number) {
|
||||||
|
this.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
|
||||||
|
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.SWITCH, (this.scene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(), null, PartyUiHandler.FilterNonFainted);
|
||||||
|
});
|
||||||
|
this.onNextPrompt("CommandPhase", Mode.PARTY, () => {
|
||||||
|
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, pokemonIndex, false);
|
||||||
|
});
|
||||||
|
await this.phaseInterceptor.run(CommandPhase);
|
||||||
|
await this.phaseInterceptor.to(CommandPhase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue