Add Several Unit Tests and Fixes

This commit is contained in:
xsn34kzx 2024-08-19 12:46:44 -04:00
parent 60b04762d5
commit 160264cd57
9 changed files with 613 additions and 5802 deletions

View File

@ -2891,13 +2891,22 @@ export function overrideModifiers(scene: BattleScene, isPlayer: boolean = true):
modifiersOverride.forEach(item => { modifiersOverride.forEach(item => {
const modifierFunc = modifierTypes[item.name]; const modifierFunc = modifierTypes[item.name];
const modifier = modifierFunc().withIdFromFunc(modifierFunc).newModifier() as PersistentModifier; let modifierType: ModifierType | null = modifierFunc();
modifier.stackCount = item.count || 1;
if (isPlayer) { if (modifierType instanceof ModifierTypes.ModifierTypeGenerator) {
scene.addModifier(modifier, true, false, false, true); const pregenArgs = ("type" in item) && (item.type !== null) ? [item.type] : undefined;
} else { modifierType = modifierType.generateType([], pregenArgs);
scene.addEnemyModifier(modifier, true, true); }
const modifier = modifierType && modifierType.withIdFromFunc(modifierFunc).newModifier() as PersistentModifier;
if (modifier) {
modifier.stackCount = item.count || 1;
if (isPlayer) {
scene.addModifier(modifier, true, false, false, true);
} else {
scene.addEnemyModifier(modifier, true, true);
}
} }
}); });
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
import { Stat } from "#enums/stat";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { VictoryPhase } from "#app/phases/victory-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { BattlerIndex } from "#app/battle";
describe("Abilities - Beast Boost", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.BULBASAUR);
game.override.enemyAbility(Abilities.BEAST_BOOST);
game.override.ability(Abilities.BEAST_BOOST);
game.override.startingLevel(2000);
game.override.moveset([ Moves.FLAMETHROWER ]);
game.override.enemyMoveset(SPLASH_ONLY);
});
// Note that both MOXIE and BEAST_BOOST test for their current implementation and not the mainline behavior.
it("should prefer highest stat to boost its corresponding stat stage by 1 when winning a battle", async() => {
// SLOWBRO's highest stat is DEF, so it should be picked here
await game.startBattle([
Species.SLOWBRO
]);
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(1);
}, 20000);
it("should use in-battle overriden stats when determining the stat stage to raise by 1", async() => {
// If the opponent can GUARD_SPLIT, SLOWBRO's second highest stat should be SPATK
game.override.enemyMoveset(new Array(4).fill(Moves.GUARD_SPLIT));
await game.startBattle([
Species.SLOWBRO
]);
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.phaseInterceptor.runFrom(TurnStartPhase).to(VictoryPhase);
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
}, 20000);
it("should have order preference in case of stat ties", async() => {
// Order preference follows the order of EFFECTIVE_STAT
await game.startBattle([
Species.SLOWBRO
]);
const playerPokemon = game.scene.getPlayerPokemon()!;
// Set up tie between SPATK, SPDEF, and SPD, where SPATK should win
vi.spyOn(playerPokemon, "stats", "get").mockReturnValue([ 10000, 1, 1, 100, 100, 100 ]);
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(0);
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase);
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
}, 20000);
});

View File

@ -0,0 +1,99 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import { Species } from "#enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Stat, BATTLE_STATS, EFFECTIVE_STATS } from "#enums/stat";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Imposter", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.MEW);
game.override.enemyLevel(200);
game.override.enemyAbility(Abilities.BEAST_BOOST);
game.override.enemyMoveset(SPLASH_ONLY);
game.override.ability(Abilities.IMPOSTER);
game.override.moveset([ Moves.TACKLE ]);
});
it("should copy species, ability, gender, all stats except HP, all stat stages, moveset, and types of target", async () => {
await game.startBattle([
Species.DITTO
]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(TurnEndPhase);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
expect(player.getSpeciesForm().speciesId).toBe(enemy.getSpeciesForm().speciesId);
expect(player.getAbility()).toBe(enemy.getAbility());
expect(player.getGender()).toBe(enemy.getGender());
expect(player.getStat(Stat.HP, false)).not.toBe(enemy.getStat(Stat.HP));
for (const s of EFFECTIVE_STATS) {
expect(player.getStat(s, false)).toBe(enemy.getStat(s, false));
}
for (const s of BATTLE_STATS) {
expect(player.getStatStage(s)).toBe(enemy.getStatStage(s));
}
const playerMoveset = player.getMoveset();
const enemyMoveset = player.getMoveset();
for (let i = 0; i < playerMoveset.length && i < enemyMoveset.length; i++) {
// TODO: Checks for 5 PP should be done here when that gets addressed
expect(playerMoveset[i]?.moveId).toBe(enemyMoveset[i]?.moveId);
}
const playerTypes = player.getTypes();
const enemyTypes = enemy.getTypes();
for (let i = 0; i < playerTypes.length && i < enemyTypes.length; i++) {
expect(playerTypes[i]).toBe(enemyTypes[i]);
}
}, 20000);
it("should copy in-battle overridden stats", async () => {
game.override.enemyMoveset(new Array(4).fill(Moves.POWER_SPLIT));
await game.startBattle([
Species.DITTO
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
});
});

View File

@ -38,7 +38,7 @@ describe("Abilities - Moxie", () => {
game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyMoveset(SPLASH_ONLY);
}); });
it("should raise ATK stat stage by 1 when defeating an enemy Pokemon", async() => { it("should raise ATK stat stage by 1 when winning a battle", async() => {
const moveToUse = Moves.AERIAL_ACE; const moveToUse = Moves.AERIAL_ACE;
await game.startBattle([ await game.startBattle([
Species.MIGHTYENA, Species.MIGHTYENA,

View File

@ -0,0 +1,136 @@
import { Stat } from "#enums/stat";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { Moves } from "#app/enums/moves.js";
import { getMovePosition } from "../utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
import { SPLASH_ONLY } from "../utils/testUtils";
import { Abilities } from "#app/enums/abilities.js";
import Overrides from "#app/overrides";
import { TempStatStageBoosterModifier } from "#app/modifier/modifier.js";
import { Mode } from "#app/ui/ui.js";
import { Button } from "#app/enums/buttons.js";
import { CommandPhase } from "#app/phases/command-phase.js";
import { NewBattlePhase } from "#app/phases/new-battle-phase.js";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler.js";
import { TurnInitPhase } from "#app/phases/turn-init-phase.js";
import { BattleEndPhase } from "#app/phases/battle-end-phase.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
describe("Items - Temporary Stat Stage Boosters", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phase.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.MEW);
game.override.enemyMoveset(SPLASH_ONLY);
game.override.enemyAbility(Abilities.PICKUP);
game.override.moveset([ Moves.TACKLE, Moves.HONE_CLAWS, Moves.BELLY_DRUM ]);
game.override.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }]);
});
it("should provide a x1.3 stat stage multiplier alone", async() => {
await game.startBattle([
Species.PIKACHU
]);
const partyMember = game.scene.getPlayerPokemon()!;
vi.spyOn(partyMember, "getStatStageMultiplier");
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnEndPhase);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.3);
}, 20000);
it("should only increase existing stat stage multiplier by 0.3", async() => {
await game.startBattle([
Species.PIKACHU
]);
const partyMember = game.scene.getPlayerPokemon()!;
vi.spyOn(partyMember, "getStatStageMultiplier");
game.doAttack(getMovePosition(game.scene, 0, Moves.HONE_CLAWS));
await game.phaseInterceptor.to(TurnEndPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(TurnEndPhase);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.8);
}, 20000);
it("should not increase past x4 maximum stat stage multiplier", async() => {
await game.startBattle([
Species.PIKACHU
]);
const partyMember = game.scene.getPlayerPokemon()!;
vi.spyOn(partyMember, "getStatStageMultiplier");
game.doAttack(getMovePosition(game.scene, 0, Moves.BELLY_DRUM));
await game.phaseInterceptor.to(TurnEndPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(TurnEndPhase);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(4);
}, 20000);
it("should renew how many battles are left of existing booster when picking up new booster of same type", async() => {
game.override.startingLevel(200);
vi.spyOn(Overrides, "ITEM_REWARD_OVERRIDE", "get").mockReturnValue([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }]);
await game.startBattle([
Species.PIKACHU
]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
await game.phaseInterceptor.to(BattleEndPhase);
const modifier = game.scene.findModifier(m => m instanceof TempStatStageBoosterModifier) as TempStatStageBoosterModifier;
expect(modifier.getBattlesLeft()).toBe(4);
// Forced X Attack to spawn in the first slot with override
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler;
handler.processInput(Button.ACTION);
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(NewBattlePhase), true);
await game.phaseInterceptor.to(TurnInitPhase);
// Making sure only one booster is in the modifier list even after picking up another
let count = 0;
for (const m of game.scene.modifiers) {
if (m instanceof TempStatStageBoosterModifier) {
count++;
expect((m as TempStatStageBoosterModifier).getBattlesLeft()).toBe(5);
}
}
expect(count).toBe(1);
}, 20000);
});

View File

