Condensed all overrides into 1 line where possible

I hope I got them all...
This commit is contained in:
Bertie690 2025-04-30 15:28:57 -04:00
parent dd2f475ded
commit ebf1d1b011
120 changed files with 868 additions and 1007 deletions

View File

@ -26,11 +26,12 @@ describe("Abilities - Battery", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.enemySpecies(Species.SHUCKLE); .battleStyle("double")
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.SHUCKLE)
game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM])
.enemyMoveset(Moves.SPLASH);
}); });
it("raises the power of allies' special moves by 30%", async () => { it("raises the power of allies' special moves by 30%", async () => {

View File

@ -24,10 +24,11 @@ describe("Abilities - COSTAR", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.ability(Abilities.COSTAR); .battleStyle("double")
game.override.moveset([Moves.SPLASH, Moves.NASTY_PLOT]); .ability(Abilities.COSTAR)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.SPLASH, Moves.NASTY_PLOT])
.enemyMoveset(Moves.SPLASH);
}); });
test("ability copies positive stat stages", async () => { test("ability copies positive stat stages", async () => {

View File

@ -66,8 +66,7 @@ describe("Abilities - Disguise", () => {
}); });
it("takes no damage from the first hit of a multihit move and transforms to Busted form, then takes damage from the second hit", async () => { it("takes no damage from the first hit of a multihit move and transforms to Busted form, then takes damage from the second hit", async () => {
game.override.moveset([Moves.SURGING_STRIKES]); game.override.moveset([Moves.SURGING_STRIKES]).enemyLevel(5);
game.override.enemyLevel(5);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const mimikyu = game.scene.getEnemyPokemon()!; const mimikyu = game.scene.getEnemyPokemon()!;
@ -106,8 +105,7 @@ describe("Abilities - Disguise", () => {
}); });
it("persists form change when switched out", async () => { it("persists form change when switched out", async () => {
game.override.enemyMoveset([Moves.SHADOW_SNEAK]); game.override.enemyMoveset([Moves.SHADOW_SNEAK]).starterSpecies(0);
game.override.starterSpecies(0);
await game.classicMode.startBattle([Species.MIMIKYU, Species.FURRET]); await game.classicMode.startBattle([Species.MIMIKYU, Species.FURRET]);
@ -131,8 +129,7 @@ describe("Abilities - Disguise", () => {
}); });
it("persists form change when wave changes with no arena reset", async () => { it("persists form change when wave changes with no arena reset", async () => {
game.override.starterSpecies(0); game.override.starterSpecies(0).starterForms({
game.override.starterForms({
[Species.MIMIKYU]: bustedForm, [Species.MIMIKYU]: bustedForm,
}); });
await game.classicMode.startBattle([Species.FURRET, Species.MIMIKYU]); await game.classicMode.startBattle([Species.FURRET, Species.MIMIKYU]);
@ -148,11 +145,12 @@ describe("Abilities - Disguise", () => {
}); });
it("reverts to Disguised form on arena reset", async () => { it("reverts to Disguised form on arena reset", async () => {
game.override.startingWave(4); game.override
game.override.starterSpecies(Species.MIMIKYU); .startingWave(4)
game.override.starterForms({ .starterSpecies(Species.MIMIKYU)
[Species.MIMIKYU]: bustedForm, .starterForms({
}); [Species.MIMIKYU]: bustedForm,
});
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -168,11 +166,12 @@ describe("Abilities - Disguise", () => {
}); });
it("reverts to Disguised form on biome change when fainted", async () => { it("reverts to Disguised form on biome change when fainted", async () => {
game.override.startingWave(10); game.override
game.override.starterSpecies(0); .startingWave(10)
game.override.starterForms({ .starterSpecies(0)
[Species.MIMIKYU]: bustedForm, .starterForms({
}); [Species.MIMIKYU]: bustedForm,
});
await game.classicMode.startBattle([Species.MIMIKYU, Species.FURRET]); await game.classicMode.startBattle([Species.MIMIKYU, Species.FURRET]);
@ -206,8 +205,7 @@ describe("Abilities - Disguise", () => {
}); });
it("activates when Aerilate circumvents immunity to the move's base type", async () => { it("activates when Aerilate circumvents immunity to the move's base type", async () => {
game.override.ability(Abilities.AERILATE); game.override.ability(Abilities.AERILATE).moveset([Moves.TACKLE]);
game.override.moveset([Moves.TACKLE]);
await game.classicMode.startBattle(); await game.classicMode.startBattle();

View File

@ -73,8 +73,7 @@ describe("Abilities - Flash Fire", () => {
}, 20000); }, 20000);
it("activated after being frozen", async () => { it("activated after being frozen", async () => {
game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH); game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH).statusEffect(StatusEffect.FREEZE);
game.override.statusEffect(StatusEffect.FREEZE);
await game.classicMode.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
@ -102,8 +101,11 @@ describe("Abilities - Flash Fire", () => {
}, 20000); }, 20000);
it("boosts Fire-type move when the ability is activated", async () => { it("boosts Fire-type move when the ability is activated", async () => {
game.override.enemyMoveset([Moves.FIRE_PLEDGE]).moveset([Moves.EMBER, Moves.SPLASH]); game.override
game.override.enemyAbility(Abilities.FLASH_FIRE).ability(Abilities.NONE); .enemyMoveset([Moves.FIRE_PLEDGE])
.moveset([Moves.EMBER, Moves.SPLASH])
.enemyAbility(Abilities.FLASH_FIRE)
.ability(Abilities.NONE);
await game.classicMode.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
const initialHP = 1000; const initialHP = 1000;
@ -127,9 +129,12 @@ describe("Abilities - Flash Fire", () => {
}, 20000); }, 20000);
it("still activates regardless of accuracy check", async () => { it("still activates regardless of accuracy check", async () => {
game.override.moveset(Moves.FIRE_PLEDGE).enemyMoveset(Moves.EMBER); game.override
game.override.enemyAbility(Abilities.NONE).ability(Abilities.FLASH_FIRE); .moveset(Moves.FIRE_PLEDGE)
game.override.enemySpecies(Species.BLISSEY); .enemyMoveset(Moves.EMBER)
.enemyAbility(Abilities.NONE)
.ability(Abilities.FLASH_FIRE)
.enemySpecies(Species.BLISSEY);
await game.classicMode.startBattle([Species.RATTATA]); await game.classicMode.startBattle([Species.RATTATA]);
const blissey = game.scene.getEnemyPokemon()!; const blissey = game.scene.getEnemyPokemon()!;

View File

@ -47,9 +47,10 @@ describe("Abilities - Flower Gift", () => {
allyAbility = Abilities.BALL_FETCH, allyAbility = Abilities.BALL_FETCH,
enemyAbility = Abilities.BALL_FETCH, enemyAbility = Abilities.BALL_FETCH,
): Promise<[number, number]> => { ): Promise<[number, number]> => {
game.override.battleStyle("double"); game.override
game.override.moveset([Moves.SPLASH, Moves.SUNNY_DAY, move, Moves.HEAL_PULSE]); .battleStyle("double")
game.override.enemyMoveset([Moves.SPLASH, Moves.HEAL_PULSE]); .moveset([Moves.SPLASH, Moves.SUNNY_DAY, move, Moves.HEAL_PULSE])
.enemyMoveset([Moves.SPLASH, Moves.HEAL_PULSE]);
const target_index = allyAttacker ? BattlerIndex.ENEMY : BattlerIndex.PLAYER_2; const target_index = allyAttacker ? BattlerIndex.ENEMY : BattlerIndex.PLAYER_2;
const attacker_index = allyAttacker ? BattlerIndex.PLAYER_2 : BattlerIndex.ENEMY; const attacker_index = allyAttacker ? BattlerIndex.PLAYER_2 : BattlerIndex.ENEMY;
const ally_move = allyAttacker ? move : Moves.SPLASH; const ally_move = allyAttacker ? move : Moves.SPLASH;

View File

@ -63,9 +63,10 @@ describe("Abilities - Good As Gold", () => {
}); });
it("should not block any status moves that target the field, one side, or all pokemon", async () => { it("should not block any status moves that target the field, one side, or all pokemon", async () => {
game.override.battleStyle("double"); game.override
game.override.enemyMoveset([Moves.STEALTH_ROCK, Moves.HAZE]); .battleStyle("double")
game.override.moveset([Moves.SWORDS_DANCE, Moves.SAFEGUARD]); .enemyMoveset([Moves.STEALTH_ROCK, Moves.HAZE])
.moveset([Moves.SWORDS_DANCE, Moves.SAFEGUARD]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
const [good_as_gold, ball_fetch] = game.scene.getPlayerField(); const [good_as_gold, ball_fetch] = game.scene.getPlayerField();
@ -85,8 +86,7 @@ describe("Abilities - Good As Gold", () => {
}); });
it("should not block field targeted effects in singles", async () => { it("should not block field targeted effects in singles", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single").enemyMoveset([Moves.SPIKES]);
game.override.enemyMoveset([Moves.SPIKES]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.SPLASH, 0); game.move.select(Moves.SPLASH, 0);
@ -96,8 +96,7 @@ describe("Abilities - Good As Gold", () => {
}); });
it("should block the ally's helping hand", async () => { it("should block the ally's helping hand", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.HELPING_HAND, Moves.TACKLE]);
game.override.moveset([Moves.HELPING_HAND, Moves.TACKLE]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
game.move.select(Moves.HELPING_HAND, 0); game.move.select(Moves.HELPING_HAND, 0);
@ -129,8 +128,7 @@ describe("Abilities - Good As Gold", () => {
}); });
it("should not block field targeted effects like rain dance", async () => { it("should not block field targeted effects like rain dance", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single").enemyMoveset([Moves.RAIN_DANCE]);
game.override.enemyMoveset([Moves.RAIN_DANCE]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.use(Moves.SPLASH, 0); game.move.use(Moves.SPLASH, 0);

View File

@ -75,8 +75,7 @@ describe("Abilities - Hustle", () => {
}); });
it("does not affect OHKO moves", async () => { it("does not affect OHKO moves", async () => {
game.override.startingLevel(100); game.override.startingLevel(100).enemyLevel(30);
game.override.enemyLevel(30);
await game.classicMode.startBattle([Species.PIKACHU]); await game.classicMode.startBattle([Species.PIKACHU]);
const pikachu = game.scene.getPlayerPokemon()!; const pikachu = game.scene.getPlayerPokemon()!;

View File

@ -30,10 +30,11 @@ describe("Abilities - Ice Face", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.EISCUE); .battleStyle("single")
game.override.enemyAbility(Abilities.ICE_FACE); .enemySpecies(Species.EISCUE)
game.override.moveset([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); .enemyAbility(Abilities.ICE_FACE)
.moveset([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]);
}); });
it("takes no damage from physical move and transforms to Noice", async () => { it("takes no damage from physical move and transforms to Noice", async () => {
@ -51,8 +52,7 @@ describe("Abilities - Ice Face", () => {
}); });
it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => { it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => {
game.override.moveset([Moves.SURGING_STRIKES]); game.override.moveset([Moves.SURGING_STRIKES]).enemyLevel(1);
game.override.enemyLevel(1);
await game.classicMode.startBattle([Species.HITMONLEE]); await game.classicMode.startBattle([Species.HITMONLEE]);
game.move.select(Moves.SURGING_STRIKES); game.move.select(Moves.SURGING_STRIKES);
@ -196,12 +196,13 @@ describe("Abilities - Ice Face", () => {
}); });
it("reverts to Ice Face on arena reset", async () => { it("reverts to Ice Face on arena reset", async () => {
game.override.startingWave(4); game.override
game.override.startingLevel(4); .startingWave(4)
game.override.enemySpecies(Species.MAGIKARP); .startingLevel(4)
game.override.starterForms({ .enemySpecies(Species.MAGIKARP)
[Species.EISCUE]: noiceForm, .starterForms({
}); [Species.EISCUE]: noiceForm,
});
await game.classicMode.startBattle([Species.EISCUE]); await game.classicMode.startBattle([Species.EISCUE]);

View File

@ -117,25 +117,20 @@ describe("Abilities - Illusion", () => {
}); });
it("does not break from indirect damage", async () => { it("does not break from indirect damage", async () => {
game.override.enemySpecies(Species.GIGALITH); game.override.enemySpecies(Species.GIGALITH).enemyAbility(Abilities.SAND_STREAM);
game.override.enemyAbility(Abilities.SAND_STREAM);
game.override.enemyMoveset(Moves.WILL_O_WISP);
game.override.moveset([Moves.FLARE_BLITZ]);
await game.classicMode.startBattle([Species.ZOROARK, Species.AZUMARILL]); await game.classicMode.startBattle([Species.ZOROARK, Species.AZUMARILL]);
game.move.select(Moves.FLARE_BLITZ); game.move.use(Moves.FLARE_BLITZ);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
const zoroark = game.scene.getPlayerPokemon()!; const zoroark = game.scene.getPlayerPokemon()!;
expect(!!zoroark.summonData.illusion).equals(true); expect(!!zoroark.summonData.illusion).equals(true);
}); });
it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => { it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => {
game.override.enemyMoveset(Moves.SPLASH); game.override.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]); await game.classicMode.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]);
const axew = game.scene.getPlayerParty().at(2)!; const axew = game.scene.getPlayerParty().at(2)!;
axew.shiny = true; axew.shiny = true;
axew.nickname = btoa(unescape(encodeURIComponent("axew nickname"))); axew.nickname = btoa(unescape(encodeURIComponent("axew nickname")));

View File

@ -162,8 +162,7 @@ describe("Abilities - Imposter", () => {
}); });
it("should stay transformed with the correct form after reload", async () => { it("should stay transformed with the correct form after reload", async () => {
game.override.moveset([Moves.ABSORB]); game.override.moveset([Moves.ABSORB]).enemySpecies(Species.UNOWN);
game.override.enemySpecies(Species.UNOWN);
await game.classicMode.startBattle([Species.DITTO]); await game.classicMode.startBattle([Species.DITTO]);
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;

View File

@ -88,8 +88,7 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("should not activate again if there is no switch or new entry", async () => { it("should not activate again if there is no switch or new entry", async () => {
game.override.startingWave(2); game.override.startingWave(2).moveset([Moves.SPLASH]);
game.override.moveset([Moves.SPLASH]);
await game.classicMode.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.classicMode.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -22,10 +22,11 @@ describe("Abilities - Intrepid Sword", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.ZACIAN); .battleStyle("single")
game.override.enemyAbility(Abilities.INTREPID_SWORD); .enemySpecies(Species.ZACIAN)
game.override.ability(Abilities.INTREPID_SWORD); .enemyAbility(Abilities.INTREPID_SWORD)
.ability(Abilities.INTREPID_SWORD);
}); });
it("should raise ATK stat stage by 1 on entry", async () => { it("should raise ATK stat stage by 1 on entry", async () => {

View File

@ -108,8 +108,7 @@ describe("Abilities - Libero", () => {
}); });
test("ability applies correctly even if the type has changed by another ability", async () => { test("ability applies correctly even if the type has changed by another ability", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).passiveAbility(Abilities.REFRIGERATE);
game.override.passiveAbility(Abilities.REFRIGERATE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -156,8 +155,7 @@ describe("Abilities - Libero", () => {
}); });
test("ability applies correctly even if the pokemon's move misses", async () => { test("ability applies correctly even if the pokemon's move misses", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemyMoveset(Moves.SPLASH);
game.override.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -188,8 +186,7 @@ describe("Abilities - Libero", () => {
}); });
test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => { test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemySpecies(Species.GASTLY);
game.override.enemySpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -262,8 +259,7 @@ describe("Abilities - Libero", () => {
}); });
test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => {
game.override.moveset([Moves.TRICK_OR_TREAT]); game.override.moveset([Moves.TRICK_OR_TREAT]).enemySpecies(Species.GASTLY);
game.override.enemySpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);

View File

@ -41,18 +41,16 @@ describe("Abilities - Magic Bounce", () => {
it("should reflect basic status moves", async () => { it("should reflect basic status moves", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.GROWL); game.move.use(Moves.GROWL);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1); expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1);
}); });
it("should not bounce moves while the target is in the semi-invulnerable state", async () => { it("should not bounce moves while the target is in the semi-invulnerable state", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.override.moveset([Moves.GROWL]);
game.override.enemyMoveset([Moves.FLY]);
game.move.select(Moves.GROWL); game.move.use(Moves.GROWL);
await game.move.selectEnemyMove(Moves.FLY); await game.move.forceEnemyMove(Moves.FLY);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
@ -61,11 +59,10 @@ describe("Abilities - Magic Bounce", () => {
it("should individually bounce back multi-target moves", async () => { it("should individually bounce back multi-target moves", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
game.override.moveset([Moves.GROWL, Moves.SPLASH]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.move.select(Moves.GROWL, 0); game.move.use(Moves.GROWL, 0);
game.move.select(Moves.SPLASH, 1); game.move.use(Moves.SPLASH, 1);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
const user = game.scene.getPlayerField()[0]; const user = game.scene.getPlayerField()[0];
@ -75,9 +72,8 @@ describe("Abilities - Magic Bounce", () => {
it("should still bounce back a move that would otherwise fail", async () => { it("should still bounce back a move that would otherwise fail", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.scene.getEnemyPokemon()?.setStatStage(Stat.ATK, -6); game.scene.getEnemyPokemon()?.setStatStage(Stat.ATK, -6);
game.override.moveset([Moves.GROWL]);
game.move.select(Moves.GROWL); game.move.use(Moves.GROWL);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1); expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1);
@ -107,29 +103,26 @@ describe("Abilities - Magic Bounce", () => {
game.override.ability(Abilities.MOLD_BREAKER); game.override.ability(Abilities.MOLD_BREAKER);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.GROWL); game.move.use(Moves.GROWL);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.ATK)).toBe(-1); expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.ATK)).toBe(-1);
}); });
it("should bounce back a spread status move against both pokemon", async () => { it("should bounce back a spread status move against both pokemon", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").enemyMoveset([Moves.SPLASH]);
game.override.moveset([Moves.GROWL, Moves.SPLASH]);
game.override.enemyMoveset([Moves.SPLASH]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.move.select(Moves.GROWL, 0); game.move.use(Moves.GROWL, 0);
game.move.select(Moves.SPLASH, 1); game.move.use(Moves.SPLASH, 1);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerField().every(p => p.getStatStage(Stat.ATK) === -2)).toBeTruthy(); expect(game.scene.getPlayerField().every(p => p.getStatStage(Stat.ATK) === -2)).toBeTruthy();
}); });
it("should only bounce spikes back once in doubles when both targets have magic bounce", async () => { it("should only bounce spikes back once in doubles when both targets have magic bounce", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.SPIKES]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.override.moveset([Moves.SPIKES]);
game.move.select(Moves.SPIKES); game.move.select(Moves.SPIKES);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
@ -139,8 +132,7 @@ describe("Abilities - Magic Bounce", () => {
}); });
it("should bounce spikes even when the target is protected", async () => { it("should bounce spikes even when the target is protected", async () => {
game.override.moveset([Moves.SPIKES]); game.override.moveset([Moves.SPIKES]).enemyMoveset([Moves.PROTECT]);
game.override.enemyMoveset([Moves.PROTECT]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.SPIKES); game.move.select(Moves.SPIKES);
@ -149,8 +141,7 @@ describe("Abilities - Magic Bounce", () => {
}); });
it("should not bounce spikes when the target is in the semi-invulnerable state", async () => { it("should not bounce spikes when the target is in the semi-invulnerable state", async () => {
game.override.moveset([Moves.SPIKES]); game.override.moveset([Moves.SPIKES]).enemyMoveset([Moves.FLY]);
game.override.enemyMoveset([Moves.FLY]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.SPIKES); game.move.select(Moves.SPIKES);
@ -160,9 +151,8 @@ describe("Abilities - Magic Bounce", () => {
}); });
it("should not bounce back curse", async () => { it("should not bounce back curse", async () => {
game.override.starterSpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.GASTLY]);
game.override.moveset([Moves.CURSE]); game.override.moveset([Moves.CURSE]);
await game.classicMode.startBattle([Species.GASTLY]);
game.move.select(Moves.CURSE); game.move.select(Moves.CURSE);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
@ -171,8 +161,7 @@ describe("Abilities - Magic Bounce", () => {
}); });
it("should not cause encore to be interrupted after bouncing", async () => { it("should not cause encore to be interrupted after bouncing", async () => {
game.override.moveset([Moves.SPLASH, Moves.GROWL, Moves.ENCORE]); game.override.moveset([Moves.SPLASH, Moves.GROWL, Moves.ENCORE]).enemyMoveset([Moves.TACKLE, Moves.GROWL]);
game.override.enemyMoveset([Moves.TACKLE, Moves.GROWL]);
// game.override.ability(Abilities.MOLD_BREAKER); // game.override.ability(Abilities.MOLD_BREAKER);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;
@ -199,9 +188,10 @@ describe("Abilities - Magic Bounce", () => {
// TODO: encore is failing if the last move was virtual. // TODO: encore is failing if the last move was virtual.
it.todo("should not cause the bounced move to count for encore", async () => { it.todo("should not cause the bounced move to count for encore", async () => {
game.override.moveset([Moves.SPLASH, Moves.GROWL, Moves.ENCORE]); game.override
game.override.enemyMoveset([Moves.GROWL, Moves.TACKLE]); .moveset([Moves.SPLASH, Moves.GROWL, Moves.ENCORE])
game.override.enemyAbility(Abilities.MAGIC_BOUNCE); .enemyMoveset([Moves.GROWL, Moves.TACKLE])
.enemyAbility(Abilities.MAGIC_BOUNCE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;
@ -227,9 +217,8 @@ describe("Abilities - Magic Bounce", () => {
// TODO: stomping tantrum should consider moves that were bounced. // TODO: stomping tantrum should consider moves that were bounced.
it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single").moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.override.moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]);
const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM]; const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM];
vi.spyOn(stomping_tantrum, "calculateBattlePower"); vi.spyOn(stomping_tantrum, "calculateBattlePower");
@ -242,36 +231,30 @@ describe("Abilities - Magic Bounce", () => {
expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(150); expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(150);
}); });
// TODO: stomping tantrum should consider moves that were bounced. // TODO: stomping tantrum should consider moves that were bounced
it.todo( it.todo("should boost enemy's stomping tantrum after failed bounce", async () => {
"should properly cause the enemy's stomping tantrum to be doubled in power after bouncing and failing", game.override.enemyMoveset([Moves.STOMPING_TANTRUM, Moves.SPLASH, Moves.CHARM]);
async () => { await game.classicMode.startBattle([Species.BULBASAUR]);
game.override.enemyMoveset([Moves.STOMPING_TANTRUM, Moves.SPLASH, Moves.CHARM]);
await game.classicMode.startBattle([Species.BULBASAUR]);
const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM]; const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM];
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
vi.spyOn(stomping_tantrum, "calculateBattlePower"); vi.spyOn(stomping_tantrum, "calculateBattlePower");
game.move.select(Moves.SPORE); // Spore gets reflected back onto us
await game.move.selectEnemyMove(Moves.CHARM); game.move.select(Moves.SPORE);
await game.phaseInterceptor.to("TurnEndPhase"); await game.move.selectEnemyMove(Moves.CHARM);
expect(enemy.getLastXMoves(1)[0].result).toBe("success"); await game.toNextTurn();
expect(enemy.getLastXMoves(1)[0].result).toBe("success");
await game.phaseInterceptor.to("BerryPhase"); game.move.select(Moves.SPORE);
expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); await game.move.selectEnemyMove(Moves.STOMPING_TANTRUM);
await game.toNextTurn();
await game.toNextTurn(); expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(150);
game.move.select(Moves.GROWL); });
await game.phaseInterceptor.to("BerryPhase");
expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75);
},
);
it("should respect immunities when bouncing a move", async () => { it("should respect immunities when bouncing a move", async () => {
vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100);
game.override.moveset([Moves.THUNDER_WAVE, Moves.GROWL]); game.override.moveset([Moves.THUNDER_WAVE, Moves.GROWL]).ability(Abilities.SOUNDPROOF);
game.override.ability(Abilities.SOUNDPROOF);
await game.classicMode.startBattle([Species.PHANPY]); await game.classicMode.startBattle([Species.PHANPY]);
// Turn 1 - thunder wave immunity test // Turn 1 - thunder wave immunity test
@ -309,8 +292,7 @@ describe("Abilities - Magic Bounce", () => {
}); });
it("should always apply the leftmost available target's magic bounce when bouncing moves like sticky webs in doubles", async () => { it("should always apply the leftmost available target's magic bounce when bouncing moves like sticky webs in doubles", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.STICKY_WEB, Moves.SPLASH, Moves.TRICK_ROOM]);
game.override.moveset([Moves.STICKY_WEB, Moves.SPLASH, Moves.TRICK_ROOM]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
const [enemy_1, enemy_2] = game.scene.getEnemyField(); const [enemy_1, enemy_2] = game.scene.getEnemyField();
@ -345,6 +327,7 @@ describe("Abilities - Magic Bounce", () => {
it("should not bounce back status moves that hit through semi-invulnerable states", async () => { it("should not bounce back status moves that hit through semi-invulnerable states", async () => {
game.override.moveset([Moves.TOXIC, Moves.CHARM]); game.override.moveset([Moves.TOXIC, Moves.CHARM]);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
game.move.select(Moves.TOXIC); game.move.select(Moves.TOXIC);
await game.move.selectEnemyMove(Moves.FLY); await game.move.selectEnemyMove(Moves.FLY);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);

View File

@ -29,16 +29,16 @@ describe("Abilities - Magic Guard", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
/** Player Pokemon overrides */ game.override
game.override.ability(Abilities.MAGIC_GUARD); /** Player Pokemon overrides */
game.override.moveset([Moves.SPLASH]); .ability(Abilities.MAGIC_GUARD)
game.override.startingLevel(100); .moveset([Moves.SPLASH])
.startingLevel(100)
/** Enemy Pokemon overrides */ /** Enemy Pokemon overrides */
game.override.enemySpecies(Species.SNORLAX); .enemySpecies(Species.SNORLAX)
game.override.enemyAbility(Abilities.INSOMNIA); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH)
game.override.enemyLevel(100); .enemyLevel(100);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability)
@ -88,8 +88,9 @@ describe("Abilities - Magic Guard", () => {
}); });
it("ability effect should not persist when the ability is replaced", async () => { it("ability effect should not persist when the ability is replaced", async () => {
game.override.enemyMoveset([Moves.WORRY_SEED, Moves.WORRY_SEED, Moves.WORRY_SEED, Moves.WORRY_SEED]); game.override
game.override.statusEffect(StatusEffect.POISON); .enemyMoveset([Moves.WORRY_SEED, Moves.WORRY_SEED, Moves.WORRY_SEED, Moves.WORRY_SEED])
.statusEffect(StatusEffect.POISON);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -107,8 +108,7 @@ describe("Abilities - Magic Guard", () => {
}); });
it("Magic Guard prevents damage caused by burn but other non-damaging effects are still applied", async () => { it("Magic Guard prevents damage caused by burn but other non-damaging effects are still applied", async () => {
game.override.enemyStatusEffect(StatusEffect.BURN); game.override.enemyStatusEffect(StatusEffect.BURN).enemyAbility(Abilities.MAGIC_GUARD);
game.override.enemyAbility(Abilities.MAGIC_GUARD);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -129,8 +129,7 @@ describe("Abilities - Magic Guard", () => {
}); });
it("Magic Guard prevents damage caused by toxic but other non-damaging effects are still applied", async () => { it("Magic Guard prevents damage caused by toxic but other non-damaging effects are still applied", async () => {
game.override.enemyStatusEffect(StatusEffect.TOXIC); game.override.enemyStatusEffect(StatusEffect.TOXIC).enemyAbility(Abilities.MAGIC_GUARD);
game.override.enemyAbility(Abilities.MAGIC_GUARD);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -207,8 +206,7 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents against damage from volatile status effects", async () => { it("Magic Guard prevents against damage from volatile status effects", async () => {
await game.classicMode.startBattle([Species.DUSKULL]); await game.classicMode.startBattle([Species.DUSKULL]);
game.override.moveset([Moves.CURSE]); game.override.moveset([Moves.CURSE]).enemyAbility(Abilities.MAGIC_GUARD);
game.override.enemyAbility(Abilities.MAGIC_GUARD);
const leadPokemon = game.scene.getPlayerPokemon()!; const leadPokemon = game.scene.getPlayerPokemon()!;
@ -330,8 +328,7 @@ describe("Abilities - Magic Guard", () => {
//Tests the ability Bad Dreams //Tests the ability Bad Dreams
game.override.statusEffect(StatusEffect.SLEEP); game.override.statusEffect(StatusEffect.SLEEP);
//enemy pokemon is given Spore just in case player pokemon somehow awakens during test //enemy pokemon is given Spore just in case player pokemon somehow awakens during test
game.override.enemyMoveset([Moves.SPORE, Moves.SPORE, Moves.SPORE, Moves.SPORE]); game.override.enemyMoveset([Moves.SPORE, Moves.SPORE, Moves.SPORE, Moves.SPORE]).enemyAbility(Abilities.BAD_DREAMS);
game.override.enemyAbility(Abilities.BAD_DREAMS);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -352,8 +349,7 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with PostFaintContactDamageAbAttr", async () => { it("Magic Guard prevents damage from abilities with PostFaintContactDamageAbAttr", async () => {
//Tests the abilities Innards Out/Aftermath //Tests the abilities Innards Out/Aftermath
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemyAbility(Abilities.AFTERMATH);
game.override.enemyAbility(Abilities.AFTERMATH);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -376,8 +372,7 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with PostDefendContactDamageAbAttr", async () => { it("Magic Guard prevents damage from abilities with PostDefendContactDamageAbAttr", async () => {
//Tests the abilities Iron Barbs/Rough Skin //Tests the abilities Iron Barbs/Rough Skin
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemyAbility(Abilities.IRON_BARBS);
game.override.enemyAbility(Abilities.IRON_BARBS);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -399,8 +394,7 @@ describe("Abilities - Magic Guard", () => {
it("Magic Guard prevents damage from abilities with ReverseDrainAbAttr", async () => { it("Magic Guard prevents damage from abilities with ReverseDrainAbAttr", async () => {
//Tests the ability Liquid Ooze //Tests the ability Liquid Ooze
game.override.moveset([Moves.ABSORB]); game.override.moveset([Moves.ABSORB]).enemyAbility(Abilities.LIQUID_OOZE);
game.override.enemyAbility(Abilities.LIQUID_OOZE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -421,9 +415,7 @@ describe("Abilities - Magic Guard", () => {
}); });
it("Magic Guard prevents HP loss from abilities with PostWeatherLapseDamageAbAttr", async () => { it("Magic Guard prevents HP loss from abilities with PostWeatherLapseDamageAbAttr", async () => {
//Tests the abilities Solar Power/Dry Skin game.override.passiveAbility(Abilities.SOLAR_POWER).weather(WeatherType.SUNNY);
game.override.passiveAbility(Abilities.SOLAR_POWER);
game.override.weather(WeatherType.SUNNY);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon()!; const leadPokemon = game.scene.getPlayerPokemon()!;

View File

@ -37,8 +37,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Player side + single battle Intimidate - opponent loses stats", async () => { it("Player side + single battle Intimidate - opponent loses stats", async () => {
game.override.ability(Abilities.MIRROR_ARMOR); game.override.ability(Abilities.MIRROR_ARMOR).enemyAbility(Abilities.INTIMIDATE);
game.override.enemyAbility(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -54,8 +53,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Enemy side + single battle Intimidate - player loses stats", async () => { it("Enemy side + single battle Intimidate - player loses stats", async () => {
game.override.enemyAbility(Abilities.MIRROR_ARMOR); game.override.enemyAbility(Abilities.MIRROR_ARMOR).ability(Abilities.INTIMIDATE);
game.override.ability(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -71,9 +69,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Player side + double battle Intimidate - opponents each lose -2 atk", async () => { it("Player side + double battle Intimidate - opponents each lose -2 atk", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").ability(Abilities.MIRROR_ARMOR).enemyAbility(Abilities.INTIMIDATE);
game.override.ability(Abilities.MIRROR_ARMOR);
game.override.enemyAbility(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]);
const [enemy1, enemy2] = game.scene.getEnemyField(); const [enemy1, enemy2] = game.scene.getEnemyField();
@ -93,9 +89,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Enemy side + double battle Intimidate - players each lose -2 atk", async () => { it("Enemy side + double battle Intimidate - players each lose -2 atk", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").enemyAbility(Abilities.MIRROR_ARMOR).ability(Abilities.INTIMIDATE);
game.override.enemyAbility(Abilities.MIRROR_ARMOR);
game.override.ability(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]);
const [enemy1, enemy2] = game.scene.getEnemyField(); const [enemy1, enemy2] = game.scene.getEnemyField();
@ -115,8 +109,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Player side + single battle Intimidate + Tickle - opponent loses stats", async () => { it("Player side + single battle Intimidate + Tickle - opponent loses stats", async () => {
game.override.ability(Abilities.MIRROR_ARMOR); game.override.ability(Abilities.MIRROR_ARMOR).enemyAbility(Abilities.INTIMIDATE);
game.override.enemyAbility(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -134,9 +127,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Player side + double battle Intimidate + Tickle - opponents each lose -3 atk, -1 def", async () => { it("Player side + double battle Intimidate + Tickle - opponents each lose -3 atk, -1 def", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").ability(Abilities.MIRROR_ARMOR).enemyAbility(Abilities.INTIMIDATE);
game.override.ability(Abilities.MIRROR_ARMOR);
game.override.enemyAbility(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER]);
const [enemy1, enemy2] = game.scene.getEnemyField(); const [enemy1, enemy2] = game.scene.getEnemyField();
@ -159,8 +150,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Enemy side + single battle Intimidate + Tickle - player loses stats", async () => { it("Enemy side + single battle Intimidate + Tickle - player loses stats", async () => {
game.override.enemyAbility(Abilities.MIRROR_ARMOR); game.override.enemyAbility(Abilities.MIRROR_ARMOR).ability(Abilities.INTIMIDATE);
game.override.ability(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -178,8 +168,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Player side + single battle Intimidate + oppoenent has white smoke - no one loses stats", async () => { it("Player side + single battle Intimidate + oppoenent has white smoke - no one loses stats", async () => {
game.override.enemyAbility(Abilities.WHITE_SMOKE); game.override.enemyAbility(Abilities.WHITE_SMOKE).ability(Abilities.MIRROR_ARMOR);
game.override.ability(Abilities.MIRROR_ARMOR);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -197,8 +186,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Enemy side + single battle Intimidate + player has white smoke - no one loses stats", async () => { it("Enemy side + single battle Intimidate + player has white smoke - no one loses stats", async () => {
game.override.ability(Abilities.WHITE_SMOKE); game.override.ability(Abilities.WHITE_SMOKE).enemyAbility(Abilities.MIRROR_ARMOR);
game.override.enemyAbility(Abilities.MIRROR_ARMOR);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -252,9 +240,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Both sides have mirror armor - does not loop, player loses attack", async () => { it("Both sides have mirror armor - does not loop, player loses attack", async () => {
game.override.enemyAbility(Abilities.MIRROR_ARMOR); game.override.enemyAbility(Abilities.MIRROR_ARMOR).ability(Abilities.MIRROR_ARMOR).ability(Abilities.INTIMIDATE);
game.override.ability(Abilities.MIRROR_ARMOR);
game.override.ability(Abilities.INTIMIDATE);
await game.classicMode.startBattle([Species.BULBASAUR]); await game.classicMode.startBattle([Species.BULBASAUR]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -288,8 +274,7 @@ describe("Ability - Mirror Armor", () => {
}); });
it("Double battle + sticky web applied player side - player switches out and enemy 1 should lose -1 speed", async () => { it("Double battle + sticky web applied player side - player switches out and enemy 1 should lose -1 speed", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").ability(Abilities.MIRROR_ARMOR);
game.override.ability(Abilities.MIRROR_ARMOR);
await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE]); await game.classicMode.startBattle([Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE]);
const [enemy1, enemy2] = game.scene.getEnemyField(); const [enemy1, enemy2] = game.scene.getEnemyField();

View File

@ -27,13 +27,14 @@ describe("Abilities - Moxie", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.AERIAL_ACE; const moveToUse = Moves.AERIAL_ACE;
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.RATTATA); .battleStyle("single")
game.override.enemyAbility(Abilities.MOXIE); .enemySpecies(Species.RATTATA)
game.override.ability(Abilities.MOXIE); .enemyAbility(Abilities.MOXIE)
game.override.startingLevel(2000); .ability(Abilities.MOXIE)
game.override.moveset([moveToUse]); .startingLevel(2000)
game.override.enemyMoveset(Moves.SPLASH); .moveset([moveToUse])
.enemyMoveset(Moves.SPLASH);
}); });
it("should raise ATK stat stage by 1 when winning a battle", async () => { it("should raise ATK stat stage by 1 when winning a battle", async () => {

View File

@ -45,8 +45,9 @@ describe("Abilities - Normalize", () => {
}); });
it("should not apply the old type boost item after changing a move's type", async () => { it("should not apply the old type boost item after changing a move's type", async () => {
game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }]); game.override
game.override.moveset([Moves.LEAFAGE]); .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }])
.moveset([Moves.LEAFAGE]);
const powerSpy = vi.spyOn(allMoves[Moves.LEAFAGE], "calculateBattlePower"); const powerSpy = vi.spyOn(allMoves[Moves.LEAFAGE], "calculateBattlePower");
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -58,8 +59,9 @@ describe("Abilities - Normalize", () => {
}); });
it("should apply silk scarf's power boost after changing a move's type", async () => { it("should apply silk scarf's power boost after changing a move's type", async () => {
game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }]); game.override
game.override.moveset([Moves.LEAFAGE]); .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }])
.moveset([Moves.LEAFAGE]);
const powerSpy = vi.spyOn(allMoves[Moves.LEAFAGE], "calculateBattlePower"); const powerSpy = vi.spyOn(allMoves[Moves.LEAFAGE], "calculateBattlePower");
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);

View File

@ -26,14 +26,15 @@ describe("Abilities - Parental Bond", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.disableCrits(); .battleStyle("single")
game.override.ability(Abilities.PARENTAL_BOND); .disableCrits()
game.override.enemySpecies(Species.SNORLAX); .ability(Abilities.PARENTAL_BOND)
game.override.enemyAbility(Abilities.FUR_COAT); .enemySpecies(Species.SNORLAX)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.FUR_COAT)
game.override.startingLevel(100); .enemyMoveset(Moves.SPLASH)
game.override.enemyLevel(100); .startingLevel(100)
.enemyLevel(100);
}); });
it("should add second strike to attack move", async () => { it("should add second strike to attack move", async () => {
@ -61,8 +62,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("should apply secondary effects to both strikes", async () => { it("should apply secondary effects to both strikes", async () => {
game.override.moveset([Moves.POWER_UP_PUNCH]); game.override.moveset([Moves.POWER_UP_PUNCH]).enemySpecies(Species.AMOONGUSS);
game.override.enemySpecies(Species.AMOONGUSS);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -148,8 +148,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("should not apply multiplier to counter moves", async () => { it("should not apply multiplier to counter moves", async () => {
game.override.moveset([Moves.COUNTER]); game.override.moveset([Moves.COUNTER]).enemyMoveset([Moves.TACKLE]);
game.override.enemyMoveset([Moves.TACKLE]);
await game.classicMode.startBattle([Species.SHUCKLE]); await game.classicMode.startBattle([Species.SHUCKLE]);
@ -167,9 +166,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("should not apply to multi-target moves", async () => { it("should not apply to multi-target moves", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.EARTHQUAKE]).passiveAbility(Abilities.LEVITATE);
game.override.moveset([Moves.EARTHQUAKE]);
game.override.passiveAbility(Abilities.LEVITATE);
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]); await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
@ -237,8 +234,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("Moves boosted by this ability and Multi-Lens should strike 3 times", async () => { it("Moves boosted by this ability and Multi-Lens should strike 3 times", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -252,8 +248,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("Seismic Toss boosted by this ability and Multi-Lens should strike 3 times", async () => { it("Seismic Toss boosted by this ability and Multi-Lens should strike 3 times", async () => {
game.override.moveset([Moves.SEISMIC_TOSS]); game.override.moveset([Moves.SEISMIC_TOSS]).startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -378,8 +373,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("should not cause user to hit into King's Shield more than once", async () => { it("should not cause user to hit into King's Shield more than once", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemyMoveset([Moves.KINGS_SHIELD]);
game.override.enemyMoveset([Moves.KINGS_SHIELD]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -393,8 +387,7 @@ describe("Abilities - Parental Bond", () => {
}); });
it("should not cause user to hit into Storm Drain more than once", async () => { it("should not cause user to hit into Storm Drain more than once", async () => {
game.override.moveset([Moves.WATER_GUN]); game.override.moveset([Moves.WATER_GUN]).enemyAbility(Abilities.STORM_DRAIN);
game.override.enemyAbility(Abilities.STORM_DRAIN);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);

View File

@ -21,19 +21,18 @@ describe("Abilities - Perish Song", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.disableCrits(); .battleStyle("single")
.disableCrits()
game.override.enemySpecies(Species.MAGIKARP); .enemySpecies(Species.MAGIKARP)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyAbility(Abilities.BALL_FETCH)
.starterSpecies(Species.CURSOLA)
game.override.starterSpecies(Species.CURSOLA); .ability(Abilities.PERISH_BODY)
game.override.ability(Abilities.PERISH_BODY); .moveset([Moves.SPLASH])
game.override.moveset([Moves.SPLASH]); .enemyMoveset([Moves.AQUA_JET]);
}); });
it("should trigger when hit with damaging move", async () => { it("should trigger when hit with damaging move", async () => {
game.override.enemyMoveset([Moves.AQUA_JET]);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const cursola = game.scene.getPlayerPokemon(); const cursola = game.scene.getPlayerPokemon();
const magikarp = game.scene.getEnemyPokemon(); const magikarp = game.scene.getEnemyPokemon();
@ -46,7 +45,7 @@ describe("Abilities - Perish Song", () => {
}); });
it("should trigger even when fainting", async () => { it("should trigger even when fainting", async () => {
game.override.enemyMoveset([Moves.AQUA_JET]).enemyLevel(100).startingLevel(1); game.override.enemyLevel(100).startingLevel(1);
await game.classicMode.startBattle([Species.CURSOLA, Species.FEEBAS]); await game.classicMode.startBattle([Species.CURSOLA, Species.FEEBAS]);
const magikarp = game.scene.getEnemyPokemon(); const magikarp = game.scene.getEnemyPokemon();
@ -87,9 +86,10 @@ describe("Abilities - Perish Song", () => {
}); });
it("should activate if cursola already has perish song, but not reset its counter", async () => { it("should activate if cursola already has perish song, but not reset its counter", async () => {
game.override.enemyMoveset([Moves.PERISH_SONG, Moves.AQUA_JET, Moves.SPLASH]); game.override
game.override.moveset([Moves.WHIRLWIND, Moves.SPLASH]); .enemyMoveset([Moves.PERISH_SONG, Moves.AQUA_JET, Moves.SPLASH])
game.override.startingWave(5); .moveset([Moves.WHIRLWIND, Moves.SPLASH])
.startingWave(5);
await game.classicMode.startBattle([Species.CURSOLA]); await game.classicMode.startBattle([Species.CURSOLA]);
const cursola = game.scene.getPlayerPokemon(); const cursola = game.scene.getPlayerPokemon();

View File

@ -35,8 +35,7 @@ describe("Abilities - POWER CONSTRUCT", () => {
test("check if fainted 50% Power Construct Pokemon switches to base form on arena reset", async () => { test("check if fainted 50% Power Construct Pokemon switches to base form on arena reset", async () => {
const baseForm = 2, const baseForm = 2,
completeForm = 4; completeForm = 4;
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.ZYGARDE]: completeForm, [Species.ZYGARDE]: completeForm,
}); });
@ -62,8 +61,7 @@ describe("Abilities - POWER CONSTRUCT", () => {
test("check if fainted 10% Power Construct Pokemon switches to base form on arena reset", async () => { test("check if fainted 10% Power Construct Pokemon switches to base form on arena reset", async () => {
const baseForm = 3, const baseForm = 3,
completeForm = 5; completeForm = 5;
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.ZYGARDE]: completeForm, [Species.ZYGARDE]: completeForm,
}); });

View File

@ -26,11 +26,12 @@ describe("Abilities - Power Spot", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); .battleStyle("double")
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM])
game.override.enemySpecies(Species.SHUCKLE); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.SHUCKLE)
.enemyAbility(Abilities.BALL_FETCH);
}); });
it("raises the power of allies' special moves by 30%", async () => { it("raises the power of allies' special moves by 30%", async () => {

View File

@ -108,8 +108,7 @@ describe("Abilities - Protean", () => {
}); });
test("ability applies correctly even if the type has changed by another ability", async () => { test("ability applies correctly even if the type has changed by another ability", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).passiveAbility(Abilities.REFRIGERATE);
game.override.passiveAbility(Abilities.REFRIGERATE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -156,8 +155,7 @@ describe("Abilities - Protean", () => {
}); });
test("ability applies correctly even if the pokemon's move misses", async () => { test("ability applies correctly even if the pokemon's move misses", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemyMoveset(Moves.SPLASH);
game.override.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -188,8 +186,7 @@ describe("Abilities - Protean", () => {
}); });
test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => { test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]).enemySpecies(Species.GASTLY);
game.override.enemySpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
@ -262,8 +259,7 @@ describe("Abilities - Protean", () => {
}); });
test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => {
game.override.moveset([Moves.TRICK_OR_TREAT]); game.override.moveset([Moves.TRICK_OR_TREAT]).enemySpecies(Species.GASTLY);
game.override.enemySpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);

View File

@ -24,16 +24,15 @@ describe("Abilities - Quick Draw", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.starterSpecies(Species.MAGIKARP); .starterSpecies(Species.MAGIKARP)
game.override.ability(Abilities.QUICK_DRAW); .ability(Abilities.QUICK_DRAW)
game.override.moveset([Moves.TACKLE, Moves.TAIL_WHIP]); .moveset([Moves.TACKLE, Moves.TAIL_WHIP])
.enemyLevel(100)
game.override.enemyLevel(100); .enemySpecies(Species.MAGIKARP)
game.override.enemySpecies(Species.MAGIKARP); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyMoveset([Moves.TACKLE]);
game.override.enemyMoveset([Moves.TACKLE]);
vi.spyOn(allAbilities[Abilities.QUICK_DRAW].getAttrs(BypassSpeedChanceAbAttr)[0], "chance", "get").mockReturnValue( vi.spyOn(allAbilities[Abilities.QUICK_DRAW].getAttrs(BypassSpeedChanceAbAttr)[0], "chance", "get").mockReturnValue(
100, 100,

View File

@ -22,15 +22,14 @@ describe("Abilities - Sand Spit", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.disableCrits(); .battleStyle("single")
.disableCrits()
game.override.enemySpecies(Species.MAGIKARP); .enemySpecies(Species.MAGIKARP)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyAbility(Abilities.BALL_FETCH)
.starterSpecies(Species.SILICOBRA)
game.override.starterSpecies(Species.SILICOBRA); .ability(Abilities.SAND_SPIT)
game.override.ability(Abilities.SAND_SPIT); .moveset([Moves.SPLASH, Moves.COIL]);
game.override.moveset([Moves.SPLASH, Moves.COIL]);
}); });
it("should trigger when hit with damaging move", async () => { it("should trigger when hit with damaging move", async () => {

View File

@ -31,8 +31,7 @@ describe("Abilities - SCHOOLING", () => {
test("check if fainted pokemon switches to base form on arena reset", async () => { test("check if fainted pokemon switches to base form on arena reset", async () => {
const soloForm = 0, const soloForm = 0,
schoolForm = 1; schoolForm = 1;
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.WISHIWASHI]: schoolForm, [Species.WISHIWASHI]: schoolForm,
}); });

View File

@ -24,9 +24,7 @@ describe("Abilities - Screen Cleaner", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override.battleStyle("single").ability(Abilities.SCREEN_CLEANER).enemySpecies(Species.SHUCKLE);
game.override.ability(Abilities.SCREEN_CLEANER);
game.override.enemySpecies(Species.SHUCKLE);
}); });
it("removes Aurora Veil", async () => { it("removes Aurora Veil", async () => {

View File

@ -22,15 +22,14 @@ describe("Abilities - Seed Sower", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.disableCrits(); .battleStyle("single")
.disableCrits()
game.override.enemySpecies(Species.MAGIKARP); .enemySpecies(Species.MAGIKARP)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyAbility(Abilities.BALL_FETCH)
.starterSpecies(Species.ARBOLIVA)
game.override.starterSpecies(Species.ARBOLIVA); .ability(Abilities.SEED_SOWER)
game.override.ability(Abilities.SEED_SOWER); .moveset([Moves.SPLASH]);
game.override.moveset([Moves.SPLASH]);
}); });
it("should trigger when hit with damaging move", async () => { it("should trigger when hit with damaging move", async () => {

View File

@ -31,12 +31,13 @@ describe("Abilities - Shield Dust", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.ONIX); .battleStyle("single")
game.override.enemyAbility(Abilities.SHIELD_DUST); .enemySpecies(Species.ONIX)
game.override.startingLevel(100); .enemyAbility(Abilities.SHIELD_DUST)
game.override.moveset(Moves.AIR_SLASH); .startingLevel(100)
game.override.enemyMoveset(Moves.TACKLE); .moveset(Moves.AIR_SLASH)
.enemyMoveset(Moves.TACKLE);
}); });
it("Shield Dust", async () => { it("Shield Dust", async () => {

View File

@ -26,17 +26,17 @@ describe("Abilities - SHIELDS DOWN", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; const moveToUse = Moves.SPLASH;
game.override.battleStyle("single"); game.override
game.override.ability(Abilities.SHIELDS_DOWN); .battleStyle("single")
game.override.moveset([moveToUse]); .ability(Abilities.SHIELDS_DOWN)
game.override.enemyMoveset([Moves.TACKLE]); .moveset([moveToUse])
.enemyMoveset([Moves.TACKLE]);
}); });
test("check if fainted pokemon switched to base form on arena reset", async () => { test("check if fainted pokemon switched to base form on arena reset", async () => {
const meteorForm = 0, const meteorForm = 0,
coreForm = 7; coreForm = 7;
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.MINIOR]: coreForm, [Species.MINIOR]: coreForm,
}); });
@ -70,8 +70,7 @@ describe("Abilities - SHIELDS DOWN", () => {
}); });
test("should still ignore non-volatile status moves used by a pokemon with mold breaker", async () => { test("should still ignore non-volatile status moves used by a pokemon with mold breaker", async () => {
game.override.enemyAbility(Abilities.MOLD_BREAKER); game.override.enemyAbility(Abilities.MOLD_BREAKER).enemyMoveset([Moves.SPORE]);
game.override.enemyMoveset([Moves.SPORE]);
await game.classicMode.startBattle([Species.MINIOR]); await game.classicMode.startBattle([Species.MINIOR]);
@ -94,8 +93,7 @@ describe("Abilities - SHIELDS DOWN", () => {
}); });
test("should ignore status moves even through mold breaker", async () => { test("should ignore status moves even through mold breaker", async () => {
game.override.enemyMoveset([Moves.SPORE]); game.override.enemyMoveset([Moves.SPORE]).enemyAbility(Abilities.MOLD_BREAKER);
game.override.enemyAbility(Abilities.MOLD_BREAKER);
await game.classicMode.startBattle([Species.MINIOR]); await game.classicMode.startBattle([Species.MINIOR]);
@ -108,8 +106,9 @@ describe("Abilities - SHIELDS DOWN", () => {
// toxic spikes currently does not poison flying types when gravity is in effect // toxic spikes currently does not poison flying types when gravity is in effect
test.todo("should become poisoned by toxic spikes when grounded", async () => { test.todo("should become poisoned by toxic spikes when grounded", async () => {
game.override.enemyMoveset([Moves.GRAVITY, Moves.TOXIC_SPIKES, Moves.SPLASH]); game.override
game.override.moveset([Moves.GRAVITY, Moves.SPLASH]); .enemyMoveset([Moves.GRAVITY, Moves.TOXIC_SPIKES, Moves.SPLASH])
.moveset([Moves.GRAVITY, Moves.SPLASH]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MINIOR]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MINIOR]);
@ -155,9 +154,7 @@ describe("Abilities - SHIELDS DOWN", () => {
// the `NoTransformAbilityAbAttr` attribute is not checked anywhere, so this test cannot pass. // the `NoTransformAbilityAbAttr` attribute is not checked anywhere, so this test cannot pass.
test.todo("ditto should not be immune to status after transforming", async () => { test.todo("ditto should not be immune to status after transforming", async () => {
game.override.enemySpecies(Species.DITTO); game.override.enemySpecies(Species.DITTO).enemyAbility(Abilities.IMPOSTER).moveset([Moves.SPLASH, Moves.SPORE]);
game.override.enemyAbility(Abilities.IMPOSTER);
game.override.moveset([Moves.SPLASH, Moves.SPORE]);
await game.classicMode.startBattle([Species.MINIOR]); await game.classicMode.startBattle([Species.MINIOR]);
@ -169,11 +166,12 @@ describe("Abilities - SHIELDS DOWN", () => {
}); });
test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => { test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => {
game.override.enemyMoveset([Moves.TACKLE]); game.override
game.override.moveset([Moves.THUNDERBOLT]); .enemyMoveset([Moves.TACKLE])
game.override.startingLevel(100); .moveset([Moves.THUNDERBOLT])
game.override.startingWave(5); .startingLevel(100)
game.override.enemySpecies(Species.MINIOR); .startingWave(5)
.enemySpecies(Species.MINIOR);
await game.classicMode.startBattle([Species.REGIELEKI]); await game.classicMode.startBattle([Species.REGIELEKI]);
const minior = game.scene.getEnemyPokemon()!; const minior = game.scene.getEnemyPokemon()!;

View File

@ -28,11 +28,12 @@ describe("Abilities - Steely Spirit", () => {
beforeEach(() => { beforeEach(() => {
ironHeadPower = allMoves[moveToCheck].power; ironHeadPower = allMoves[moveToCheck].power;
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.enemySpecies(Species.SHUCKLE); .battleStyle("double")
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.SHUCKLE)
game.override.moveset([Moves.IRON_HEAD, Moves.SPLASH]); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.IRON_HEAD, Moves.SPLASH])
.enemyMoveset(Moves.SPLASH);
vi.spyOn(allMoves[moveToCheck], "calculateBattlePower"); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower");
}); });

View File

@ -24,15 +24,14 @@ describe("Abilities - Sturdy", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.starterSpecies(Species.LUCARIO); .starterSpecies(Species.LUCARIO)
game.override.startingLevel(100); .startingLevel(100)
game.override.moveset([Moves.CLOSE_COMBAT, Moves.FISSURE]); .moveset([Moves.CLOSE_COMBAT, Moves.FISSURE])
.enemySpecies(Species.ARON)
game.override.enemySpecies(Species.ARON); .enemyLevel(5)
game.override.enemyLevel(5); .enemyAbility(Abilities.STURDY);
game.override.enemyAbility(Abilities.STURDY);
}); });
test("Sturdy activates when user is at full HP", async () => { test("Sturdy activates when user is at full HP", async () => {

View File

@ -69,10 +69,7 @@ describe("Abilities - Sweet Veil", () => {
}); });
it("prevents the user and its allies already drowsy due to Yawn from falling asleep.", async () => { it("prevents the user and its allies already drowsy due to Yawn from falling asleep.", async () => {
game.override.enemySpecies(Species.PIKACHU); game.override.enemySpecies(Species.PIKACHU).enemyLevel(5).startingLevel(5).enemyMoveset(Moves.SPLASH);
game.override.enemyLevel(5);
game.override.startingLevel(5);
game.override.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE, Species.SWIRLIX]); await game.classicMode.startBattle([Species.SHUCKLE, Species.SHUCKLE, Species.SWIRLIX]);

View File

@ -51,8 +51,7 @@ describe("Abilities - Unseen Fist", () => {
await testUnseenFistHitResult(game, Moves.BULLDOZE, Moves.WIDE_GUARD, false)); await testUnseenFistHitResult(game, Moves.BULLDOZE, Moves.WIDE_GUARD, false));
it("should cause a contact move to ignore Protect, but not Substitute", async () => { it("should cause a contact move to ignore Protect, but not Substitute", async () => {
game.override.enemyLevel(1); game.override.enemyLevel(1).moveset([Moves.TACKLE]);
game.override.moveset([Moves.TACKLE]);
await game.classicMode.startBattle(); await game.classicMode.startBattle();

View File

@ -26,19 +26,19 @@ describe("Abilities - Volt Absorb", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override.battleStyle("single").disableCrits();
game.override.disableCrits();
}); });
it("does not activate when CHARGE is used", async () => { it("does not activate when CHARGE is used", async () => {
const moveToUse = Moves.CHARGE; const moveToUse = Moves.CHARGE;
const ability = Abilities.VOLT_ABSORB; const ability = Abilities.VOLT_ABSORB;
game.override.moveset([moveToUse]); game.override
game.override.ability(ability); .moveset([moveToUse])
game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); .ability(ability)
game.override.enemySpecies(Species.DUSKULL); .enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE])
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.DUSKULL)
.enemyAbility(Abilities.BALL_FETCH);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -54,10 +54,11 @@ describe("Abilities - Volt Absorb", () => {
}); });
it("should activate regardless of accuracy checks", async () => { it("should activate regardless of accuracy checks", async () => {
game.override.moveset(Moves.THUNDERBOLT); game.override
game.override.enemyMoveset(Moves.SPLASH); .moveset(Moves.THUNDERBOLT)
game.override.enemySpecies(Species.MAGIKARP); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.VOLT_ABSORB); .enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.VOLT_ABSORB);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -74,10 +75,11 @@ describe("Abilities - Volt Absorb", () => {
}); });
it("regardless of accuracy should not trigger on pokemon in semi invulnerable state", async () => { it("regardless of accuracy should not trigger on pokemon in semi invulnerable state", async () => {
game.override.moveset(Moves.THUNDERBOLT); game.override
game.override.enemyMoveset(Moves.DIVE); .moveset(Moves.THUNDERBOLT)
game.override.enemySpecies(Species.MAGIKARP); .enemyMoveset(Moves.DIVE)
game.override.enemyAbility(Abilities.VOLT_ABSORB); .enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.VOLT_ABSORB);
await game.classicMode.startBattle(); await game.classicMode.startBattle();

View File

@ -23,14 +23,15 @@ describe("Abilities - Wind Power", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.SHIFTRY); .battleStyle("single")
game.override.enemyAbility(Abilities.WIND_POWER); .enemySpecies(Species.SHIFTRY)
game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); .enemyAbility(Abilities.WIND_POWER)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM])
.enemyMoveset(Moves.SPLASH);
}); });
it("it becomes charged when hit by wind moves", async () => { it("becomes charged when hit by wind moves", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
const shiftry = game.scene.getEnemyPokemon()!; const shiftry = game.scene.getEnemyPokemon()!;
@ -42,9 +43,8 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined(); expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
}); });
it("it becomes charged when Tailwind takes effect on its side", async () => { it("becomes charged when Tailwind takes effect on its side", async () => {
game.override.ability(Abilities.WIND_POWER); game.override.ability(Abilities.WIND_POWER).enemySpecies(Species.MAGIKARP);
game.override.enemySpecies(Species.MAGIKARP);
await game.classicMode.startBattle([Species.SHIFTRY]); await game.classicMode.startBattle([Species.SHIFTRY]);
const shiftry = game.scene.getPlayerPokemon()!; const shiftry = game.scene.getPlayerPokemon()!;
@ -58,8 +58,7 @@ describe("Abilities - Wind Power", () => {
}); });
it("does not become charged when Tailwind takes effect on opposing side", async () => { it("does not become charged when Tailwind takes effect on opposing side", async () => {
game.override.enemySpecies(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP).ability(Abilities.WIND_POWER);
game.override.ability(Abilities.WIND_POWER);
await game.classicMode.startBattle([Species.SHIFTRY]); await game.classicMode.startBattle([Species.SHIFTRY]);
const magikarp = game.scene.getEnemyPokemon()!; const magikarp = game.scene.getEnemyPokemon()!;

View File

@ -23,12 +23,13 @@ describe("Abilities - Wonder Skin", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.moveset([Moves.TACKLE, Moves.CHARM]); .battleStyle("single")
game.override.ability(Abilities.BALL_FETCH); .moveset([Moves.TACKLE, Moves.CHARM])
game.override.enemySpecies(Species.SHUCKLE); .ability(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.WONDER_SKIN); .enemySpecies(Species.SHUCKLE)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.WONDER_SKIN)
.enemyMoveset(Moves.SPLASH);
}); });
it("lowers accuracy of status moves to 50%", async () => { it("lowers accuracy of status moves to 50%", async () => {

View File

@ -85,8 +85,7 @@ describe("Abilities - ZEN MODE", () => {
}); });
it("should switch to base form on arena reset", async () => { it("should switch to base form on arena reset", async () => {
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.DARMANITAN]: zenForm, [Species.DARMANITAN]: zenForm,
}); });

View File

@ -34,8 +34,7 @@ describe("Abilities - ZERO TO HERO", () => {
}); });
it("should swap to base form on arena reset", async () => { it("should swap to base form on arena reset", async () => {
game.override.startingWave(4); game.override.startingWave(4).starterForms({
game.override.starterForms({
[Species.PALAFIN]: heroForm, [Species.PALAFIN]: heroForm,
}); });

View File

@ -130,12 +130,7 @@ describe("RibbonAchv", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.moveset([]); game.override.moveset([]).startingLevel(0).starterSpecies(0).enemyMoveset([]).enemySpecies(0).startingWave(0);
game.override.startingLevel(0);
game.override.starterSpecies(0);
game.override.enemyMoveset([]);
game.override.enemySpecies(0);
game.override.startingWave(0);
scene = game.scene; scene = game.scene;
}); });

View File

@ -24,12 +24,14 @@ describe("Weather - Fog", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.weather(WeatherType.FOG).battleStyle("single"); game.override
game.override.moveset([Moves.TACKLE]); .weather(WeatherType.FOG)
game.override.ability(Abilities.BALL_FETCH); .battleStyle("single")
game.override.enemyAbility(Abilities.BALL_FETCH); .moveset([Moves.TACKLE])
game.override.enemySpecies(Species.MAGIKARP); .ability(Abilities.BALL_FETCH)
game.override.enemyMoveset([Moves.SPLASH]); .enemyAbility(Abilities.BALL_FETCH)
.enemySpecies(Species.MAGIKARP)
.enemyMoveset([Moves.SPLASH]);
}); });
it("move accuracy is multiplied by 90%", async () => { it("move accuracy is multiplied by 90%", async () => {

View File

@ -24,11 +24,12 @@ describe("Weather - Strong Winds", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.startingLevel(10); .battleStyle("single")
game.override.enemySpecies(Species.TAILLOW); .startingLevel(10)
game.override.enemyAbility(Abilities.DELTA_STREAM); .enemySpecies(Species.TAILLOW)
game.override.moveset([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); .enemyAbility(Abilities.DELTA_STREAM)
.moveset([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]);
}); });
it("electric type move is not very effective on Rayquaza", async () => { it("electric type move is not very effective on Rayquaza", async () => {

View File

@ -24,11 +24,12 @@ describe("Battle order", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.MEWTWO); .battleStyle("single")
game.override.enemyAbility(Abilities.INSOMNIA); .enemySpecies(Species.MEWTWO)
game.override.ability(Abilities.INSOMNIA); .enemyAbility(Abilities.INSOMNIA)
game.override.moveset([Moves.TACKLE]); .ability(Abilities.INSOMNIA)
.moveset([Moves.TACKLE]);
}); });
it("opponent faster than player 50 vs 150", async () => { it("opponent faster than player 50 vs 150", async () => {

View File

@ -15,7 +15,6 @@ import { SummonPhase } from "#app/phases/summon-phase";
import { SwitchPhase } from "#app/phases/switch-phase"; import { SwitchPhase } from "#app/phases/switch-phase";
import { TitlePhase } from "#app/phases/title-phase"; import { TitlePhase } from "#app/phases/title-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { VictoryPhase } from "#app/phases/victory-phase";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import { generateStarter } from "#test/testUtils/gameManagerUtils"; import { generateStarter } from "#test/testUtils/gameManagerUtils";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
@ -91,28 +90,27 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("do attack wave 3 - single battle - regular - OHKO", async () => { it("do attack wave 3 - single battle - regular - OHKO", async () => {
game.override.starterSpecies(Species.MEWTWO); game.override
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.startingLevel(2000); .startingLevel(2000)
game.override.startingWave(3).battleStyle("single"); .startingWave(3)
game.override.moveset([Moves.TACKLE]); .battleStyle("single")
game.override.enemyAbility(Abilities.HYDRATION); .enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.classicMode.startBattle([Species.MEWTWO]);
await game.classicMode.startBattle();
game.move.select(Moves.TACKLE); game.move.select(Moves.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(SelectModifierPhase, false); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(SelectModifierPhase, false);
}, 20000); }, 20000);
it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => { it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => {
game.override.starterSpecies(Species.MEWTWO); game.override
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.startingLevel(5); .startingLevel(5)
game.override.startingWave(3); .startingWave(3)
game.override.moveset([Moves.TACKLE]); .moveset([Moves.TACKLE])
game.override.enemyAbility(Abilities.HYDRATION); .enemyAbility(Abilities.HYDRATION)
game.override.enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); .enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP])
game.override.battleStyle("single"); .battleStyle("single");
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.MEWTWO]);
game.move.select(Moves.TACKLE); game.move.select(Moves.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false);
}, 20000); }, 20000);
@ -246,36 +244,37 @@ describe("Test Battle Phase", () => {
it("kill opponent pokemon", async () => { it("kill opponent pokemon", async () => {
const moveToUse = Moves.SPLASH; const moveToUse = Moves.SPLASH;
game.override.battleStyle("single"); game.override
game.override.starterSpecies(Species.MEWTWO); .battleStyle("single")
game.override.enemySpecies(Species.RATTATA); .starterSpecies(Species.MEWTWO)
game.override.enemyAbility(Abilities.HYDRATION); .enemySpecies(Species.RATTATA)
game.override.ability(Abilities.ZEN_MODE); .enemyAbility(Abilities.HYDRATION)
game.override.startingLevel(2000); .ability(Abilities.ZEN_MODE)
game.override.startingWave(3); .startingLevel(2000)
game.override.moveset([moveToUse]); .startingWave(3)
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); .moveset([moveToUse])
.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.classicMode.startBattle([Species.DARMANITAN, Species.CHARIZARD]); await game.classicMode.startBattle([Species.DARMANITAN, Species.CHARIZARD]);
game.move.select(moveToUse); game.move.select(moveToUse);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.killPokemon(game.scene.currentBattle.enemyParty[0]); await game.killPokemon(game.scene.currentBattle.enemyParty[0]);
expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true); expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true);
await game.phaseInterceptor.to(VictoryPhase, false); await game.phaseInterceptor.to("VictoryPhase");
}, 200000); });
it("to next turn", async () => { it("to next turn", async () => {
const moveToUse = Moves.SPLASH; const moveToUse = Moves.SPLASH;
game.override.battleStyle("single"); game.override
game.override.starterSpecies(Species.MEWTWO); .battleStyle("single")
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.enemyAbility(Abilities.HYDRATION); .enemyAbility(Abilities.HYDRATION)
game.override.ability(Abilities.ZEN_MODE); .ability(Abilities.ZEN_MODE)
game.override.startingLevel(2000); .startingLevel(2000)
game.override.startingWave(3); .startingWave(3)
game.override.moveset([moveToUse]); .moveset([moveToUse])
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); .enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.MEWTWO]);
const turn = game.scene.currentBattle.turn; const turn = game.scene.currentBattle.turn;
game.move.select(moveToUse); game.move.select(moveToUse);
await game.toNextTurn(); await game.toNextTurn();
@ -293,8 +292,8 @@ describe("Test Battle Phase", () => {
.startingLevel(2000) .startingLevel(2000)
.startingWave(3) .startingWave(3)
.startingBiome(Biome.LAKE) .startingBiome(Biome.LAKE)
.moveset([moveToUse]); .moveset([moveToUse])
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); .enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const waveIndex = game.scene.currentBattle.waveIndex; const waveIndex = game.scene.currentBattle.waveIndex;
game.move.select(moveToUse); game.move.select(moveToUse);

View File

@ -262,8 +262,7 @@ describe("Escape chance calculations", () => {
}, 20000); }, 20000);
it("double boss opponent", async () => { it("double boss opponent", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").startingWave(10);
game.override.startingWave(10);
await game.classicMode.startBattle([Species.BULBASAUR, Species.ABOMASNOW]); await game.classicMode.startBattle([Species.BULBASAUR, Species.ABOMASNOW]);
const playerPokemon = game.scene.getPlayerField(); const playerPokemon = game.scene.getPlayerField();

View File

@ -28,12 +28,11 @@ describe("Evolution", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.enemySpecies(Species.MAGIKARP); .enemySpecies(Species.MAGIKARP)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyAbility(Abilities.BALL_FETCH)
.startingLevel(60);
game.override.startingLevel(60);
}); });
it("should keep hidden ability after evolving", async () => { it("should keep hidden ability after evolving", async () => {

View File

@ -82,9 +82,7 @@ describe("Spec - Pokemon", () => {
let scene: BattleScene; let scene: BattleScene;
beforeEach(async () => { beforeEach(async () => {
game.override.enemySpecies(Species.ZUBAT); game.override.enemySpecies(Species.ZUBAT).starterSpecies(Species.ABRA).enableStarterFusion();
game.override.starterSpecies(Species.ABRA);
game.override.enableStarterFusion();
scene = game.scene; scene = game.scene;
}); });
@ -140,8 +138,7 @@ describe("Spec - Pokemon", () => {
}); });
it("Fusing mons with one and two types", async () => { it("Fusing mons with one and two types", async () => {
game.override.starterSpecies(Species.CHARMANDER); game.override.starterSpecies(Species.CHARMANDER).starterFusionSpecies(Species.HOUNDOUR);
game.override.starterFusionSpecies(Species.HOUNDOUR);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const pokemon = scene.getPlayerParty()[0]; const pokemon = scene.getPlayerParty()[0];
@ -151,8 +148,7 @@ describe("Spec - Pokemon", () => {
}); });
it("Fusing mons with two and one types", async () => { it("Fusing mons with two and one types", async () => {
game.override.starterSpecies(Species.NUMEL); game.override.starterSpecies(Species.NUMEL).starterFusionSpecies(Species.CHARMANDER);
game.override.starterFusionSpecies(Species.CHARMANDER);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const pokemon = scene.getPlayerParty()[0]; const pokemon = scene.getPlayerParty()[0];
@ -162,8 +158,7 @@ describe("Spec - Pokemon", () => {
}); });
it("Fusing two mons with two types", async () => { it("Fusing two mons with two types", async () => {
game.override.starterSpecies(Species.NATU); game.override.starterSpecies(Species.NATU).starterFusionSpecies(Species.HOUNDOUR);
game.override.starterFusionSpecies(Species.HOUNDOUR);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const pokemon = scene.getPlayerParty()[0]; const pokemon = scene.getPlayerParty()[0];

View File

@ -22,9 +22,7 @@ describe("EXP Modifier Items", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyAbility(Abilities.BALL_FETCH).ability(Abilities.BALL_FETCH).battleStyle("single");
game.override.ability(Abilities.BALL_FETCH);
game.override.battleStyle("single");
}); });
it("EXP booster items stack multiplicatively", async () => { it("EXP booster items stack multiplicatively", async () => {

View File

@ -24,16 +24,14 @@ describe("Moves - Baneful Bunker", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.moveset(Moves.SLASH); .moveset(Moves.SLASH)
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .enemyMoveset(Moves.BANEFUL_BUNKER)
game.override.enemyMoveset(Moves.BANEFUL_BUNKER); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user and poison attackers that make contact", async () => { test("should protect the user and poison attackers that make contact", async () => {
await game.classicMode.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);

View File

@ -59,28 +59,23 @@ describe("Moves - Baton Pass", () => {
it("passes stat stage buffs when AI uses it", async () => { it("passes stat stage buffs when AI uses it", async () => {
// arrange // arrange
game.override.startingWave(5).enemyMoveset(new Array(4).fill([Moves.NASTY_PLOT])); game.override.startingWave(5).enemyMoveset([Moves.NASTY_PLOT, Moves.BATON_PASS]);
await game.classicMode.startBattle([Species.RAICHU, Species.SHUCKLE]); await game.classicMode.startBattle([Species.RAICHU, Species.SHUCKLE]);
// round 1 - ai buffs // round 1 - ai buffs
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.NASTY_PLOT);
await game.toNextTurn(); await game.toNextTurn();
// round 2 - baton pass // round 2 - baton pass
game.scene.getEnemyPokemon()!.hp = 100;
game.override.enemyMoveset([Moves.BATON_PASS]);
// Force moveset to update mid-battle
// TODO: replace with enemy ai control function when it's added
game.scene.getEnemyParty()[0].getMoveset();
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.BATON_PASS);
await game.phaseInterceptor.to("PostSummonPhase", false); await game.phaseInterceptor.to("PostSummonPhase", false);
// assert
// check buffs are still there // check buffs are still there
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.SPATK)).toEqual(2); expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.SPATK)).toEqual(2);
// confirm that a switch actually happened. can't use species because I // confirm that a switch actually happened. can't use species because I
// can't find a way to override trainer parties with more than 1 pokemon species // can't find a way to override trainer parties with more than 1 pokemon species
expect(game.scene.getEnemyPokemon()!.hp).not.toEqual(100);
expect(game.phaseInterceptor.log.slice(-4)).toEqual([ expect(game.phaseInterceptor.log.slice(-4)).toEqual([
"MoveEffectPhase", "MoveEffectPhase",
"SwitchSummonPhase", "SwitchSummonPhase",

View File

@ -129,8 +129,7 @@ describe("Moves - Beak Blast", () => {
}); });
it("should not burn a long reach enemy that hits the user with a contact move", async () => { it("should not burn a long reach enemy that hits the user with a contact move", async () => {
game.override.enemyAbility(Abilities.LONG_REACH); game.override.enemyAbility(Abilities.LONG_REACH).enemyMoveset([Moves.FALSE_SWIPE]).enemyLevel(100);
game.override.enemyMoveset([Moves.FALSE_SWIPE]).enemyLevel(100);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.BEAK_BLAST); game.move.select(Moves.BEAK_BLAST);
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);

View File

@ -23,15 +23,14 @@ describe("Moves - Beat Up", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.enemySpecies(Species.SNORLAX); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .enemyLevel(100)
game.override.enemyMoveset([Moves.SPLASH]); .enemyMoveset([Moves.SPLASH])
game.override.enemyAbility(Abilities.INSOMNIA); .enemyAbility(Abilities.INSOMNIA)
.startingLevel(100)
game.override.startingLevel(100); .moveset([Moves.BEAT_UP]);
game.override.moveset([Moves.BEAT_UP]);
}); });
it("should hit once for each healthy player Pokemon", async () => { it("should hit once for each healthy player Pokemon", async () => {

View File

@ -26,14 +26,15 @@ describe("Moves - Ceaseless Edge", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.RATTATA); .battleStyle("single")
game.override.enemyAbility(Abilities.RUN_AWAY); .enemySpecies(Species.RATTATA)
game.override.enemyPassiveAbility(Abilities.RUN_AWAY); .enemyAbility(Abilities.RUN_AWAY)
game.override.startingLevel(100); .enemyPassiveAbility(Abilities.RUN_AWAY)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR]); .enemyLevel(100)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR])
.enemyMoveset(Moves.SPLASH);
vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100);
}); });
@ -81,8 +82,7 @@ describe("Moves - Ceaseless Edge", () => {
}); });
test("trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => { test("trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => {
game.override.startingHeldItems([{ name: "MULTI_LENS" }]); game.override.startingHeldItems([{ name: "MULTI_LENS" }]).startingWave(25);
game.override.startingWave(25);
await game.classicMode.startBattle([Species.ILLUMISE]); await game.classicMode.startBattle([Species.ILLUMISE]);

View File

@ -27,12 +27,13 @@ describe("Moves - Clangorous Soul", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.starterSpecies(Species.MAGIKARP); game.override
game.override.enemySpecies(Species.SNORLAX); .starterSpecies(Species.MAGIKARP)
game.override.startingLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.CLANGOROUS_SOUL]); .enemyLevel(100)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.CLANGOROUS_SOUL])
.enemyMoveset(Moves.SPLASH);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Clangorous_Soul_(move) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Clangorous_Soul_(move)

View File

@ -26,16 +26,14 @@ describe("Moves - Crafty Shield", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
.battleStyle("double")
game.override.moveset([Moves.CRAFTY_SHIELD, Moves.SPLASH, Moves.SWORDS_DANCE]); .moveset([Moves.CRAFTY_SHIELD, Moves.SPLASH, Moves.SWORDS_DANCE])
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset([Moves.GROWL])
game.override.enemyMoveset([Moves.GROWL]); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user and allies from status moves", async () => { test("should protect the user and allies from status moves", async () => {
@ -73,8 +71,7 @@ describe("Moves - Crafty Shield", () => {
}); });
test("should protect the user and allies from moves that ignore other protection", async () => { test("should protect the user and allies from moves that ignore other protection", async () => {
game.override.enemySpecies(Species.DUSCLOPS); game.override.enemySpecies(Species.DUSCLOPS).enemyMoveset([Moves.CURSE]);
game.override.enemyMoveset([Moves.CURSE]);
await game.classicMode.startBattle([Species.CHARIZARD, Species.BLASTOISE]); await game.classicMode.startBattle([Species.CHARIZARD, Species.BLASTOISE]);

View File

@ -31,19 +31,18 @@ describe("Moves - Dragon Rage", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.starterSpecies(Species.SNORLAX); .starterSpecies(Species.SNORLAX)
game.override.moveset([Moves.DRAGON_RAGE]); .moveset([Moves.DRAGON_RAGE])
game.override.ability(Abilities.BALL_FETCH); .ability(Abilities.BALL_FETCH)
game.override.passiveAbility(Abilities.BALL_FETCH); .passiveAbility(Abilities.BALL_FETCH)
game.override.startingLevel(100); .startingLevel(100)
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset(Moves.SPLASH)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyPassiveAbility(Abilities.BALL_FETCH)
game.override.enemyPassiveAbility(Abilities.BALL_FETCH); .enemyLevel(100);
game.override.enemyLevel(100);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -101,8 +100,7 @@ describe("Moves - Dragon Rage", () => {
}); });
it("ignores damage modification from abilities, for example ICE_SCALES", async () => { it("ignores damage modification from abilities, for example ICE_SCALES", async () => {
game.override.disableCrits(); game.override.disableCrits().enemyAbility(Abilities.ICE_SCALES);
game.override.enemyAbility(Abilities.ICE_SCALES);
game.move.select(Moves.DRAGON_RAGE); game.move.select(Moves.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -38,15 +38,7 @@ describe("Moves - Dynamax Cannon", () => {
.enemySpecies(Species.MAGIKARP) .enemySpecies(Species.MAGIKARP)
.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH);
// Note that, for Waves 1-10, the level cap is 10 vi.spyOn(allMoves[Moves.DYNAMAX_CANNON], "calculateBattlePower");
game.override.startingWave(1);
game.override.battleStyle("single");
game.override.disableCrits();
game.override.enemySpecies(Species.MAGIKARP);
game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
vi.spyOn(dynamaxCannon, "calculateBattlePower");
}); });
it("should return 100 power against an enemy below level cap", async () => { it("should return 100 power against an enemy below level cap", async () => {

View File

@ -28,12 +28,13 @@ describe("Moves - FILLET AWAY", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.starterSpecies(Species.MAGIKARP); game.override
game.override.enemySpecies(Species.SNORLAX); .starterSpecies(Species.MAGIKARP)
game.override.startingLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.FILLET_AWAY]); .enemyLevel(100)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.FILLET_AWAY])
.enemyMoveset(Moves.SPLASH);
}); });
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/fillet_away_(move) //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/fillet_away_(move)

View File

@ -28,18 +28,17 @@ describe("Moves - Fissure", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.disableCrits(); .battleStyle("single")
.disableCrits()
game.override.starterSpecies(Species.SNORLAX); .starterSpecies(Species.SNORLAX)
game.override.moveset([Moves.FISSURE]); .moveset([Moves.FISSURE])
game.override.passiveAbility(Abilities.BALL_FETCH); .passiveAbility(Abilities.BALL_FETCH)
game.override.startingLevel(100); .startingLevel(100)
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset(Moves.SPLASH)
game.override.enemyMoveset(Moves.SPLASH); .enemyPassiveAbility(Abilities.BALL_FETCH)
game.override.enemyPassiveAbility(Abilities.BALL_FETCH); .enemyLevel(100);
game.override.enemyLevel(100);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -48,8 +47,7 @@ describe("Moves - Fissure", () => {
}); });
it("ignores damage modification from abilities, for example FUR_COAT", async () => { it("ignores damage modification from abilities, for example FUR_COAT", async () => {
game.override.ability(Abilities.NO_GUARD); game.override.ability(Abilities.NO_GUARD).enemyAbility(Abilities.FUR_COAT);
game.override.enemyAbility(Abilities.FUR_COAT);
game.move.select(Moves.FISSURE); game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to(DamageAnimPhase, true); await game.phaseInterceptor.to(DamageAnimPhase, true);

View File

@ -35,14 +35,15 @@ describe("Moves - Flame Burst", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.moveset([Moves.FLAME_BURST, Moves.SPLASH]); .battleStyle("double")
game.override.disableCrits(); .moveset([Moves.FLAME_BURST, Moves.SPLASH])
game.override.ability(Abilities.UNNERVE); .disableCrits()
game.override.startingWave(4); .ability(Abilities.UNNERVE)
game.override.enemySpecies(Species.SHUCKLE); .startingWave(4)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.SHUCKLE)
game.override.enemyMoveset([Moves.SPLASH]); .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset([Moves.SPLASH]);
}); });
it("inflicts damage to the target's ally equal to 1/16 of its max HP", async () => { it("inflicts damage to the target's ally equal to 1/16 of its max HP", async () => {

View File

@ -26,11 +26,12 @@ describe("Moves - Flower Shield", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.ability(Abilities.NONE); game.override
game.override.enemyAbility(Abilities.NONE); .ability(Abilities.NONE)
game.override.battleStyle("single"); .enemyAbility(Abilities.NONE)
game.override.moveset([Moves.FLOWER_SHIELD, Moves.SPLASH]); .battleStyle("single")
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.FLOWER_SHIELD, Moves.SPLASH])
.enemyMoveset(Moves.SPLASH);
}); });
it("raises DEF stat stage by 1 for all Grass-type Pokemon on the field by one stage - single battle", async () => { it("raises DEF stat stage by 1 for all Grass-type Pokemon on the field by one stage - single battle", async () => {

View File

@ -24,14 +24,15 @@ describe("Moves - Follow Me", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.starterSpecies(Species.AMOONGUSS); .battleStyle("double")
game.override.ability(Abilities.BALL_FETCH); .starterSpecies(Species.AMOONGUSS)
game.override.enemySpecies(Species.SNORLAX); .ability(Abilities.BALL_FETCH)
game.override.startingLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK]); .enemyLevel(100)
game.override.enemyMoveset([Moves.TACKLE, Moves.FOLLOW_ME, Moves.SPLASH]); .moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK])
.enemyMoveset([Moves.TACKLE, Moves.FOLLOW_ME, Moves.SPLASH]);
}); });
test("move should redirect enemy attacks to the user", async () => { test("move should redirect enemy attacks to the user", async () => {
@ -73,8 +74,7 @@ describe("Moves - Follow Me", () => {
}); });
test("move effect should be bypassed by Stalwart", async () => { test("move effect should be bypassed by Stalwart", async () => {
game.override.ability(Abilities.STALWART); game.override.ability(Abilities.STALWART).moveset([Moves.QUICK_ATTACK]);
game.override.moveset([Moves.QUICK_ATTACK]);
await game.classicMode.startBattle([Species.AMOONGUSS, Species.CHARIZARD]); await game.classicMode.startBattle([Species.AMOONGUSS, Species.CHARIZARD]);

View File

@ -22,14 +22,15 @@ describe("Moves - Gastro Acid", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.startingLevel(1); .battleStyle("double")
game.override.enemyLevel(100); .startingLevel(1)
game.override.ability(Abilities.BALL_FETCH); .enemyLevel(100)
game.override.moveset([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); .ability(Abilities.NONE)
game.override.enemySpecies(Species.BIDOOF); .moveset([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER])
game.override.enemyMoveset(Moves.SPLASH); .enemySpecies(Species.BIDOOF)
game.override.enemyAbility(Abilities.WATER_ABSORB); .enemyMoveset(Moves.SPLASH)
.enemyAbility(Abilities.WATER_ABSORB);
}); });
it("suppresses effect of ability", async () => { it("suppresses effect of ability", async () => {

View File

@ -28,13 +28,12 @@ describe("Moves - Glaive Rush", () => {
.enemySpecies(Species.MAGIKARP) .enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset([Moves.GLAIVE_RUSH]) .enemyMoveset([Moves.GLAIVE_RUSH])
.starterSpecies(Species.KLINK)
.ability(Abilities.BALL_FETCH) .ability(Abilities.BALL_FETCH)
.moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); .moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]);
}); });
it("takes double damage from attacks", async () => { it("takes double damage from attacks", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.KLINK]);
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
enemy.hp = 1000; enemy.hp = 1000;
@ -49,7 +48,7 @@ describe("Moves - Glaive Rush", () => {
}); });
it("always gets hit by attacks", async () => { it("always gets hit by attacks", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.KLINK]);
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
enemy.hp = 1000; enemy.hp = 1000;
@ -62,7 +61,7 @@ describe("Moves - Glaive Rush", () => {
it("interacts properly with multi-lens", async () => { it("interacts properly with multi-lens", async () => {
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }]).enemyMoveset([Moves.AVALANCHE]); game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }]).enemyMoveset([Moves.AVALANCHE]);
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.KLINK]);
const player = game.scene.getPlayerPokemon()!; const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
@ -82,7 +81,7 @@ describe("Moves - Glaive Rush", () => {
it("secondary effects only last until next move", async () => { it("secondary effects only last until next move", async () => {
game.override.enemyMoveset([Moves.SHADOW_SNEAK]); game.override.enemyMoveset([Moves.SHADOW_SNEAK]);
await game.classicMode.startBattle(); await game.classicMode.startBattle([Species.KLINK]);
const player = game.scene.getPlayerPokemon()!; const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
@ -106,7 +105,7 @@ describe("Moves - Glaive Rush", () => {
}); });
it("secondary effects are removed upon switching", async () => { it("secondary effects are removed upon switching", async () => {
game.override.enemyMoveset([Moves.SHADOW_SNEAK]).starterSpecies(0); game.override.enemyMoveset([Moves.SHADOW_SNEAK]);
await game.classicMode.startBattle([Species.KLINK, Species.FEEBAS]); await game.classicMode.startBattle([Species.KLINK, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon()!; const player = game.scene.getPlayerPokemon()!;
@ -127,8 +126,10 @@ describe("Moves - Glaive Rush", () => {
}); });
it("secondary effects don't activate if move fails", async () => { it("secondary effects don't activate if move fails", async () => {
game.override.moveset([Moves.SHADOW_SNEAK, Moves.PROTECT, Moves.SPLASH, Moves.GLAIVE_RUSH]); game.override
await game.classicMode.startBattle(); .moveset([Moves.SHADOW_SNEAK, Moves.PROTECT, Moves.SPLASH, Moves.GLAIVE_RUSH])
.enemyMoveset([Moves.GLAIVE_RUSH, Moves.SPLASH]);
await game.classicMode.startBattle([Species.KLINK]);
const player = game.scene.getPlayerPokemon()!; const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
@ -137,15 +138,17 @@ describe("Moves - Glaive Rush", () => {
player.hp = 1000; player.hp = 1000;
game.move.select(Moves.PROTECT); game.move.select(Moves.PROTECT);
await game.forceEnemyMove(Moves.GLAIVE_RUSH);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
game.move.select(Moves.SHADOW_SNEAK); game.move.select(Moves.SHADOW_SNEAK);
await game.forceEnemyMove(Moves.GLAIVE_RUSH);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
game.override.enemyMoveset([Moves.SPLASH]);
const damagedHP1 = 1000 - enemy.hp; const damagedHP1 = 1000 - enemy.hp;
enemy.hp = 1000; enemy.hp = 1000;
game.move.select(Moves.SHADOW_SNEAK); game.move.select(Moves.SHADOW_SNEAK);
await game.forceEnemyMove(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
const damagedHP2 = 1000 - enemy.hp; const damagedHP2 = 1000 - enemy.hp;

View File

@ -24,11 +24,12 @@ describe("Moves - Growth", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemyAbility(Abilities.MOXIE); .battleStyle("single")
game.override.ability(Abilities.INSOMNIA); .enemyAbility(Abilities.MOXIE)
game.override.moveset([Moves.GROWTH]); .ability(Abilities.INSOMNIA)
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.GROWTH])
.enemyMoveset(Moves.SPLASH);
}); });
it("should raise SPATK stat stage by 1", async () => { it("should raise SPATK stat stage by 1", async () => {

View File

@ -27,12 +27,13 @@ describe("Moves - Hard Press", () => {
beforeEach(() => { beforeEach(() => {
moveToCheck = allMoves[Moves.HARD_PRESS]; moveToCheck = allMoves[Moves.HARD_PRESS];
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.ability(Abilities.BALL_FETCH); .battleStyle("single")
game.override.enemySpecies(Species.MUNCHLAX); .ability(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.MUNCHLAX)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.BALL_FETCH)
game.override.moveset([Moves.HARD_PRESS]); .enemyMoveset(Moves.SPLASH)
.moveset([Moves.HARD_PRESS]);
vi.spyOn(moveToCheck, "calculateBattlePower"); vi.spyOn(moveToCheck, "calculateBattlePower");
}); });

View File

@ -23,16 +23,15 @@ describe("Moves - Haze", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.enemyLevel(100); .enemyLevel(100)
game.override.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.NONE); .enemyAbility(Abilities.BALL_FETCH)
.startingLevel(100)
game.override.startingLevel(100); .moveset([Moves.HAZE, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH])
game.override.moveset([Moves.HAZE, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH]); .ability(Abilities.BALL_FETCH);
game.override.ability(Abilities.NONE);
}); });
it("should reset all stat changes of all Pokemon on field", async () => { it("should reset all stat changes of all Pokemon on field", async () => {

View File

@ -26,14 +26,14 @@ describe("Moves - Hyper Beam", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.ability(Abilities.BALL_FETCH); .battleStyle("single")
game.override.enemySpecies(Species.SNORLAX); .ability(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.SNORLAX)
game.override.enemyMoveset([Moves.SPLASH]); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyLevel(100); .enemyMoveset([Moves.SPLASH])
.enemyLevel(100)
game.override.moveset([Moves.HYPER_BEAM, Moves.TACKLE]); .moveset([Moves.HYPER_BEAM, Moves.TACKLE]);
vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100);
}); });

View File

@ -22,14 +22,13 @@ describe("Moves - Lunar Blessing", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
.battleStyle("double")
game.override.enemySpecies(Species.SHUCKLE); .enemySpecies(Species.SHUCKLE)
game.override.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemyAbility(Abilities.BALL_FETCH)
.moveset([Moves.LUNAR_BLESSING, Moves.SPLASH])
game.override.moveset([Moves.LUNAR_BLESSING, Moves.SPLASH]); .ability(Abilities.BALL_FETCH);
game.override.ability(Abilities.BALL_FETCH);
}); });
it("should restore 25% HP of the user and its ally", async () => { it("should restore 25% HP of the user and its ally", async () => {

View File

@ -56,8 +56,7 @@ describe("Moves - Magic Coat", () => {
}); });
it("should not reflect moves used on the next turn", async () => { it("should not reflect moves used on the next turn", async () => {
game.override.moveset([Moves.GROWL, Moves.SPLASH]); game.override.moveset([Moves.GROWL, Moves.SPLASH]).enemyMoveset([Moves.MAGIC_COAT, Moves.SPLASH]);
game.override.enemyMoveset([Moves.MAGIC_COAT, Moves.SPLASH]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
// turn 1 // turn 1
@ -82,8 +81,7 @@ describe("Moves - Magic Coat", () => {
}); });
it("should individually bounce back multi-target moves when used by both targets in doubles", async () => { it("should individually bounce back multi-target moves when used by both targets in doubles", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.GROWL, Moves.SPLASH]);
game.override.moveset([Moves.GROWL, Moves.SPLASH]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.move.select(Moves.GROWL, 0); game.move.select(Moves.GROWL, 0);
@ -95,9 +93,10 @@ describe("Moves - Magic Coat", () => {
}); });
it("should bounce back a spread status move against both pokemon", async () => { it("should bounce back a spread status move against both pokemon", async () => {
game.override.battleStyle("double"); game.override
game.override.moveset([Moves.GROWL, Moves.SPLASH]); .battleStyle("double")
game.override.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]); .moveset([Moves.GROWL, Moves.SPLASH])
.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.move.select(Moves.GROWL, 0); game.move.select(Moves.GROWL, 0);
@ -121,10 +120,11 @@ describe("Moves - Magic Coat", () => {
}); });
it("should not bounce back a move that was just bounced", async () => { it("should not bounce back a move that was just bounced", async () => {
game.override.battleStyle("double"); game.override
game.override.ability(Abilities.MAGIC_BOUNCE); .battleStyle("double")
game.override.moveset([Moves.GROWL, Moves.MAGIC_COAT]); .ability(Abilities.MAGIC_BOUNCE)
game.override.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]); .moveset([Moves.GROWL, Moves.MAGIC_COAT])
.enemyMoveset([Moves.SPLASH, Moves.MAGIC_COAT]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
game.move.select(Moves.MAGIC_COAT, 0); game.move.select(Moves.MAGIC_COAT, 0);
@ -147,8 +147,7 @@ describe("Moves - Magic Coat", () => {
}); });
it("should still bounce back a move from a mold breaker user", async () => { it("should still bounce back a move from a mold breaker user", async () => {
game.override.ability(Abilities.MOLD_BREAKER); game.override.ability(Abilities.MOLD_BREAKER).moveset([Moves.GROWL]);
game.override.moveset([Moves.GROWL]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.GROWL); game.move.select(Moves.GROWL);
@ -159,9 +158,8 @@ describe("Moves - Magic Coat", () => {
}); });
it("should only bounce spikes back once when both targets use magic coat in doubles", async () => { it("should only bounce spikes back once when both targets use magic coat in doubles", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double").moveset([Moves.SPIKES]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.override.moveset([Moves.SPIKES]);
game.move.select(Moves.SPIKES); game.move.select(Moves.SPIKES);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
@ -171,9 +169,8 @@ describe("Moves - Magic Coat", () => {
}); });
it("should not bounce back curse", async () => { it("should not bounce back curse", async () => {
game.override.starterSpecies(Species.GASTLY);
await game.classicMode.startBattle([Species.GASTLY]);
game.override.moveset([Moves.CURSE]); game.override.moveset([Moves.CURSE]);
await game.classicMode.startBattle([Species.GASTLY]);
game.move.select(Moves.CURSE); game.move.select(Moves.CURSE);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
@ -183,9 +180,10 @@ describe("Moves - Magic Coat", () => {
// TODO: encore is failing if the last move was virtual. // TODO: encore is failing if the last move was virtual.
it.todo("should not cause the bounced move to count for encore", async () => { it.todo("should not cause the bounced move to count for encore", async () => {
game.override.moveset([Moves.GROWL, Moves.ENCORE]); game.override
game.override.enemyMoveset([Moves.MAGIC_COAT, Moves.TACKLE]); .moveset([Moves.GROWL, Moves.ENCORE])
game.override.enemyAbility(Abilities.MAGIC_BOUNCE); .enemyMoveset([Moves.MAGIC_COAT, Moves.TACKLE])
.enemyAbility(Abilities.MAGIC_BOUNCE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
@ -206,9 +204,8 @@ describe("Moves - Magic Coat", () => {
// TODO: stomping tantrum should consider moves that were bounced. // TODO: stomping tantrum should consider moves that were bounced.
it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single").moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.override.moveset([Moves.STOMPING_TANTRUM, Moves.CHARM]);
const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM]; const stomping_tantrum = allMoves[Moves.STOMPING_TANTRUM];
vi.spyOn(stomping_tantrum, "calculateBattlePower"); vi.spyOn(stomping_tantrum, "calculateBattlePower");
@ -249,8 +246,7 @@ describe("Moves - Magic Coat", () => {
it("should respect immunities when bouncing a move", async () => { it("should respect immunities when bouncing a move", async () => {
vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100);
game.override.moveset([Moves.THUNDER_WAVE, Moves.GROWL]); game.override.moveset([Moves.THUNDER_WAVE, Moves.GROWL]).ability(Abilities.SOUNDPROOF);
game.override.ability(Abilities.SOUNDPROOF);
await game.classicMode.startBattle([Species.PHANPY]); await game.classicMode.startBattle([Species.PHANPY]);
// Turn 1 - thunder wave immunity test // Turn 1 - thunder wave immunity test

View File

@ -24,13 +24,14 @@ describe("Moves - Make It Rain", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.moveset([Moves.MAKE_IT_RAIN, Moves.SPLASH]); .battleStyle("double")
game.override.enemySpecies(Species.SNORLAX); .moveset([Moves.MAKE_IT_RAIN, Moves.SPLASH])
game.override.enemyAbility(Abilities.INSOMNIA); .enemySpecies(Species.SNORLAX)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.INSOMNIA)
game.override.startingLevel(100); .enemyMoveset(Moves.SPLASH)
game.override.enemyLevel(100); .startingLevel(100)
.enemyLevel(100);
}); });
it("should only lower SPATK stat stage by 1 once in a double battle", async () => { it("should only lower SPATK stat stage by 1 once in a double battle", async () => {
@ -47,8 +48,9 @@ describe("Moves - Make It Rain", () => {
}); });
it("should apply effects even if the target faints", async () => { it("should apply effects even if the target faints", async () => {
game.override.enemyLevel(1); // ensures the enemy will faint game.override
game.override.battleStyle("single"); .enemyLevel(1) // ensures the enemy will faint
.battleStyle("single");
await game.classicMode.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);

View File

@ -26,16 +26,14 @@ describe("Moves - Mat Block", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
.battleStyle("double")
game.override.moveset([Moves.MAT_BLOCK, Moves.SPLASH]); .moveset([Moves.MAT_BLOCK, Moves.SPLASH])
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset([Moves.TACKLE])
game.override.enemyMoveset([Moves.TACKLE]); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user and allies from attack moves", async () => { test("should protect the user and allies from attack moves", async () => {

View File

@ -26,11 +26,12 @@ describe("Moves - Parting Shot", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.moveset([Moves.PARTING_SHOT, Moves.SPLASH]); .battleStyle("single")
game.override.enemyMoveset(Moves.SPLASH); .moveset([Moves.PARTING_SHOT, Moves.SPLASH])
game.override.startingLevel(5); .enemyMoveset(Moves.SPLASH)
game.override.enemyLevel(5); .startingLevel(5)
.enemyLevel(5);
}); });
test("Parting Shot when buffed by prankster should fail against dark types", async () => { test("Parting Shot when buffed by prankster should fail against dark types", async () => {

View File

@ -27,9 +27,8 @@ describe("Moves - Powder", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single");
game.override game.override
.battleStyle("single")
.enemySpecies(Species.SNORLAX) .enemySpecies(Species.SNORLAX)
.enemyLevel(100) .enemyLevel(100)
.enemyMoveset(Moves.EMBER) .enemyMoveset(Moves.EMBER)

View File

@ -27,16 +27,14 @@ describe("Moves - Protect", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.moveset([Moves.PROTECT]); .moveset([Moves.PROTECT])
game.override.enemySpecies(Species.SNORLAX); .enemySpecies(Species.SNORLAX)
.enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .enemyMoveset([Moves.TACKLE])
game.override.enemyMoveset([Moves.TACKLE]); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user from attacks", async () => { test("should protect the user from attacks", async () => {

View File

@ -25,15 +25,14 @@ describe("Moves - Purify", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.starterSpecies(Species.PYUKUMUKU); .starterSpecies(Species.PYUKUMUKU)
game.override.startingLevel(10); .startingLevel(10)
game.override.moveset([Moves.PURIFY, Moves.SIZZLY_SLIDE]); .moveset([Moves.PURIFY, Moves.SIZZLY_SLIDE])
.enemySpecies(Species.MAGIKARP)
game.override.enemySpecies(Species.MAGIKARP); .enemyLevel(10)
game.override.enemyLevel(10); .enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]);
game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]);
}); });
test("Purify heals opponent status effect and restores user hp", async () => { test("Purify heals opponent status effect and restores user hp", async () => {

View File

@ -25,16 +25,14 @@ describe("Moves - Quick Guard", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
.battleStyle("double")
game.override.moveset([Moves.QUICK_GUARD, Moves.SPLASH, Moves.FOLLOW_ME]); .moveset([Moves.QUICK_GUARD, Moves.SPLASH, Moves.FOLLOW_ME])
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset([Moves.QUICK_ATTACK])
game.override.enemyMoveset([Moves.QUICK_ATTACK]); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user and allies from priority moves", async () => { test("should protect the user and allies from priority moves", async () => {
@ -51,8 +49,7 @@ describe("Moves - Quick Guard", () => {
}); });
test("should protect the user and allies from Prankster-boosted moves", async () => { test("should protect the user and allies from Prankster-boosted moves", async () => {
game.override.enemyAbility(Abilities.PRANKSTER); game.override.enemyAbility(Abilities.PRANKSTER).enemyMoveset([Moves.GROWL]);
game.override.enemyMoveset([Moves.GROWL]);
await game.classicMode.startBattle([Species.CHARIZARD, Species.BLASTOISE]); await game.classicMode.startBattle([Species.CHARIZARD, Species.BLASTOISE]);
@ -84,8 +81,7 @@ describe("Moves - Quick Guard", () => {
}); });
test("should fail if the user is the last to move in the turn", async () => { test("should fail if the user is the last to move in the turn", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single").enemyMoveset([Moves.QUICK_GUARD]);
game.override.enemyMoveset([Moves.QUICK_GUARD]);
await game.classicMode.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);

View File

@ -22,12 +22,13 @@ describe("Moves - Rage Powder", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.enemySpecies(Species.SNORLAX); .battleStyle("double")
game.override.startingLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK]); .enemyLevel(100)
game.override.enemyMoveset([Moves.RAGE_POWDER, Moves.TACKLE, Moves.SPLASH]); .moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK])
.enemyMoveset([Moves.RAGE_POWDER, Moves.TACKLE, Moves.SPLASH]);
}); });
test("move effect should be bypassed by Grass type", async () => { test("move effect should be bypassed by Grass type", async () => {

View File

@ -23,18 +23,19 @@ describe("Moves - Rollout", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.disableCrits(); game.override
game.override.battleStyle("single"); .disableCrits()
game.override.starterSpecies(Species.RATTATA); .battleStyle("single")
game.override.ability(Abilities.BALL_FETCH); .starterSpecies(Species.RATTATA)
game.override.enemySpecies(Species.BIDOOF); .ability(Abilities.BALL_FETCH)
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.BIDOOF)
game.override.startingLevel(100); .enemyAbility(Abilities.BALL_FETCH)
game.override.enemyLevel(100); .startingLevel(100)
game.override.enemyMoveset(Moves.SPLASH); .enemyLevel(100)
.enemyMoveset(Moves.SPLASH);
}); });
it("should double it's dmg on sequential uses but reset after 5", async () => { it("should double its dmg on sequential uses but reset after 5", async () => {
game.override.moveset([Moves.ROLLOUT]); game.override.moveset([Moves.ROLLOUT]);
vi.spyOn(allMoves[Moves.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit vi.spyOn(allMoves[Moves.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit

View File

@ -25,12 +25,13 @@ describe("Moves - Roost", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.RELICANTH); .battleStyle("single")
game.override.startingLevel(100); .enemySpecies(Species.RELICANTH)
game.override.enemyLevel(100); .startingLevel(100)
game.override.enemyMoveset(Moves.EARTHQUAKE); .enemyLevel(100)
game.override.moveset([Moves.ROOST, Moves.BURN_UP, Moves.DOUBLE_SHOCK]); .enemyMoveset(Moves.EARTHQUAKE)
.moveset([Moves.ROOST, Moves.BURN_UP, Moves.DOUBLE_SHOCK]);
}); });
/** /**

View File

@ -110,34 +110,32 @@ describe("Moves - Safeguard", () => {
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.toNextTurn(); await game.toNextTurn();
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP); expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP);
}); });
it("doesn't protect from self-inflicted via Rest or Flame Orb", async () => { it("doesn't protect from self-inflicted via Rest or Flame Orb", async () => {
game.override.enemyHeldItems([{ name: "FLAME_ORB" }]); game.override.enemyHeldItems([{ name: "FLAME_ORB" }]).enemyMoveset([Moves.SAFEGUARD, Moves.REST]);
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
enemyPokemon.hp = 1;
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.forceEnemyMove(Moves.SAFEGUARD);
await game.toNextTurn(); await game.toNextTurn();
enemyPokemon.damageAndUpdate(1);
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.BURN); expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
enemyPokemon.resetStatus();
game.override.enemyMoveset([Moves.REST]);
// Force the moveset to update mid-battle
// TODO: Remove after enemy AI rework is in
enemyPokemon.getMoveset();
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
enemyPokemon.damageAndUpdate(1); await game.forceEnemyMove(Moves.REST);
await game.toNextTurn(); await game.toNextTurn();
expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP); expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP);
}); });
it("protects from ability-inflicted status", async () => { it("protects from ability-inflicted status", async () => {
game.override.ability(Abilities.STATIC); game.override.ability(Abilities.STATIC).enemyMoveset([Moves.SAFEGUARD, Moves.TACKLE]);
vi.spyOn( vi.spyOn(
allAbilities[Abilities.STATIC].getAttrs(PostDefendContactApplyStatusEffectAbAttr)[0], allAbilities[Abilities.STATIC].getAttrs(PostDefendContactApplyStatusEffectAbAttr)[0],
"chance", "chance",
@ -147,10 +145,11 @@ describe("Moves - Safeguard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.forceEnemyMove(Moves.SAFEGUARD);
await game.toNextTurn(); await game.toNextTurn();
game.override.enemyMoveset([Moves.TACKLE]);
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.TACKLE);
await game.toNextTurn(); await game.toNextTurn();
expect(enemyPokemon.status).toBeUndefined(); expect(enemyPokemon.status).toBeUndefined();

View File

@ -80,9 +80,7 @@ describe("Moves - Spikes", () => {
}, 20000); }, 20000);
it("should work when all targets fainted", async () => { it("should work when all targets fainted", async () => {
game.override.enemySpecies(Species.DIGLETT); game.override.enemySpecies(Species.DIGLETT).battleStyle("double").startingLevel(50);
game.override.battleStyle("double");
game.override.startingLevel(50);
await game.classicMode.startBattle([Species.RAYQUAZA, Species.ROWLET]); await game.classicMode.startBattle([Species.RAYQUAZA, Species.ROWLET]);
game.move.select(Moves.EARTHQUAKE); game.move.select(Moves.EARTHQUAKE);

View File

@ -32,15 +32,14 @@ describe("Moves - Spit Up", () => {
spitUp = allMoves[Moves.SPIT_UP]; spitUp = allMoves[Moves.SPIT_UP];
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.NONE); .enemyAbility(Abilities.NONE)
game.override.enemyLevel(2000); .enemyLevel(2000)
.moveset(Moves.SPIT_UP)
game.override.moveset(new Array(4).fill(spitUp.id)); .ability(Abilities.NONE);
game.override.ability(Abilities.NONE);
vi.spyOn(spitUp, "calculateBattlePower"); vi.spyOn(spitUp, "calculateBattlePower");
}); });

View File

@ -22,13 +22,14 @@ describe("Moves - Spotlight", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
game.override.starterSpecies(Species.AMOONGUSS); .battleStyle("double")
game.override.enemySpecies(Species.SNORLAX); .starterSpecies(Species.AMOONGUSS)
game.override.startingLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK]); .enemyLevel(100)
game.override.enemyMoveset([Moves.FOLLOW_ME, Moves.SPLASH]); .moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK])
.enemyMoveset([Moves.FOLLOW_ME, Moves.SPLASH]);
}); });
test("move should redirect attacks to the target", async () => { test("move should redirect attacks to the target", async () => {

View File

@ -27,15 +27,14 @@ describe("Moves - Stockpile", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
.battleStyle("single")
game.override.enemySpecies(Species.RATTATA); .enemySpecies(Species.RATTATA)
game.override.enemyMoveset(Moves.SPLASH); .enemyMoveset(Moves.SPLASH)
game.override.enemyAbility(Abilities.NONE); .enemyAbility(Abilities.NONE)
.startingLevel(2000)
game.override.startingLevel(2000); .moveset([Moves.STOCKPILE, Moves.SPLASH])
game.override.moveset([Moves.STOCKPILE, Moves.SPLASH]); .ability(Abilities.NONE);
game.override.ability(Abilities.NONE);
}); });
it("gains a stockpile stack and raises user's DEF and SPDEF stat stages by 1 on each use, fails at max stacks (3)", async () => { it("gains a stockpile stack and raises user's DEF and SPDEF stat stages by 1 on each use, fails at max stacks (3)", async () => {

View File

@ -138,8 +138,7 @@ describe("Moves - Substitute", () => {
}); });
it("should be bypassed by attackers with Infiltrator", async () => { it("should be bypassed by attackers with Infiltrator", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).enemyAbility(Abilities.INFILTRATOR);
game.override.enemyAbility(Abilities.INFILTRATOR);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -230,8 +229,7 @@ describe("Moves - Substitute", () => {
}); });
it("should protect the user from flinching", async () => { it("should protect the user from flinching", async () => {
game.override.enemyMoveset(Moves.FAKE_OUT); game.override.enemyMoveset(Moves.FAKE_OUT).startingLevel(1); // Ensures the Substitute will break
game.override.startingLevel(1); // Ensures the Substitute will break
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -298,9 +296,8 @@ describe("Moves - Substitute", () => {
}); });
it("should prevent the user's items from being stolen", async () => { it("should prevent the user's items from being stolen", async () => {
game.override.enemyMoveset(Moves.THIEF); game.override.enemyMoveset(Moves.THIEF).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
vi.spyOn(allMoves[Moves.THIEF], "attrs", "get").mockReturnValue([new StealHeldItemChanceAttr(1.0)]); // give Thief 100% steal rate vi.spyOn(allMoves[Moves.THIEF], "attrs", "get").mockReturnValue([new StealHeldItemChanceAttr(1.0)]); // give Thief 100% steal rate
game.override.startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -316,8 +313,7 @@ describe("Moves - Substitute", () => {
}); });
it("should prevent the user's items from being removed", async () => { it("should prevent the user's items from being removed", async () => {
game.override.moveset([Moves.KNOCK_OFF]); game.override.moveset([Moves.KNOCK_OFF]).enemyHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
game.override.enemyHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -334,8 +330,7 @@ describe("Moves - Substitute", () => {
}); });
it("move effect should prevent the user's berries from being stolen and eaten", async () => { it("move effect should prevent the user's berries from being stolen and eaten", async () => {
game.override.enemyMoveset(Moves.BUG_BITE); game.override.enemyMoveset(Moves.BUG_BITE).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
game.override.startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -412,8 +407,7 @@ describe("Moves - Substitute", () => {
}); });
it("should prevent the source's Rough Skin from activating when hit", async () => { it("should prevent the source's Rough Skin from activating when hit", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).ability(Abilities.ROUGH_SKIN);
game.override.ability(Abilities.ROUGH_SKIN);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -427,8 +421,7 @@ describe("Moves - Substitute", () => {
}); });
it("should prevent the source's Focus Punch from failing when hit", async () => { it("should prevent the source's Focus Punch from failing when hit", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).moveset([Moves.FOCUS_PUNCH]);
game.override.moveset([Moves.FOCUS_PUNCH]);
// Make Focus Punch 40 power to avoid a KO // Make Focus Punch 40 power to avoid a KO
vi.spyOn(allMoves[Moves.FOCUS_PUNCH], "calculateBattlePower").mockReturnValue(40); vi.spyOn(allMoves[Moves.FOCUS_PUNCH], "calculateBattlePower").mockReturnValue(40);
@ -449,8 +442,7 @@ describe("Moves - Substitute", () => {
}); });
it("should not allow Shell Trap to activate when attacked", async () => { it("should not allow Shell Trap to activate when attacked", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).moveset([Moves.SHELL_TRAP]);
game.override.moveset([Moves.SHELL_TRAP]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -466,8 +458,7 @@ describe("Moves - Substitute", () => {
}); });
it("should not allow Beak Blast to burn opponents when hit", async () => { it("should not allow Beak Blast to burn opponents when hit", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).moveset([Moves.BEAK_BLAST]);
game.override.moveset([Moves.BEAK_BLAST]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);
@ -484,8 +475,7 @@ describe("Moves - Substitute", () => {
}); });
it("should cause incoming attacks to not activate Counter", async () => { it("should cause incoming attacks to not activate Counter", async () => {
game.override.enemyMoveset(Moves.TACKLE); game.override.enemyMoveset(Moves.TACKLE).moveset([Moves.COUNTER]);
game.override.moveset([Moves.COUNTER]);
await game.classicMode.startBattle([Species.BLASTOISE]); await game.classicMode.startBattle([Species.BLASTOISE]);

View File

@ -37,6 +37,7 @@ describe("Moves - Tackle", () => {
it("TACKLE against ghost", async () => { it("TACKLE against ghost", async () => {
const moveToUse = Moves.TACKLE; const moveToUse = Moves.TACKLE;
game.override.enemySpecies(Species.GENGAR); game.override.enemySpecies(Species.GENGAR);
await game.classicMode.startBattle([Species.MIGHTYENA]); await game.classicMode.startBattle([Species.MIGHTYENA]);
const hpOpponent = game.scene.currentBattle.enemyParty[0].hp; const hpOpponent = game.scene.currentBattle.enemyParty[0].hp;
game.move.select(moveToUse); game.move.select(moveToUse);

View File

@ -25,13 +25,14 @@ describe("Moves - Tail whip", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.TAIL_WHIP; const moveToUse = Moves.TAIL_WHIP;
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.RATTATA); .battleStyle("single")
game.override.enemyAbility(Abilities.INSOMNIA); .enemySpecies(Species.RATTATA)
game.override.ability(Abilities.INSOMNIA); .enemyAbility(Abilities.INSOMNIA)
game.override.startingLevel(2000); .ability(Abilities.INSOMNIA)
game.override.moveset([moveToUse]); .startingLevel(2000)
game.override.enemyMoveset(Moves.SPLASH); .moveset([moveToUse])
.enemyMoveset(Moves.SPLASH);
}); });
it("should lower DEF stat stage by 1", async () => { it("should lower DEF stat stage by 1", async () => {

View File

@ -24,12 +24,13 @@ describe("Moves - Thousand Arrows", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.TOGETIC); .battleStyle("single")
game.override.startingLevel(100); .enemySpecies(Species.TOGETIC)
game.override.enemyLevel(100); .startingLevel(100)
game.override.moveset([Moves.THOUSAND_ARROWS]); .enemyLevel(100)
game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); .moveset([Moves.THOUSAND_ARROWS])
.enemyMoveset(Moves.SPLASH);
}); });
it("move should hit and ground Flying-type targets", async () => { it("move should hit and ground Flying-type targets", async () => {
@ -50,8 +51,7 @@ describe("Moves - Thousand Arrows", () => {
}); });
it("move should hit and ground targets with Levitate", async () => { it("move should hit and ground targets with Levitate", async () => {
game.override.enemySpecies(Species.SNORLAX); game.override.enemySpecies(Species.SNORLAX).enemyAbility(Abilities.LEVITATE);
game.override.enemyAbility(Abilities.LEVITATE);
await game.classicMode.startBattle([Species.ILLUMISE]); await game.classicMode.startBattle([Species.ILLUMISE]);

View File

@ -26,14 +26,15 @@ describe("Moves - Tidy Up", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("single"); game.override
game.override.enemySpecies(Species.MAGIKARP); .battleStyle("single")
game.override.enemyAbility(Abilities.BALL_FETCH); .enemySpecies(Species.MAGIKARP)
game.override.enemyMoveset(Moves.SPLASH); .enemyAbility(Abilities.BALL_FETCH)
game.override.starterSpecies(Species.FEEBAS); .enemyMoveset(Moves.SPLASH)
game.override.ability(Abilities.BALL_FETCH); .starterSpecies(Species.FEEBAS)
game.override.moveset([Moves.TIDY_UP]); .ability(Abilities.BALL_FETCH)
game.override.startingLevel(50); .moveset([Moves.TIDY_UP])
.startingLevel(50);
}); });
it("spikes are cleared", async () => { it("spikes are cleared", async () => {

View File

@ -71,8 +71,7 @@ describe("Moves - Toxic", () => {
}); });
it("moves other than Toxic should not hit semi-invulnerable targets even if user is Poison-type", async () => { it("moves other than Toxic should not hit semi-invulnerable targets even if user is Poison-type", async () => {
game.override.moveset(Moves.SWIFT); game.override.moveset(Moves.SWIFT).enemyMoveset(Moves.FLY);
game.override.enemyMoveset(Moves.FLY);
await game.classicMode.startBattle([Species.TOXAPEX]); await game.classicMode.startBattle([Species.TOXAPEX]);
game.move.select(Moves.SWIFT); game.move.select(Moves.SWIFT);

View File

@ -154,8 +154,7 @@ describe("Moves - Transform", () => {
}); });
it("should stay transformed with the correct form after reload", async () => { it("should stay transformed with the correct form after reload", async () => {
game.override.enemyMoveset([]).moveset([]); game.override.enemyMoveset([]).moveset([]).enemySpecies(Species.DARMANITAN);
game.override.enemySpecies(Species.DARMANITAN);
await game.classicMode.startBattle([Species.DITTO]); await game.classicMode.startBattle([Species.DITTO]);

View File

@ -25,16 +25,14 @@ describe("Moves - Wide Guard", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleStyle("double"); game.override
.battleStyle("double")
game.override.moveset([Moves.WIDE_GUARD, Moves.SPLASH, Moves.SURF]); .moveset([Moves.WIDE_GUARD, Moves.SPLASH, Moves.SURF])
.enemySpecies(Species.SNORLAX)
game.override.enemySpecies(Species.SNORLAX); .enemyMoveset(Moves.SWIFT)
game.override.enemyMoveset([Moves.SWIFT]); .enemyAbility(Abilities.INSOMNIA)
game.override.enemyAbility(Abilities.INSOMNIA); .startingLevel(100)
.enemyLevel(100);
game.override.startingLevel(100);
game.override.enemyLevel(100);
}); });
test("should protect the user and allies from multi-target attack moves", async () => { test("should protect the user and allies from multi-target attack moves", async () => {

View File

@ -38,10 +38,11 @@ describe("A Trainer's Test - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
const biomeMap = new Map<Biome, MysteryEncounterType[]>([ const biomeMap = new Map<Biome, MysteryEncounterType[]>([
[Biome.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], [Biome.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]],

View File

@ -38,10 +38,11 @@ describe("Absolute Avarice - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([ new Map<Biome, MysteryEncounterType[]>([
@ -71,8 +72,7 @@ describe("Absolute Avarice - Mystery Encounter", () => {
}); });
it("should not spawn outside of proper biomes", async () => { it("should not spawn outside of proper biomes", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(Biome.VOLCANO);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter(); await game.runToMysteryEncounter();
expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.ABSOLUTE_AVARICE); expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.ABSOLUTE_AVARICE);
@ -87,8 +87,7 @@ describe("Absolute Avarice - Mystery Encounter", () => {
}); });
it("should spawn if player has enough berries", async () => { it("should spawn if player has enough berries", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingHeldItems([
game.override.startingHeldItems([
{ name: "BERRY", count: 2, type: BerryType.SITRUS }, { name: "BERRY", count: 2, type: BerryType.SITRUS },
{ name: "BERRY", count: 3, type: BerryType.GANLON }, { name: "BERRY", count: 3, type: BerryType.GANLON },
{ name: "BERRY", count: 2, type: BerryType.APICOT }, { name: "BERRY", count: 2, type: BerryType.APICOT },

View File

@ -79,8 +79,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
}); });
it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(Biome.VOLCANO);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter(); await game.runToMysteryEncounter();
expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe( expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(

View File

@ -116,20 +116,14 @@ const POOL_3_POKEMON: { species: Species; formIndex?: number }[] = [
const POOL_4_POKEMON = [Species.GENESECT, Species.SLITHER_WING, Species.BUZZWOLE, Species.PHEROMOSA]; const POOL_4_POKEMON = [Species.GENESECT, Species.SLITHER_WING, Species.BUZZWOLE, Species.PHEROMOSA];
const PHYSICAL_TUTOR_MOVES = [ const PHYSICAL_TUTOR_MOVES = [Moves.MEGAHORN, Moves.ATTACK_ORDER, Moves.BUG_BITE, Moves.FIRST_IMPRESSION, Moves.LUNGE];
Moves.MEGAHORN,
Moves.ATTACK_ORDER,
Moves.BUG_BITE,
Moves.FIRST_IMPRESSION,
Moves.LUNGE
];
const SPECIAL_TUTOR_MOVES = [ const SPECIAL_TUTOR_MOVES = [
Moves.SILVER_WIND, Moves.SILVER_WIND,
Moves.SIGNAL_BEAM, Moves.SIGNAL_BEAM,
Moves.BUG_BUZZ, Moves.BUG_BUZZ,
Moves.POLLEN_PUFF, Moves.POLLEN_PUFF,
Moves.STRUGGLE_BUG Moves.STRUGGLE_BUG,
]; ];
const STATUS_TUTOR_MOVES = [ const STATUS_TUTOR_MOVES = [
@ -137,16 +131,10 @@ const STATUS_TUTOR_MOVES = [
Moves.DEFEND_ORDER, Moves.DEFEND_ORDER,
Moves.RAGE_POWDER, Moves.RAGE_POWDER,
Moves.STICKY_WEB, Moves.STICKY_WEB,
Moves.SILK_TRAP Moves.SILK_TRAP,
]; ];
const MISC_TUTOR_MOVES = [ const MISC_TUTOR_MOVES = [Moves.LEECH_LIFE, Moves.U_TURN, Moves.HEAL_ORDER, Moves.QUIVER_DANCE, Moves.INFESTATION];
Moves.LEECH_LIFE,
Moves.U_TURN,
Moves.HEAL_ORDER,
Moves.QUIVER_DANCE,
Moves.INFESTATION,
];
describe("Bug-Type Superfan - Mystery Encounter", () => { describe("Bug-Type Superfan - Mystery Encounter", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -160,10 +148,11 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.BUG_TYPE_SUPERFAN]]]), new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.BUG_TYPE_SUPERFAN]]]),

View File

@ -55,10 +55,11 @@ describe("Clowning Around - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.CLOWNING_AROUND]]]), new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.CLOWNING_AROUND]]]),

View File

@ -41,10 +41,11 @@ describe("Dancing Lessons - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([ new Map<Biome, MysteryEncounterType[]>([
@ -74,8 +75,7 @@ describe("Dancing Lessons - Mystery Encounter", () => {
}); });
it("should not spawn outside of proper biomes", async () => { it("should not spawn outside of proper biomes", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(Biome.SPACE);
game.override.startingBiome(Biome.SPACE);
await game.runToMysteryEncounter(); await game.runToMysteryEncounter();
expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.DANCING_LESSONS); expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.DANCING_LESSONS);

View File

@ -46,10 +46,11 @@ describe("Delibird-y - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves();
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.DELIBIRDY]]]), new Map<Biome, MysteryEncounterType[]>([[Biome.CAVE, [MysteryEncounterType.DELIBIRDY]]]),

Some files were not shown because too many files have changed in this diff Show More