terrain: psychic terrain doesn't block priority moves on the user's side (#470)

pull/472/head
Madi Simpson 2024-05-04 18:45:37 -07:00 committed by GitHub
parent 68eca464f7
commit 2c003854e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import { Type } from "./type";
import * as Utils from "../utils";
import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability";
import { ProtectAttr } from "./move";
import { BattlerIndex } from "#app/battle.js";
export enum TerrainType {
NONE,
@ -48,13 +49,13 @@ export class Terrain {
return 1;
}
isMoveTerrainCancelled(user: Pokemon, move: Move): boolean {
isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean {
switch (this.terrainType) {
case TerrainType.PSYCHIC:
if (!move.getAttrs(ProtectAttr).length){
if (!move.getAttrs(ProtectAttr).length) {
const priority = new Utils.IntegerHolder(move.priority);
applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority);
return priority.value > 0;
return priority.value > 0 && user.getOpponents().filter(o => targets.includes(o.getBattlerIndex())).length > 0;
}
}

View File

@ -336,8 +336,8 @@ export class Arena {
return this.weather && !this.weather.isEffectSuppressed(this.scene) && this.weather.isMoveWeatherCancelled(move);
}
isMoveTerrainCancelled(user: Pokemon, move: Move) {
return this.terrain && this.terrain.isMoveTerrainCancelled(user, move);
isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move) {
return this.terrain && this.terrain.isMoveTerrainCancelled(user, targets, move);
}
getTerrainType() : TerrainType {

View File

@ -2280,7 +2280,7 @@ export class MovePhase extends BattlePhase {
let failedText = null;
if (success && this.scene.arena.isMoveWeatherCancelled(this.move.getMove()))
success = false;
else if (success && this.scene.arena.isMoveTerrainCancelled(this.pokemon, this.move.getMove())) {
else if (success && this.scene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, this.move.getMove())) {
success = false;
failedText = getTerrainBlockMessage(targets[0], this.scene.arena.terrain.terrainType);
}