another day another try...

This commit is contained in:
frutescens 2024-10-06 20:10:40 -07:00
parent 3e520176e3
commit 43832ba7b6
2 changed files with 81 additions and 5 deletions

View File

@ -2697,9 +2697,10 @@ export class TelekinesisTag extends BattlerTag {
} }
override onRemove(pokemon: Pokemon) { override onRemove(pokemon: Pokemon) {
pokemon.removeTag(BattlerTagType.TELEKINESIS); if (pokemon.getTag(BattlerTagType.FLOATING)) {
pokemon.removeTag(BattlerTagType.FLOATING); pokemon.removeTag(BattlerTagType.FLOATING);
} }
}
} }
/** /**

View File

@ -24,15 +24,15 @@ describe("Moves - Telekinesis", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override game.override
.moveset([ Moves.TELEKINESIS, Moves.TACKLE, Moves.MUD_SHOT ]) .moveset([ Moves.TELEKINESIS, Moves.TACKLE, Moves.MUD_SHOT, Moves.SMACK_DOWN ])
.battleType("single") .battleType("single")
.enemySpecies(Species.SNORLAX) .enemySpecies(Species.SNORLAX)
.enemyLevel(60) .enemyLevel(60)
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH); .enemyMoveset([ Moves.SPLASH ]);
}); });
it("Telekinesis makes the affected airborne and vulnerable to most attacking moves regardless of accuracy", async () => { it("Telekinesis makes the affected vulnerable to most attacking moves regardless of accuracy", async () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const enemyOpponent = game.scene.getEnemyPokemon(); const enemyOpponent = game.scene.getEnemyPokemon();
@ -49,4 +49,79 @@ describe("Moves - Telekinesis", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.hp).toBeLessThan(enemyOpponent?.getMaxHp()!); expect(enemyOpponent?.hp).toBeLessThan(enemyOpponent?.getMaxHp()!);
}); });
it("Telekinesis makes the affected airborne and immune to most Ground-moves", 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.MUD_SHOT], "accuracy", "get").mockReturnValue(100);
game.move.select(Moves.MUD_SHOT);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.hp).toEqual(enemyOpponent?.getMaxHp()!);
});
it("Telekinesis can still affect Pokemon that have been transformed into invalid Pokemon", async () => {
game.override.enemyMoveset(Moves.TRANSFORM);
await game.classicMode.startBattle([ Species.DIGLETT ]);
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();
});
it("Moves like Smack Down and 1000 Arrows remove all effects of Telekinesis from the target Pokemon", 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();
game.move.select(Moves.SMACK_DOWN);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeUndefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeUndefined();
});
it("Ingrain will remove the floating effect of Telekinesis, but not the 100% hit", async () => {
game.override.enemyMoveset([ Moves.SPLASH, Moves.INGRAIN ]);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
const enemyOpponent = game.scene.getEnemyPokemon();
expect(enemyOpponent).toBeDefined();
game.move.select(Moves.TELEKINESIS);
game.forceEnemyMove(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined();
await game.toNextTurn();
vi.spyOn(allMoves[Moves.MUD_SHOT], "accuracy", "get").mockReturnValue(0);
game.move.select(Moves.MUD_SHOT);
game.forceEnemyMove(Moves.INGRAIN);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.INGRAIN)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeUndefined();
expect(enemyOpponent?.hp).toBeLessThan(enemyOpponent!.getMaxHp());
});
}); });