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(); + }); });