@ -0,0 +1,83 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Stat } from "#enums/stat";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Guard Split", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemyAbility(Abilities.NONE);
game.override.enemySpecies(Species.MEW);
game.override.enemyLevel(200);
game.override.moveset([ Moves.GUARD_SPLIT ]);
game.override.ability(Abilities.NONE);
});
it("should average the user's Defense and Special Defense stats with those of the target", async () => {
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(SPLASH_ONLY);
await game.startBattle([
Species.INDEEDEE
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgDef = Math.floor((player.getStat(Stat.DEF, false) + enemy.getStat(Stat.DEF, false)) / 2);
const avgSpDef = Math.floor((player.getStat(Stat.SPDEF, false) + enemy.getStat(Stat.SPDEF, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.GUARD_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.DEF, false)).toBe(avgDef);
expect(enemy.getStat(Stat.DEF, false)).toBe(avgDef);
expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
}, 20000);
it("should be idempotent", async () => {
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.GUARD_SPLIT, Moves.GUARD_SPLIT, Moves.GUARD_SPLIT, Moves.GUARD_SPLIT ]);
await game.startBattle([
Species.INDEEDEE
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgDef = Math.floor((player.getStat(Stat.DEF, false) + enemy.getStat(Stat.DEF, false)) / 2);
const avgSpDef = Math.floor((player.getStat(Stat.SPDEF, false) + enemy.getStat(Stat.SPDEF, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.GUARD_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.GUARD_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.DEF, false)).toBe(avgDef);
expect(enemy.getStat(Stat.DEF, false)).toBe(avgDef);
expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
}, 20000);
});

View File

@ -0,0 +1,83 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Stat } from "#enums/stat";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Power Split", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemyAbility(Abilities.NONE);
game.override.enemySpecies(Species.MEW);
game.override.enemyLevel(200);
game.override.moveset([ Moves.POWER_SPLIT ]);
game.override.ability(Abilities.NONE);
});
it("should average the user's Attack and Special Attack stats with those of the target", async () => {
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(SPLASH_ONLY);
await game.startBattle([
Species.INDEEDEE
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.POWER_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
}, 20000);
it("should be idempotent", async () => {
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POWER_SPLIT, Moves.POWER_SPLIT, Moves.POWER_SPLIT, Moves.POWER_SPLIT ]);
await game.startBattle([
Species.INDEEDEE
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.POWER_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.POWER_SPLIT));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
}, 20000);
});

View File

@ -0,0 +1,99 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import { Species } from "#enums/species";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Stat, BATTLE_STATS, EFFECTIVE_STATS } from "#enums/stat";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Transform", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.MEW);
game.override.enemyLevel(200);
game.override.enemyAbility(Abilities.BEAST_BOOST);
game.override.enemyMoveset(SPLASH_ONLY);
game.override.ability(Abilities.INTIMIDATE);
game.override.moveset([ Moves.TRANSFORM ]);
});
it("should copy species, ability, gender, all stats except HP, all stat stages, moveset, and types of target", async () => {
await game.startBattle([
Species.DITTO
]);
game.doAttack(getMovePosition(game.scene, 0, Moves.TRANSFORM));
await game.phaseInterceptor.to(TurnEndPhase);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
expect(player.getSpeciesForm().speciesId).toBe(enemy.getSpeciesForm().speciesId);
expect(player.getAbility()).toBe(enemy.getAbility());
expect(player.getGender()).toBe(enemy.getGender());
expect(player.getStat(Stat.HP, false)).not.toBe(enemy.getStat(Stat.HP));
for (const s of EFFECTIVE_STATS) {
expect(player.getStat(s, false)).toBe(enemy.getStat(s, false));
}
for (const s of BATTLE_STATS) {
expect(player.getStatStage(s)).toBe(enemy.getStatStage(s));
}
const playerMoveset = player.getMoveset();
const enemyMoveset = player.getMoveset();
for (let i = 0; i < playerMoveset.length && i < enemyMoveset.length; i++) {
// TODO: Checks for 5 PP should be done here when that gets addressed
expect(playerMoveset[i]?.moveId).toBe(enemyMoveset[i]?.moveId);
}
const playerTypes = player.getTypes();
const enemyTypes = enemy.getTypes();
for (let i = 0; i < playerTypes.length && i < enemyTypes.length; i++) {
expect(playerTypes[i]).toBe(enemyTypes[i]);
}
}, 20000);
it("should copy in-battle overridden stats", async () => {
game.override.enemyMoveset(new Array(4).fill(Moves.POWER_SPLIT));
await game.startBattle([
Species.DITTO
]);
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
game.doAttack(getMovePosition(game.scene, 0, Moves.TRANSFORM));
await game.phaseInterceptor.to(TurnEndPhase);
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
});
});