mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
[Bug] Libero now triggers if move is stopped by Psychic Terrain
This commit is contained in:
parent
9746f1a2a6
commit
c9d1a57b3c
@ -48,7 +48,7 @@ import { MoveTarget } from "#enums/MoveTarget";
|
|||||||
import { MoveCategory } from "#enums/MoveCategory";
|
import { MoveCategory } from "#enums/MoveCategory";
|
||||||
import { SpeciesFormChangePostMoveTrigger } from "#app/data/pokemon-forms";
|
import { SpeciesFormChangePostMoveTrigger } from "#app/data/pokemon-forms";
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
import { DamageResult, PokemonMove, type TurnMove } from "#app/field/pokemon";
|
import { type DamageResult, PokemonMove, type TurnMove } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HitResult, MoveResult } from "#app/field/pokemon";
|
import { HitResult, MoveResult } from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
@ -72,7 +72,7 @@ import { ShowAbilityPhase } from "./show-ability-phase";
|
|||||||
import { MovePhase } from "./move-phase";
|
import { MovePhase } from "./move-phase";
|
||||||
import { MoveEndPhase } from "./move-end-phase";
|
import { MoveEndPhase } from "./move-end-phase";
|
||||||
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
||||||
import { TypeDamageMultiplier } from "#app/data/type";
|
import type { TypeDamageMultiplier } from "#app/data/type";
|
||||||
import { HitCheckResult } from "#enums/hit-check-result";
|
import { HitCheckResult } from "#enums/hit-check-result";
|
||||||
import type Move from "#app/data/moves/move";
|
import type Move from "#app/data/moves/move";
|
||||||
import { isFieldTargeted } from "#app/data/moves/move-utils";
|
import { isFieldTargeted } from "#app/data/moves/move-utils";
|
||||||
@ -547,6 +547,12 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
return [HitCheckResult.MISS, 0];
|
return [HitCheckResult.MISS, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Protection from Psychic Terrain applies before Magic Bounce/Coat and Protect/etc
|
||||||
|
if (globalScene.arena.isMoveTerrainCancelled(user, this.targets, move)) {
|
||||||
|
// getTerrainBlockMessage(targets[0], globalScene.arena.getTerrainType());
|
||||||
|
return [HitCheckResult.NO_EFFECT, 0];
|
||||||
|
}
|
||||||
|
|
||||||
if (!fieldTargeted && this.protectedCheck(user, target)) {
|
if (!fieldTargeted && this.protectedCheck(user, target)) {
|
||||||
return [HitCheckResult.PROTECTED, 0];
|
return [HitCheckResult.PROTECTED, 0];
|
||||||
}
|
}
|
||||||
@ -809,7 +815,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
*/
|
*/
|
||||||
applyMoveAttrs(StatChangeBeforeDmgCalcAttr, user, target, this.move);
|
applyMoveAttrs(StatChangeBeforeDmgCalcAttr, user, target, this.move);
|
||||||
|
|
||||||
const { result: result, damage: dmg } = target.getAttackDamage({
|
const { result, damage: dmg } = target.getAttackDamage({
|
||||||
source: user,
|
source: user,
|
||||||
move: this.move,
|
move: this.move,
|
||||||
ignoreAbility: false,
|
ignoreAbility: false,
|
||||||
|
@ -31,7 +31,7 @@ import { MoveFlags } from "#enums/MoveFlags";
|
|||||||
import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms";
|
import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms";
|
||||||
import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect";
|
import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect";
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
import { getTerrainBlockMessage, getWeatherBlockMessage } from "#app/data/weather";
|
import { getWeatherBlockMessage } from "#app/data/weather";
|
||||||
import { MoveUsedEvent } from "#app/events/battle-scene";
|
import { MoveUsedEvent } from "#app/events/battle-scene";
|
||||||
import type { PokemonMove } from "#app/field/pokemon";
|
import type { PokemonMove } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
@ -156,7 +156,8 @@ export class MovePhase extends BattlePhase {
|
|||||||
this.showMoveText();
|
this.showMoveText();
|
||||||
this.showFailedText();
|
this.showFailedText();
|
||||||
}
|
}
|
||||||
return this.end();
|
this.end();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pokemon.turnData.acted = true;
|
this.pokemon.turnData.acted = true;
|
||||||
@ -168,14 +169,13 @@ export class MovePhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check move to see if arena.ignoreAbilities should be true.
|
// Check move to see if arena.ignoreAbilities should be true.
|
||||||
if (!this.followUp || this.reflected) {
|
if (
|
||||||
if (
|
(!this.followUp || this.reflected) &&
|
||||||
this.move
|
this.move
|
||||||
.getMove()
|
.getMove()
|
||||||
.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user: this.pokemon, isFollowUp: this.followUp })
|
.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user: this.pokemon, isFollowUp: this.followUp })
|
||||||
) {
|
) {
|
||||||
globalScene.arena.setIgnoreAbilities(true, this.pokemon.getBattlerIndex());
|
globalScene.arena.setIgnoreAbilities(true, this.pokemon.getBattlerIndex());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resolveRedirectTarget();
|
this.resolveRedirectTarget();
|
||||||
@ -329,7 +329,8 @@ export class MovePhase extends BattlePhase {
|
|||||||
if (fail) {
|
if (fail) {
|
||||||
this.showMoveText();
|
this.showMoveText();
|
||||||
this.showFailedText();
|
this.showFailedText();
|
||||||
return this.end();
|
this.end();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,13 +381,11 @@ export class MovePhase extends BattlePhase {
|
|||||||
* Move conditions assume the move has a single target
|
* Move conditions assume the move has a single target
|
||||||
* TODO: is this sustainable?
|
* TODO: is this sustainable?
|
||||||
*/
|
*/
|
||||||
let failedDueToTerrain = false;
|
|
||||||
let failedDueToWeather = false;
|
let failedDueToWeather = false;
|
||||||
if (success) {
|
if (success) {
|
||||||
const passesConditions = move.applyConditions(this.pokemon, targets[0], move);
|
const passesConditions = move.applyConditions(this.pokemon, targets[0], move);
|
||||||
failedDueToWeather = globalScene.arena.isMoveWeatherCancelled(this.pokemon, move);
|
failedDueToWeather = globalScene.arena.isMoveWeatherCancelled(this.pokemon, move);
|
||||||
failedDueToTerrain = globalScene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, move);
|
success = passesConditions && !failedDueToWeather;
|
||||||
success = passesConditions && !failedDueToWeather && !failedDueToTerrain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the battle's "last move" pointer, unless we're currently mimicking a move.
|
// Update the battle's "last move" pointer, unless we're currently mimicking a move.
|
||||||
@ -425,8 +424,6 @@ export class MovePhase extends BattlePhase {
|
|||||||
let failedText: string | undefined;
|
let failedText: string | undefined;
|
||||||
if (failureMessage) {
|
if (failureMessage) {
|
||||||
failedText = failureMessage;
|
failedText = failureMessage;
|
||||||
} else if (failedDueToTerrain) {
|
|
||||||
failedText = getTerrainBlockMessage(targets[0], globalScene.arena.getTerrainType());
|
|
||||||
} else if (failedDueToWeather) {
|
} else if (failedDueToWeather) {
|
||||||
failedText = getWeatherBlockMessage(globalScene.arena.getWeatherType());
|
failedText = getWeatherBlockMessage(globalScene.arena.getWeatherType());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user