Fix linting and test issues

This commit is contained in:
Xavion3 2025-02-05 04:03:38 +11:00
parent a177e1c7c3
commit e11247f5b0
6 changed files with 30 additions and 20 deletions

View File

@ -4778,7 +4778,7 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
}
override apply(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _cancelled: Utils.BooleanHolder, _args: any[]): boolean {
if (pokemon.isTerastallized()) {
if (pokemon.isTerastallized) {
return false;
}
const currentTerrain = globalScene.arena.getTerrainType();

View File

@ -4658,7 +4658,7 @@ export class TeraStarstormTypeAttr extends VariableMoveTypeAttr {
* @returns `true` if the move type is changed to {@linkcode Type.STELLAR}, `false` otherwise
*/
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.isTerastallized() && (user.hasFusionSpecies(Species.TERAPAGOS) || user.species.speciesId === Species.TERAPAGOS)) {
if (user.isTerastallized && (user.hasFusionSpecies(Species.TERAPAGOS) || user.species.speciesId === Species.TERAPAGOS)) {
const moveType = args[0] as Utils.NumberHolder;
moveType.value = Type.STELLAR;

View File

@ -11,7 +11,7 @@ import { Species } from "#enums/species";
import { WeatherType } from "#enums/weather-type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
describe("Abilities - Libero", () => {
@ -258,7 +258,7 @@ describe("Abilities - Libero", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
vi.spyOn(leadPokemon, "isTerastallized").mockReturnValue(true);
leadPokemon.isTerastallized = true;
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -11,7 +11,7 @@ import { Species } from "#enums/species";
import { WeatherType } from "#enums/weather-type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
describe("Abilities - Protean", () => {
@ -258,7 +258,7 @@ describe("Abilities - Protean", () => {
const leadPokemon = game.scene.getPlayerPokemon()!;
expect(leadPokemon).not.toBe(undefined);
vi.spyOn(leadPokemon, "isTerastallized").mockReturnValue(true);
leadPokemon.isTerastallized = true;
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -34,7 +34,6 @@ describe("Moves - Tera Blast", () => {
.starterSpecies(Species.FEEBAS)
.moveset([ Moves.TERA_BLAST ])
.ability(Abilities.BALL_FETCH)
.startingHeldItems([{ name: "TERA_SHARD", type: Type.FIRE }])
.enemySpecies(Species.MAGIKARP)
.enemyMoveset(Moves.SPLASH)
.enemyAbility(Abilities.BALL_FETCH)
@ -44,13 +43,15 @@ describe("Moves - Tera Blast", () => {
});
it("changes type to match user's tera type", async () => {
game.override
.enemySpecies(Species.FURRET)
.startingHeldItems([{ name: "TERA_SHARD", type: Type.FIGHTING }]);
game.override.enemySpecies(Species.FURRET);
await game.startBattle();
const enemyPokemon = game.scene.getEnemyPokemon()!;
vi.spyOn(enemyPokemon, "apply");
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.teraType = Type.FIGHTING;
playerPokemon.isTerastallized = true;
game.move.select(Moves.TERA_BLAST);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to("MoveEffectPhase");
@ -59,10 +60,12 @@ describe("Moves - Tera Blast", () => {
}, 20000);
it("increases power if user is Stellar tera type", async () => {
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
await game.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.teraType = Type.STELLAR;
playerPokemon.isTerastallized = true;
game.move.select(Moves.TERA_BLAST);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to("MoveEffectPhase");
@ -71,13 +74,15 @@ describe("Moves - Tera Blast", () => {
}, 20000);
it("is super effective against terastallized targets if user is Stellar tera type", async () => {
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
await game.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.teraType = Type.STELLAR;
playerPokemon.isTerastallized = true;
const enemyPokemon = game.scene.getEnemyPokemon()!;
vi.spyOn(enemyPokemon, "apply");
vi.spyOn(enemyPokemon, "isTerastallized").mockReturnValue(true);
enemyPokemon.isTerastallized = true;
game.move.select(Moves.TERA_BLAST);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
@ -94,6 +99,7 @@ describe("Moves - Tera Blast", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.stats[Stat.ATK] = 100;
playerPokemon.stats[Stat.SPATK] = 1;
playerPokemon.isTerastallized = true;
game.move.select(Moves.TERA_BLAST);
await game.phaseInterceptor.to("TurnEndPhase");
@ -101,10 +107,11 @@ describe("Moves - Tera Blast", () => {
}, 20000);
it("causes stat drops if user is Stellar tera type", async () => {
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
await game.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.teraType = Type.STELLAR;
playerPokemon.isTerastallized = true;
game.move.select(Moves.TERA_BLAST);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);

View File

@ -29,8 +29,7 @@ describe("Moves - Tera Starstorm", () => {
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH)
.enemyLevel(30)
.enemySpecies(Species.MAGIKARP)
.startingHeldItems([{ name: "TERA_SHARD", type: Type.FIRE }]);
.enemySpecies(Species.MAGIKARP);
});
it("changes type to Stellar when used by Terapagos in its Stellar Form", async () => {
@ -38,19 +37,22 @@ describe("Moves - Tera Starstorm", () => {
await game.classicMode.startBattle([ Species.TERAPAGOS ]);
const terapagos = game.scene.getPlayerPokemon()!;
terapagos.isTerastallized = true;
vi.spyOn(terapagos, "getMoveType");
game.move.select(Moves.TERA_STARSTORM);
await game.phaseInterceptor.to("TurnEndPhase");
expect(terapagos.isTerastallized()).toBe(true);
expect(terapagos.getMoveType).toHaveReturnedWith(Type.STELLAR);
});
it("targets both opponents in a double battle when used by Terapagos in its Stellar Form", async () => {
await game.classicMode.startBattle([ Species.MAGIKARP, Species.TERAPAGOS ]);
const terapagos = game.scene.getPlayerParty()[1];
terapagos.isTerastallized = true;
game.move.select(Moves.TERA_STARSTORM, 0, BattlerIndex.ENEMY);
game.move.select(Moves.TERA_STARSTORM, 1);
@ -82,6 +84,8 @@ describe("Moves - Tera Starstorm", () => {
fusionedMon.fusionGender = magikarp.gender;
fusionedMon.fusionLuck = magikarp.luck;
fusionedMon.isTerastallized = true;
vi.spyOn(fusionedMon, "getMoveType");
game.move.select(Moves.TERA_STARSTORM, 0);
@ -90,7 +94,6 @@ describe("Moves - Tera Starstorm", () => {
// Fusion and terastallized
expect(fusionedMon.isFusion()).toBe(true);
expect(fusionedMon.isTerastallized()).toBe(true);
// Move effects should be applied
expect(fusionedMon.getMoveType).toHaveReturnedWith(Type.STELLAR);
expect(game.scene.getEnemyField().every(pokemon => pokemon.isFullHp())).toBe(false);