Telekinesis Test + Move Fix

This commit is contained in:
frutescens 2024-10-06 16:41:27 -07:00
parent 5f63f6c7a1
commit 0d797abdf4
2 changed files with 55 additions and 4 deletions

View File

@ -8386,12 +8386,11 @@ export function initMoves() {
new SelfStatusMove(Moves.RAGE_POWDER, Type.BUG, -1, 20, -1, 2, 5)
.powderMove()
.attr(AddBattlerTagAttr, BattlerTagType.CENTER_OF_ATTENTION, true),
new StatusMove(Moves.TELEKINESIS, Type.PSYCHIC, -1, 15, -1, 0, 5)
new StatusMove(Moves.TELEKINESIS, Type.PSYCHIC, 100, 15, -1, 0, 5)
.condition(failOnGravityCondition)
.condition((_user, target, _move) => ![ Species.DIGLETT, Species.DUGTRIO, Species.ALOLA_DIGLETT, Species.ALOLA_DUGTRIO, Species.SANDYGAST, Species.PALOSSAND, Species.WIGLETT, Species.WUGTRIO ].includes(target.species.speciesId))
.condition((_user, target, _move) => !(target.species.speciesId !== Species.GENGAR && target.getFormKey() !== "mega"))
.condition((_user, target, _move) => !(target.getTag(BattlerTagType.INGRAIN) || target.getTag(BattlerTagType.IGNORE_FLYING)))
.attr(AddBattlerTagAttr, BattlerTagType.FLYING, false, false, 3)
.condition((_user, target, _move) => (target.species.speciesId !== Species.GENGAR && target.getFormKey() !== "mega"))
//.condition((_user, target, _move) => target.getTag(BattlerTagType.INGRAIN) || target.getTag(BattlerTagType.IGNORE_FLYING)
.attr(AddBattlerTagAttr, BattlerTagType.TELEKINESIS, false, false, 3),
new StatusMove(Moves.MAGIC_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5)
.ignoresProtect()

View File

@ -0,0 +1,52 @@
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { allMoves } from "#app/data/move";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
describe("Moves - Telekinesis", () => {
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
.moveset([ Moves.TELEKINESIS, Moves.TACKLE, Moves.MUD_SHOT ])
.battleType("single")
.enemySpecies(Species.SNORLAX)
.enemyLevel(60)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
it("test case", async () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]);
const enemyOpponent = game.scene.getEnemyPokemon();
expect(enemyOpponent).toBeDefined();
game.move.select(Moves.TELEKINESIS);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined();
await game.toNextTurn();
vi.spyOn(allMoves[Moves.TACKLE], "accuracy", "get").mockReturnValue(0);
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.hp).toBeLessThan(enemyOpponent?.getMaxHp()!);
});
});