terrain: psychic terrain doesn't block priority moves on the user's side (#470)
parent
68eca464f7
commit
2c003854e9
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue