apply game.override.passiveAbility

This commit is contained in:
Felix Staud 2024-07-25 16:36:39 -07:00
parent b72a1347b2
commit a7b26355b0
7 changed files with 53 additions and 59 deletions

View File

@ -1,18 +1,17 @@
import { allMoves } from "#app/data/move.js";
import { Type } from "#app/data/type.js";
import { Weather, WeatherType } from "#app/data/weather.js";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; import GameManager from "../utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "../utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import { allMoves } from "#app/data/move.js";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Weather, WeatherType } from "#app/data/weather.js";
import { Type } from "#app/data/type.js";
import { Biome } from "#enums/biome";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -125,7 +124,7 @@ describe("Abilities - Protean", () => {
"ability applies correctly even if the type has changed by another ability", "ability applies correctly even if the type has changed by another ability",
async () => { async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); game.override.passiveAbility(Abilities.REFRIGERATE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);

View File

@ -1,18 +1,17 @@
import { allMoves } from "#app/data/move.js";
import { Type } from "#app/data/type.js";
import { Weather, WeatherType } from "#app/data/weather.js";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; import GameManager from "../utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "../utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import { allMoves } from "#app/data/move.js";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Weather, WeatherType } from "#app/data/weather.js";
import { Type } from "#app/data/type.js";
import { Biome } from "#enums/biome";
import { PlayerPokemon } from "#app/field/pokemon.js";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -125,7 +124,7 @@ describe("Abilities - Protean", () => {
"ability applies correctly even if the type has changed by another ability", "ability applies correctly even if the type has changed by another ability",
async () => { async () => {
game.override.moveset([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); game.override.passiveAbility(Abilities.REFRIGERATE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);

View File

@ -1,12 +1,11 @@
import Phaser from "phaser"; import { TurnEndPhase } from "#app/phases.js";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
import GameManager from "../utils/gameManager";
import { getMovePosition } from "../utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases.js";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -49,7 +48,7 @@ describe("Abilities - Unseen Fist", () => {
test( test(
"ability does not apply if the source has Long Reach", "ability does not apply if the source has Long Reach",
() => { () => {
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LONG_REACH); game.override.passiveAbility(Abilities.LONG_REACH);
testUnseenFistHitResult(game, Moves.QUICK_ATTACK, Moves.PROTECT, false); testUnseenFistHitResult(game, Moves.QUICK_ATTACK, Moves.PROTECT, false);
}, TIMEOUT }, TIMEOUT
); );

View File

@ -1,17 +1,16 @@
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 { TurnEndPhase } from "#app/phases";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Species } from "#app/enums/species.js";
import { Type } from "#app/data/type";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { BattlerTagType } from "#enums/battler-tag-type"; import { Type } from "#app/data/type";
import { Species } from "#app/enums/species.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import { TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Dragon Rage", () => { describe("Moves - Dragon Rage", () => {
@ -41,7 +40,7 @@ describe("Moves - Dragon Rage", () => {
game.override.starterSpecies(Species.SNORLAX); game.override.starterSpecies(Species.SNORLAX);
game.override.moveset([Moves.DRAGON_RAGE]); game.override.moveset([Moves.DRAGON_RAGE]);
game.override.ability(Abilities.BALL_FETCH); game.override.ability(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.passiveAbility(Abilities.BALL_FETCH);
game.override.startingLevel(100); game.override.startingLevel(100);
game.override.enemySpecies(Species.SNORLAX); game.override.enemySpecies(Species.SNORLAX);

View File

@ -1,14 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { DamagePhase, TurnEndPhase } from "#app/phases";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { BattleStat } from "#app/data/battle-stat"; import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Fissure", () => { describe("Moves - Fissure", () => {
@ -35,7 +34,7 @@ describe("Moves - Fissure", () => {
game.override.starterSpecies(Species.SNORLAX); game.override.starterSpecies(Species.SNORLAX);
game.override.moveset([Moves.FISSURE]); game.override.moveset([Moves.FISSURE]);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.passiveAbility(Abilities.BALL_FETCH);
game.override.startingLevel(100); game.override.startingLevel(100);
game.override.enemySpecies(Species.SNORLAX); game.override.enemySpecies(Species.SNORLAX);

View File

@ -33,7 +33,7 @@ describe("Moves - Glaive Rush", () => {
game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH));
game.override.starterSpecies(Species.KLINK); game.override.starterSpecies(Species.KLINK);
game.override.ability(Abilities.UNNERVE); game.override.ability(Abilities.UNNERVE);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); game.override.passiveAbility(Abilities.FUR_COAT);
game.override.moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); game.override.moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]);
}); });

View File

@ -1,13 +1,12 @@
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 { import {
CommandPhase CommandPhase
} from "#app/phases"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Spikes", () => { describe("Moves - Spikes", () => {
@ -32,7 +31,7 @@ describe("Moves - Spikes", () => {
game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyAbility(Abilities.HYDRATION);
game.override.enemyPassiveAbility(Abilities.HYDRATION); game.override.enemyPassiveAbility(Abilities.HYDRATION);
game.override.ability(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION);
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.passiveAbility(Abilities.HYDRATION);
game.override.startingWave(3); game.override.startingWave(3);
game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]);
game.override.moveset([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); game.override.moveset([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]);