This commit is contained in:
frutescens 2024-10-01 13:02:18 -07:00
parent 6e85b79131
commit d0e782e25d
3 changed files with 9 additions and 6 deletions

View File

@ -23,7 +23,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
import { StatStageChangePhase, StatStageChangeCallback } from "#app/phases/stat-stage-change-phase"; import { StatStageChangePhase, StatStageChangeCallback } from "#app/phases/stat-stage-change-phase";
import { PokemonAnimType } from "#app/enums/pokemon-anim-type"; import { PokemonAnimType } from "#app/enums/pokemon-anim-type";
import { BattleScene } from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
export enum BattlerTagLapseType { export enum BattlerTagLapseType {
FAINT, FAINT,
@ -2524,6 +2524,9 @@ export class TormentTag extends MoveRestrictionBattlerTag {
* @returns `true` if there is valid consecutive usage | `false` if the moves are different from each other * @returns `true` if there is valid consecutive usage | `false` if the moves are different from each other
*/ */
override isMoveRestricted(move: Moves, user: Pokemon): boolean { override isMoveRestricted(move: Moves, user: Pokemon): boolean {
if (!user) {
return false;
}
const lastMove = user.getLastXMoves(1)[0]; const lastMove = user.getLastXMoves(1)[0];
if ( !lastMove ) { if ( !lastMove ) {
return false; return false;

View File

@ -3025,8 +3025,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* *
* @see {@linkcode MoveRestrictionBattlerTag} * @see {@linkcode MoveRestrictionBattlerTag}
*/ */
isMoveRestricted(moveId: Moves): boolean { isMoveRestricted(moveId: Moves, pokemon: Pokemon): boolean {
return this.getRestrictingTag(moveId) !== null; return this.getRestrictingTag(moveId, pokemon) !== null;
} }
/** /**
@ -5096,7 +5096,7 @@ export class PokemonMove {
* @returns `true` if the move can be selected and used by the Pokemon, otherwise `false`. * @returns `true` if the move can be selected and used by the Pokemon, otherwise `false`.
*/ */
isUsable(pokemon: Pokemon, ignorePp?: boolean, ignoreRestrictionTags?: boolean): boolean { isUsable(pokemon: Pokemon, ignorePp?: boolean, ignoreRestrictionTags?: boolean): boolean {
if (this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId)) { if (this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)) {
return false; return false;
} }

View File

@ -114,8 +114,8 @@ export class CommandPhase extends FieldPhase {
// Decides between a Disabled, Not Implemented, or No PP translation message // Decides between a Disabled, Not Implemented, or No PP translation message
const errorMessage = const errorMessage =
playerPokemon.isMoveRestricted(move.moveId) playerPokemon.isMoveRestricted(move.moveId, playerPokemon)
? playerPokemon.getRestrictingTag(move.moveId)!.selectionDeniedText(playerPokemon, move.moveId) ? playerPokemon.getRestrictingTag(move.moveId, playerPokemon)!.selectionDeniedText(playerPokemon, move.moveId)
: move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP"; : move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP";
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator