mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-14 22:05:34 +01:00
[Test] Fix even more game.scene.getXXX issues (#6811)
* [Test] Fixed even more `game.scene.getXXX` issues * Update fell-stinger.test.ts Co-authored-by: Fabi <192151969+fabske0@users.noreply.github.com> * Applied review comments * fixed doodle test inconsistencies * fix * applied reviews not going too ham will make another PR later --------- Co-authored-by: Fabi <192151969+fabske0@users.noreply.github.com>
This commit is contained in:
parent
507ac17f95
commit
8ae79450d4
@ -39,13 +39,14 @@ describe("Abilities - Own Tempo", () => {
|
||||
.moveset(MoveId.SKILL_SWAP)
|
||||
.enemyMoveset(MoveId.SPLASH);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
const enemy = game.scene.getEnemyPokemon();
|
||||
enemy?.addTag(BattlerTagType.CONFUSED);
|
||||
expect(enemy?.getTag(BattlerTagType.CONFUSED)).toBeTruthy();
|
||||
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
enemy.addTag(BattlerTagType.CONFUSED);
|
||||
expect(enemy).toHaveBattlerTag(BattlerTagType.CONFUSED);
|
||||
|
||||
game.move.select(MoveId.SKILL_SWAP);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemy?.getTag(BattlerTagType.CONFUSED)).toBeFalsy();
|
||||
expect(enemy).not.toHaveBattlerTag(BattlerTagType.CONFUSED);
|
||||
});
|
||||
});
|
||||
|
||||
@ -94,7 +94,7 @@ describe("Abilities - Sheer Force", () => {
|
||||
.enemyAbility(AbilityId.COLOR_CHANGE);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.PIDGEOT]);
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const enemyPokemon = game.field.getEnemyPokemon();
|
||||
const headbuttMove = allMoves[MoveId.HEADBUTT];
|
||||
vi.spyOn(headbuttMove, "calculateBattlePower");
|
||||
const headbuttFlinchAttr = headbuttMove.getAttrs("FlinchAttr")[0];
|
||||
@ -106,7 +106,7 @@ describe("Abilities - Sheer Force", () => {
|
||||
await game.move.forceHit();
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
|
||||
expect(enemyPokemon?.getTypes()[0]).toBe(PokemonType.WATER);
|
||||
expect(enemyPokemon.getTypes()[0]).toBe(PokemonType.WATER);
|
||||
expect(headbuttMove.calculateBattlePower).toHaveLastReturnedWith(headbuttMove.power * SHEER_FORCE_MULT);
|
||||
expect(headbuttFlinchAttr.getMoveChance).toHaveLastReturnedWith(0);
|
||||
});
|
||||
@ -144,11 +144,11 @@ describe("Abilities - Sheer Force", () => {
|
||||
.enemyLevel(100);
|
||||
await game.classicMode.startBattle([SpeciesId.MELOETTA]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
const formKeyStart = playerPokemon?.getFormKey();
|
||||
const playerPokemon = game.field.getPlayerPokemon();
|
||||
const formKeyStart = playerPokemon.getFormKey();
|
||||
|
||||
game.move.select(MoveId.RELIC_SONG);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(formKeyStart).toBe(playerPokemon?.getFormKey());
|
||||
expect(formKeyStart).toBe(playerPokemon.getFormKey());
|
||||
});
|
||||
});
|
||||
|
||||
@ -35,7 +35,7 @@ describe("Abilities - Victory Star", () => {
|
||||
it("should increase the accuracy of its user", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.VICTINI, SpeciesId.MAGIKARP]);
|
||||
|
||||
const user = game.scene.getPlayerField()[0];
|
||||
const user = game.field.getPlayerPokemon();
|
||||
|
||||
vi.spyOn(user, "getAccuracyMultiplier");
|
||||
game.move.select(MoveId.TACKLE, 0, BattlerIndex.ENEMY);
|
||||
@ -48,7 +48,7 @@ describe("Abilities - Victory Star", () => {
|
||||
it("should increase the accuracy of its user's ally", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.VICTINI]);
|
||||
|
||||
const ally = game.scene.getPlayerField()[0];
|
||||
const ally = game.field.getPlayerPokemon();
|
||||
vi.spyOn(ally, "getAccuracyMultiplier");
|
||||
|
||||
game.move.select(MoveId.TACKLE, 0, BattlerIndex.ENEMY);
|
||||
|
||||
@ -35,8 +35,8 @@ describe("Moves - Baneful Bunker", () => {
|
||||
});
|
||||
|
||||
function expectProtected() {
|
||||
expect(game.scene.getEnemyPokemon()?.hp).toBe(game.scene.getEnemyPokemon()?.getMaxHp());
|
||||
expect(game.scene.getPlayerPokemon()?.status?.effect).toBe(StatusEffect.POISON);
|
||||
expect(game.field.getEnemyPokemon().hp).toBe(game.field.getEnemyPokemon().getMaxHp());
|
||||
expect(game.field.getPlayerPokemon().status?.effect).toBe(StatusEffect.POISON);
|
||||
}
|
||||
|
||||
it("should protect the user and poison attackers that make contact", async () => {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { EntryHazardTag } from "#data/arena-tag";
|
||||
import { allMoves } from "#data/data-lists";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { ArenaTagSide } from "#enums/arena-tag-side";
|
||||
@ -152,8 +151,8 @@ describe("Moves - Destiny Bond", () => {
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon.isFainted()).toBe(true);
|
||||
expect(playerPokemon.isFainted()).toBe(false);
|
||||
expect(enemyPokemon).toHaveFainted();
|
||||
expect(playerPokemon).not.toHaveFainted();
|
||||
});
|
||||
|
||||
it("should not KO an ally", async () => {
|
||||
@ -167,10 +166,10 @@ describe("Moves - Destiny Bond", () => {
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon0.isFainted()).toBe(false);
|
||||
expect(enemyPokemon1.isFainted()).toBe(false);
|
||||
expect(playerPokemon0.isFainted()).toBe(true);
|
||||
expect(playerPokemon1.isFainted()).toBe(false);
|
||||
expect(enemyPokemon0).not.toHaveFainted();
|
||||
expect(enemyPokemon1).not.toHaveFainted();
|
||||
expect(playerPokemon0).toHaveFainted();
|
||||
expect(playerPokemon1).not.toHaveFainted();
|
||||
});
|
||||
|
||||
it("should not cause a crash if the user is KO'd by Ceaseless Edge", async () => {
|
||||
@ -187,8 +186,8 @@ describe("Moves - Destiny Bond", () => {
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon.isFainted()).toBe(true);
|
||||
expect(playerPokemon.isFainted()).toBe(true);
|
||||
expect(enemyPokemon).toHaveFainted();
|
||||
expect(playerPokemon).toHaveFainted();
|
||||
|
||||
// Ceaseless Edge spikes effect should still activate
|
||||
expect(game).toHaveArenaTag({ tagType: ArenaTagType.SPIKES, side: ArenaTagSide.ENEMY, layers: 1 });
|
||||
@ -198,27 +197,20 @@ describe("Moves - Destiny Bond", () => {
|
||||
game.override.moveset([MoveId.GRASS_PLEDGE, MoveId.WATER_PLEDGE]).battleStyle("double");
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon0 = game.scene.getEnemyField()[0];
|
||||
const enemyPokemon1 = game.scene.getEnemyField()[1];
|
||||
const playerPokemon0 = game.scene.getPlayerField()[0];
|
||||
const playerPokemon1 = game.scene.getPlayerField()[1];
|
||||
const [playerPokemon0, playerPokemon1, enemyPokemon0, enemyPokemon1] = game.scene.getField();
|
||||
|
||||
game.move.select(MoveId.GRASS_PLEDGE, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(MoveId.WATER_PLEDGE, 1, BattlerIndex.ENEMY);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon0?.isFainted()).toBe(true);
|
||||
expect(enemyPokemon1?.isFainted()).toBe(false);
|
||||
expect(playerPokemon0?.isFainted()).toBe(false);
|
||||
expect(playerPokemon1?.isFainted()).toBe(true);
|
||||
expect(enemyPokemon0).toHaveFainted();
|
||||
expect(enemyPokemon1).not.toHaveFainted();
|
||||
expect(playerPokemon0).not.toHaveFainted();
|
||||
expect(playerPokemon1).toHaveFainted();
|
||||
|
||||
// Pledge secondary effect should still activate
|
||||
const tagAfter = game.scene.arena.getTagOnSide(
|
||||
ArenaTagType.GRASS_WATER_PLEDGE,
|
||||
ArenaTagSide.ENEMY,
|
||||
) as EntryHazardTag;
|
||||
expect(tagAfter.tagType).toBe(ArenaTagType.GRASS_WATER_PLEDGE);
|
||||
expect(game).toHaveArenaTag(ArenaTagType.GRASS_WATER_PLEDGE, ArenaTagSide.ENEMY);
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -50,8 +50,9 @@ describe("Moves - Doodle", () => {
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(game.scene.getPlayerField()[0].getAbility().id).toBe(AbilityId.BALL_FETCH);
|
||||
expect(game.scene.getPlayerField()[1].getAbility().id).toBe(AbilityId.BALL_FETCH);
|
||||
const [player1, player2] = game.scene.getPlayerField();
|
||||
expect(player1.getAbility().id).toBe(AbilityId.BALL_FETCH);
|
||||
expect(player2.getAbility().id).toBe(AbilityId.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("should activate post-summon abilities", async () => {
|
||||
|
||||
@ -79,8 +79,9 @@ describe("Moves - Fairy Lock", () => {
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerField()[0].isTrapped()).toEqual(false);
|
||||
expect(game.scene.getPlayerField()[1].isTrapped()).toEqual(false);
|
||||
const [player1, player2] = game.scene.getPlayerField();
|
||||
expect(player1.isTrapped()).toEqual(false);
|
||||
expect(player2.isTrapped()).toEqual(false);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
game.doSwitchPokemon(2);
|
||||
@ -115,8 +116,9 @@ describe("Moves - Fairy Lock", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).not.toBe(SpeciesId.KLEFKI);
|
||||
expect(game.scene.getPlayerField()[1].species.speciesId).not.toBe(SpeciesId.TYRUNT);
|
||||
const [player1, player2] = game.scene.getPlayerField();
|
||||
expect(player1.species.speciesId).not.toBe(SpeciesId.KLEFKI);
|
||||
expect(player2.species.speciesId).not.toBe(SpeciesId.TYRUNT);
|
||||
});
|
||||
|
||||
it("If a Pokemon faints and is replaced the replacement is also trapped", async () => {
|
||||
@ -138,15 +140,17 @@ describe("Moves - Fairy Lock", () => {
|
||||
await game.move.selectEnemyMove(MoveId.SPLASH, 1);
|
||||
await game.move.selectEnemyMove(MoveId.SPLASH, 1);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
expect(game.scene.getPlayerField()[0].isTrapped()).toEqual(true);
|
||||
expect(game.scene.getPlayerField()[1].isTrapped()).toEqual(true);
|
||||
expect(game.scene.getEnemyField()[0].isTrapped()).toEqual(true);
|
||||
expect(game.scene.getEnemyField()[1].isTrapped()).toEqual(true);
|
||||
|
||||
const [player1, player2, enemy1, enemy2] = game.scene.getField();
|
||||
expect(player1.isTrapped()).toBe(true);
|
||||
expect(player2.isTrapped()).toBe(true);
|
||||
expect(enemy1.isTrapped()).toBe(true);
|
||||
expect(enemy2.isTrapped()).toBe(true);
|
||||
|
||||
await game.toNextTurn();
|
||||
expect(game.scene.getPlayerField()[0].isTrapped()).toEqual(false);
|
||||
expect(game.scene.getPlayerField()[1].isTrapped()).toEqual(false);
|
||||
expect(game.scene.getEnemyField()[0].isTrapped()).toEqual(false);
|
||||
expect(game.scene.getEnemyField()[1].isTrapped()).toEqual(false);
|
||||
expect(player1.isTrapped()).toBe(false);
|
||||
expect(player2.isTrapped()).toBe(false);
|
||||
expect(enemy1.isTrapped()).toBe(false);
|
||||
expect(enemy2.isTrapped()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@ -130,7 +130,7 @@ describe("Moves - Fell Stinger", () => {
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.LEAVANNY]);
|
||||
const leadPokemon = game.field.getPlayerPokemon();
|
||||
const leftEnemy = game.scene.getEnemyField()[0]!;
|
||||
const leftEnemy = game.field.getEnemyPokemon();
|
||||
|
||||
// Turn 1: set Bind, enemy splashes and does nothing
|
||||
game.move.select(MoveId.BIND, 0, leftEnemy.getBattlerIndex());
|
||||
@ -153,7 +153,7 @@ describe("Moves - Fell Stinger", () => {
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.LEAVANNY]);
|
||||
const leadPokemon = game.field.getPlayerPokemon();
|
||||
const leftEnemy = game.scene.getEnemyField()[0]!;
|
||||
const leftEnemy = game.field.getEnemyPokemon();
|
||||
|
||||
// Turn 1: set Leech Seed, enemy splashes and does nothing
|
||||
game.move.select(MoveId.LEECH_SEED, 0, leftEnemy.getBattlerIndex());
|
||||
|
||||
@ -97,7 +97,7 @@ describe("Moves - Fishious Rend & Bolt Beak", () => {
|
||||
it.each<{ type: string; allyMove: MoveId }>([
|
||||
{ type: "a Dancer-induced", allyMove: MoveId.FIERY_DANCE },
|
||||
{ type: "an Instructed", allyMove: MoveId.INSTRUCT },
|
||||
])("should double power if $type move is used as the target's first action that turn", async ({ allyMove }) => {
|
||||
])("should not double power if $type move is used as the target's first action that turn", async ({ allyMove }) => {
|
||||
game.override.battleStyle("double").enemyAbility(AbilityId.DANCER);
|
||||
const powerSpy = vi.spyOn(allMoves[MoveId.FISHIOUS_REND], "calculateBattlePower");
|
||||
await game.classicMode.startBattle([SpeciesId.DRACOVISH, SpeciesId.ARCTOZOLT]);
|
||||
|
||||
@ -108,7 +108,7 @@ describe("Moves - Instruct", () => {
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
instructSuccess(shuckle, MoveId.SONIC_BOOM);
|
||||
expect(game.scene.getEnemyField()[0].getInverseHp()).toBe(40);
|
||||
expect(game.field.getEnemyPokemon().getInverseHp()).toBe(40);
|
||||
});
|
||||
|
||||
// TODO: Enable test case once gigaton hammer (and blood moon) are reworked
|
||||
@ -251,7 +251,7 @@ describe("Moves - Instruct", () => {
|
||||
// fiery dance triggered dancer successfully for a total of 4 hits
|
||||
// Enemy level is set to a high value so that it does not faint even after all 4 hits
|
||||
instructSuccess(volcarona, MoveId.FIERY_DANCE);
|
||||
expect(game.scene.getEnemyField()[0].turnData.attacksReceived.length).toBe(4);
|
||||
expect(game.field.getEnemyPokemon().turnData.attacksReceived.length).toBe(4);
|
||||
});
|
||||
|
||||
it("should not repeat move when switching out", async () => {
|
||||
|
||||
@ -88,7 +88,7 @@ describe("Moves - Magic Coat", () => {
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
const user = game.scene.getPlayerField()[0];
|
||||
const user = game.field.getPlayerPokemon();
|
||||
expect(user.getStatStage(Stat.ATK)).toBe(-2);
|
||||
});
|
||||
|
||||
@ -133,7 +133,7 @@ describe("Moves - Magic Coat", () => {
|
||||
await game.move.selectEnemyMove(MoveId.SPLASH);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(game.scene.getEnemyField()[0].getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(game.field.getEnemyPokemon().getStatStage(Stat.ATK)).toBe(0);
|
||||
});
|
||||
|
||||
// todo while Mirror Armor is not implemented
|
||||
|
||||
@ -75,6 +75,6 @@ describe("Moves - Metal Burst", () => {
|
||||
|
||||
expect(enemy1.isFainted()).toBe(true);
|
||||
expect(enemy2.isFainted()).toBe(true);
|
||||
expect(game.scene.getPlayerField()[0].getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
|
||||
expect(game.field.getPlayerPokemon().getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
});
|
||||
|
||||
@ -45,7 +45,7 @@ describe("Moves - Mirror Move", () => {
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getEnemyField()[0].isFullHp()).toBeFalsy();
|
||||
expect(game.field.getEnemyPokemon().isFullHp()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("should apply secondary effects of a move", async () => {
|
||||
|
||||
@ -42,7 +42,7 @@ describe("Moves - Parting Shot", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
});
|
||||
|
||||
test("Parting shot should fail against good as gold ability", async () => {
|
||||
@ -57,7 +57,7 @@ describe("Moves - Parting Shot", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
});
|
||||
|
||||
// TODO: fix this bug to pass the test!
|
||||
@ -103,7 +103,7 @@ describe("Moves - Parting Shot", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6);
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
});
|
||||
|
||||
// TODO: fix this bug to pass the test!
|
||||
@ -119,7 +119,7 @@ describe("Moves - Parting Shot", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
});
|
||||
|
||||
// TODO: fix this bug to pass the test!
|
||||
@ -135,7 +135,7 @@ describe("Moves - Parting Shot", () => {
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
|
||||
});
|
||||
|
||||
// TODO: fix this bug to pass the test!
|
||||
|
||||
@ -57,7 +57,7 @@ describe("Moves - Protect", () => {
|
||||
])("should have a 1/$chance success rate after $numTurns successful uses", async ({ numTurns, chance }) => {
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
|
||||
// mock RNG roll to suceed unless exactly the desired chance is hit
|
||||
vi.spyOn(charizard, "randBattleSeedInt").mockImplementation(range => (range !== chance ? 0 : 1));
|
||||
@ -106,7 +106,7 @@ describe("Moves - Protect", () => {
|
||||
it("should reset fail chance on move failure", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
// force protect to always fail if RNG roll attempt is made
|
||||
vi.spyOn(charizard, "randBattleSeedInt").mockReturnValue(1);
|
||||
|
||||
@ -126,7 +126,7 @@ describe("Moves - Protect", () => {
|
||||
it("should reset fail chance on using another move", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
// force protect to always fail if RNG roll attempt is made
|
||||
vi.spyOn(charizard, "randBattleSeedInt").mockReturnValue(1);
|
||||
|
||||
@ -164,7 +164,7 @@ describe("Moves - Protect", () => {
|
||||
game.override.ability(AbilityId.PSYCHIC_SURGE);
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
game.move.select(MoveId.PROTECT);
|
||||
await game.toNextTurn();
|
||||
|
||||
@ -204,7 +204,7 @@ describe("Moves - Protect", () => {
|
||||
game.override.enemyMoveset([MoveId.FUTURE_SIGHT, MoveId.MIGHTY_CLEAVE, MoveId.SPORE]);
|
||||
await game.classicMode.startBattle([SpeciesId.AGGRON]);
|
||||
|
||||
const aggron = game.scene.getPlayerPokemon()!;
|
||||
const aggron = game.field.getPlayerPokemon();
|
||||
vi.spyOn(aggron, "randBattleSeedInt").mockReturnValue(0);
|
||||
|
||||
// Turn 1: setup future sight
|
||||
|
||||
@ -74,7 +74,7 @@ describe("Moves - Quick Guard", () => {
|
||||
game.override.battleStyle("single");
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
// force protect to fail on anything >0 uses
|
||||
vi.spyOn(charizard, "randBattleSeedInt").mockReturnValue(1);
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ describe("Moves - Revival Blessing", () => {
|
||||
.enemyLevel(100);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MILOTIC, SpeciesId.GYARADOS]);
|
||||
|
||||
const feebas = game.scene.getPlayerField()[0];
|
||||
const feebas = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
game.move.select(MoveId.REVIVAL_BLESSING, 1);
|
||||
@ -112,7 +112,7 @@ describe("Moves - Revival Blessing", () => {
|
||||
|
||||
expect(feebas.isFainted()).toBe(false);
|
||||
expect(feebas.hp).toBe(toDmgValue(0.5 * feebas.getMaxHp()));
|
||||
expect(game.scene.getPlayerField()[0]).toBe(feebas);
|
||||
expect(game.field.getPlayerPokemon()).toBe(feebas);
|
||||
});
|
||||
|
||||
it("should not summon multiple pokemon to the same slot when reviving the enemy ally in doubles", async () => {
|
||||
@ -124,7 +124,7 @@ describe("Moves - Revival Blessing", () => {
|
||||
.startingWave(25); // 2nd rival battle - must have 3+ pokemon
|
||||
await game.classicMode.startBattle([SpeciesId.ARCEUS, SpeciesId.GIRATINA]);
|
||||
|
||||
const enemyFainting = game.scene.getEnemyField()[0];
|
||||
const enemyFainting = game.field.getEnemyPokemon();
|
||||
|
||||
game.move.use(MoveId.JUDGMENT, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
|
||||
@ -42,7 +42,7 @@ describe("Moves - Taunt", () => {
|
||||
const move1 = playerPokemon.getLastXMoves(1)[0]!;
|
||||
expect(move1.move).toBe(MoveId.GROWL);
|
||||
expect(move1.result).toBe(MoveResult.SUCCESS);
|
||||
expect(playerPokemon?.getTag(BattlerTagType.TAUNT)).toBeDefined();
|
||||
expect(playerPokemon.getTag(BattlerTagType.TAUNT)).toBeDefined();
|
||||
|
||||
// Second turn, Taunt forces Struggle to occur
|
||||
game.move.select(MoveId.GROWL);
|
||||
|
||||
@ -45,7 +45,7 @@ describe("Moves - Torment", () => {
|
||||
const move1 = playerPokemon.getLastXMoves(1)[0]!;
|
||||
expect(move1.move).toBe(MoveId.TACKLE);
|
||||
expect(move1.result).toBe(MoveResult.SUCCESS);
|
||||
expect(playerPokemon?.getTag(BattlerTagType.TORMENT)).toBeDefined();
|
||||
expect(playerPokemon.getTag(BattlerTagType.TORMENT)).toBeDefined();
|
||||
|
||||
// Second turn, Torment forces Struggle to occur
|
||||
game.move.select(MoveId.TACKLE);
|
||||
|
||||
@ -70,7 +70,7 @@ describe("Moves - Wide Guard", () => {
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.BLASTOISE]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
const [snorlax1, snorlax2] = game.scene.getEnemyField();
|
||||
|
||||
game.move.select(MoveId.WIDE_GUARD, BattlerIndex.PLAYER);
|
||||
@ -86,7 +86,7 @@ describe("Moves - Wide Guard", () => {
|
||||
game.override.battleStyle("single");
|
||||
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
||||
|
||||
const charizard = game.scene.getPlayerPokemon()!;
|
||||
const charizard = game.field.getPlayerPokemon();
|
||||
// force protect to fail on anything other than a guaranteed success
|
||||
vi.spyOn(charizard, "randBattleSeedInt").mockReturnValue(1);
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ describe("Learn Move Phase", () => {
|
||||
game.override.moveset([MoveId.SPLASH]);
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
const pokemon = game.field.getPlayerPokemon();
|
||||
const newMovePos = pokemon?.getMoveset().length;
|
||||
const newMovePos = pokemon.getMoveset().length;
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
await game.phaseInterceptor.to(LearnMovePhase);
|
||||
@ -38,7 +38,7 @@ describe("Learn Move Phase", () => {
|
||||
const levelReq = levelMove[0];
|
||||
const levelMoveId = levelMove[1];
|
||||
expect(pokemon.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(pokemon?.moveset[newMovePos]?.moveId).toBe(levelMoveId);
|
||||
expect(pokemon.moveset[newMovePos]?.moveId).toBe(levelMoveId);
|
||||
});
|
||||
|
||||
it("If a pokemon has 4 move slots filled, the chosen move will be deleted and replaced", async () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user