update test to remove usage of deprecated startBattle

This commit is contained in:
MokaStitcher 2024-08-28 15:40:26 +02:00
parent a4a7c1764a
commit a1e6677386

View File

@ -28,17 +28,16 @@ describe("Boss Pokemon / Shields", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("single"); game.override
game.override.disableTrainerWaves(); .battleType("single")
game.override.disableCrits(); .disableTrainerWaves()
.disableCrits()
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.enemyMoveset(SPLASH_ONLY); .enemyMoveset(SPLASH_ONLY)
game.override.enemyHeldItems([]); .enemyHeldItems([])
.startingLevel(1000)
game.override.startingLevel(1000); .moveset([Moves.FALSE_SWIPE, Moves.SUPER_FANG, Moves.SPLASH])
game.override.moveset([Moves.FALSE_SWIPE, Moves.SUPER_FANG, Moves.SPLASH]); .ability(Abilities.NO_GUARD);
game.override.ability(Abilities.NO_GUARD);
}); });
it("Pokemon should get shields based on their Species and level and the current wave", async () => { it("Pokemon should get shields based on their Species and level and the current wave", async () => {
@ -67,9 +66,11 @@ describe("Boss Pokemon / Shields", () => {
}, TIMEOUT); }, TIMEOUT);
it("should reduce the number of shields if we are in a double battle", async () => { it("should reduce the number of shields if we are in a double battle", async () => {
game.override.startingWave(150); // Floor 150 > 2 shields / 3 health segments game.override
game.override.battleType("double"); .battleType("double")
await game.startBattle([ Species.MEWTWO ]); .startingWave(150); // Floor 150 > 2 shields / 3 health segments
await game.classicMode.startBattle([ Species.MEWTWO ]);
const boss1: EnemyPokemon = game.scene.getEnemyParty()[0]!; const boss1: EnemyPokemon = game.scene.getEnemyParty()[0]!;
const boss2: EnemyPokemon = game.scene.getEnemyParty()[1]!; const boss2: EnemyPokemon = game.scene.getEnemyParty()[1]!;
@ -82,7 +83,7 @@ describe("Boss Pokemon / Shields", () => {
it("shields should stop overflow damage and give stat boosts when broken", async () => { it("shields should stop overflow damage and give stat boosts when broken", async () => {
game.override.startingWave(150); // Floor 150 > 2 shields / 3 health segments game.override.startingWave(150); // Floor 150 > 2 shields / 3 health segments
await game.startBattle([ Species.MEWTWO ]); await game.classicMode.startBattle([ Species.MEWTWO ]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
const segmentHp = enemyPokemon.getMaxHp() / enemyPokemon.bossSegments; const segmentHp = enemyPokemon.getMaxHp() / enemyPokemon.bossSegments;
@ -110,10 +111,11 @@ describe("Boss Pokemon / Shields", () => {
}, TIMEOUT); }, TIMEOUT);
it("breaking multiple shields at once requires extra damage", async () => { it("breaking multiple shields at once requires extra damage", async () => {
game.override.battleType("double"); game.override
game.override.enemyHealthSegments(5); .battleType("double")
.enemyHealthSegments(5);
await game.startBattle([ Species.MEWTWO ]); await game.classicMode.startBattle([ Species.MEWTWO ]);
// In this test we want to break through 3 shields at once // In this test we want to break through 3 shields at once
const brokenShields = 3; const brokenShields = 3;
@ -147,10 +149,11 @@ describe("Boss Pokemon / Shields", () => {
it("the number of stats boosts is consistent when several shields are broken at once", async () => { it("the number of stats boosts is consistent when several shields are broken at once", async () => {
const shieldsToBreak = 4; const shieldsToBreak = 4;
game.override.battleType("double"); game.override
game.override.enemyHealthSegments(shieldsToBreak + 1); .battleType("double")
.enemyHealthSegments(shieldsToBreak + 1);
await game.startBattle([ Species.MEWTWO ]); await game.classicMode.startBattle([ Species.MEWTWO ]);
const boss1: EnemyPokemon = game.scene.getEnemyParty()[0]!; const boss1: EnemyPokemon = game.scene.getEnemyParty()[0]!;
const boss1SegmentHp = boss1.getMaxHp() / boss1.bossSegments; const boss1SegmentHp = boss1.getMaxHp() / boss1.bossSegments;
@ -196,13 +199,6 @@ describe("Boss Pokemon / Shields", () => {
}, TIMEOUT); }, TIMEOUT);
function statsSum(total: number, value: number, index: number) {
if (index <= BattleStat.SPD) {
return total + value;
}
return total;
}
/** /**
* Gets the sum of the ATK, DEF, SP ATK, SP DEF and SPD boosts for the given Pokemon * Gets the sum of the ATK, DEF, SP ATK, SP DEF and SPD boosts for the given Pokemon
* @param enemyPokemon the pokemon to get stats from * @param enemyPokemon the pokemon to get stats from
@ -212,5 +208,13 @@ describe("Boss Pokemon / Shields", () => {
const enemyBattleStats = enemyPokemon.summonData.battleStats; const enemyBattleStats = enemyPokemon.summonData.battleStats;
return enemyBattleStats?.reduce(statsSum, 0); return enemyBattleStats?.reduce(statsSum, 0);
} }
function statsSum(total: number, value: number, index: number) {
if (index <= BattleStat.SPD) {
return total + value;
}
return total;
}
}); });