[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>
This commit is contained in:
Fabi 2025-10-27 19:37:33 +01:00 committed by GitHub
parent 2acf73e8cb
commit 3d5a46b1ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 4 deletions

View File

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

View File

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