Fix super-niche edgecase with mega gengar and telekinesis

This commit is contained in:
Sirz Benjie 2025-02-07 02:08:02 -06:00
parent 6c4dedb73e
commit 427d528ad5
No known key found for this signature in database
GPG Key ID: D4BFA840253CD6D7
2 changed files with 15 additions and 1 deletions

View File

@ -3234,7 +3234,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
for (const tag of source.summonData.tags) {
if (!tag.isBatonPassable) {
if (!tag.isBatonPassable || (tag.tagType === BattlerTagType.TELEKINESIS && this.species.speciesId === Species.GENGAR && this.getFormKey() === "mega")) {
continue;
}

View File

@ -7,6 +7,7 @@ import { MoveResult } from "#app/field/pokemon";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
import { BattlerIndex } from "#app/battle";
describe("Moves - Telekinesis", () => {
let phaserGame: Phaser.Game;
@ -121,4 +122,17 @@ describe("Moves - Telekinesis", () => {
expect(enemyOpponent.getTag(BattlerTagType.FLOATING)).toBeUndefined();
expect(playerPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
});
it("should not be baton passed onto a mega gengar", async () => {
game.override.moveset([ Moves.BATON_PASS ])
.enemyMoveset([ Moves.TELEKINESIS ])
.starterForms({ [Species.GENGAR]: 1 });
await game.classicMode.startBattle([ Species.MAGIKARP, Species.GENGAR ]);
game.move.select(Moves.BATON_PASS);
game.doSelectPartyPokemon(1);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerPokemon()!.getTag(BattlerTagType.TELEKINESIS)).toBeUndefined();
});
});