From 3d5a46b1ec229031b71bcfbb829e6cfb00714d4f Mon Sep 17 00:00:00 2001 From: Fabi <192151969+fabske0@users.noreply.github.com> Date: Mon, 27 Oct 2025 19:37:33 +0100 Subject: [PATCH] [BUG] Fix quick claw being blocked by Psychic terrain (#6684) * Fix quick claw being blocked * Add tests * Apply suggestions from code review Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> * fix test + run biome * Update comments in `terrain.ts` * Apply test suggestions * added newlines --------- Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/terrain.ts | 6 ++-- test/arena/psychic-terrain.test.ts | 44 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/data/terrain.ts b/src/data/terrain.ts index 315ed919e03..bd90f3985b4 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -64,12 +64,10 @@ export class Terrain { switch (this.terrainType) { case TerrainType.PSYCHIC: // Cf https://bulbapedia.bulbagarden.net/wiki/Psychic_Terrain_(move)#Generation_VII - // Psychic terrain will only cancel a move if it: return ( - // ... is neither spread nor field-targeted, !isFieldTargeted(move) - && !isSpreadMove(move) // .. has positive final priority, - && move.getPriority(user) > 0 // ...and is targeting at least 1 grounded opponent + && !isSpreadMove(move) + && move.getPriority(user) > 0.2 // fractional priority is used by quick claw etc and is not blocked by terrain && user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()) ); } diff --git a/test/arena/psychic-terrain.test.ts b/test/arena/psychic-terrain.test.ts index 6d42ed0d3ac..6112db41cd8 100644 --- a/test/arena/psychic-terrain.test.ts +++ b/test/arena/psychic-terrain.test.ts @@ -1,3 +1,5 @@ +import { allMoves } from "#data/data-lists"; +import { TerrainType } from "#data/terrain"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; @@ -56,4 +58,46 @@ describe("Arena - Psychic Terrain", () => { expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.RAIN); }); + + it("should not block non-priority moves boosted by Quick Claw", async () => { + game.override.startingHeldItems([{ name: "QUICK_CLAW", count: 10 }]); + await game.classicMode.startBattle([SpeciesId.FEEBAS]); + + game.move.use(MoveId.PSYCHIC_TERRAIN); + await game.toNextTurn(); + + expect(game).toHaveTerrain(TerrainType.PSYCHIC); + + game.move.use(MoveId.POUND); + await game.phaseInterceptor.to("MovePhase", false); + + const feebas = game.field.getPlayerPokemon(); + expect(allMoves[MoveId.POUND].getPriority(feebas)).toBe(0.2); + + await game.toEndOfTurn(); + + const shuckle = game.field.getEnemyPokemon(); + expect(shuckle).not.toHaveFullHp(); + }); + + it("should block priority moves boosted by Quick Claw", async () => { + game.override.startingHeldItems([{ name: "QUICK_CLAW", count: 10 }]); + await game.classicMode.startBattle([SpeciesId.FEEBAS]); + + game.move.use(MoveId.PSYCHIC_TERRAIN); + await game.toNextTurn(); + + expect(game).toHaveTerrain(TerrainType.PSYCHIC); + + game.move.use(MoveId.QUICK_ATTACK); + await game.phaseInterceptor.to("MovePhase", false); + + const feebas = game.field.getPlayerPokemon(); + expect(allMoves[MoveId.QUICK_ATTACK].getPriority(feebas)).toBe(1.2); + + await game.toEndOfTurn(); + + const shuckle = game.field.getEnemyPokemon(); + expect(shuckle).toHaveFullHp(); + }); });