fix for Psychic Terrain blocking Protect Moves

This commit is contained in:
spongario 2024-04-11 23:04:17 -04:00 committed by Samuel H
parent 58ef8f5aec
commit 07ff22e53d

View File

@ -3,6 +3,7 @@ import Move from "./move";
import { Type } from "./type"; import { Type } from "./type";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability"; import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability";
import { ProtectAttr } from "./move";
export enum TerrainType { export enum TerrainType {
NONE, NONE,
@ -50,9 +51,12 @@ export class Terrain {
isMoveTerrainCancelled(user: Pokemon, move: Move): boolean { isMoveTerrainCancelled(user: Pokemon, move: Move): boolean {
switch (this.terrainType) { switch (this.terrainType) {
case TerrainType.PSYCHIC: case TerrainType.PSYCHIC:
const priority = new Utils.IntegerHolder(move.priority); if (!move.getAttrs(ProtectAttr).length )
applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority); {
return priority.value > 0; const priority = new Utils.IntegerHolder(move.priority);
applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority);
return priority.value > 0;
}
} }
return false; return false;