Misc. Changes

This commit is contained in:
xsn34kzx 2025-08-01 12:12:16 -04:00 committed by NightKev
parent 32a56e9a5f
commit 255f4b0a25
4 changed files with 23 additions and 14 deletions

View File

@ -124,7 +124,7 @@ export abstract class Move implements Localizable {
/** /**
* Check if the move is of the given subclass without requiring `instanceof`. * Check if the move is of the given subclass without requiring `instanceof`.
* *
* ! Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those, * Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those,
* use {@linkcode isChargingMove} instead. * use {@linkcode isChargingMove} instead.
* *
* @param moveKind - The string name of the move to check against * @param moveKind - The string name of the move to check against

View File

@ -1,9 +1,7 @@
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
import { ChallengeType } from "#enums/challenge-type";
import type { MoveId } from "#enums/move-id"; import type { MoveId } from "#enums/move-id";
import type { Pokemon } from "#field/pokemon"; import type { Pokemon } from "#field/pokemon";
import type { Move } from "#moves/move"; import type { Move } from "#moves/move";
import { applyChallenges } from "#utils/challenge-utils";
import { toDmgValue } from "#utils/common"; import { toDmgValue } from "#utils/common";
/** /**
@ -47,12 +45,14 @@ export class PokemonMove {
* @returns Whether this {@linkcode PokemonMove} can be selected by this Pokemon. * @returns Whether this {@linkcode PokemonMove} can be selected by this Pokemon.
*/ */
isUsable(pokemon: Pokemon, ignorePp = false, ignoreRestrictionTags = false): boolean { isUsable(pokemon: Pokemon, ignorePp = false, ignoreRestrictionTags = false): boolean {
const move = this.getMove();
// TODO: Add Sky Drop's 1 turn stall // TODO: Add Sky Drop's 1 turn stall
return ( return (
!(this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)) && !(this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)) &&
(ignorePp || this.ppUsed < this.getMovePp() || this.getMove().pp === -1) && (ignorePp || this.ppUsed < this.getMovePp() || move.pp === -1) &&
(!pokemon.isPlayer() || applyChallenges(ChallengeType.POKEMON_MOVE, this.moveId)) && // TODO: Fix apply calls
!this.getMove().name.endsWith(" (N)") //(!pokemon.isPlayer() || applyChallenges(ChallengeType.POKEMON_MOVE, this.moveId)) &&
!move.name.endsWith(" (N)")
); );
} }

View File

@ -212,16 +212,25 @@ export class CommandPhase extends FieldPhase {
const move = user.getMoveset()[cursor]; const move = user.getMoveset()[cursor];
globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.setMode(UiMode.MESSAGE);
// Decides between a Disabled, Not Implemented, or No PP translation message // Set the translation key for why the move cannot be selected
const errorMessage = user.isMoveRestricted(move.moveId, user) let cannotSelectKey: string;
? user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId) if (user.isMoveRestricted(move.moveId, user)) {
: move.getName().endsWith(" (N)") cannotSelectKey = user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId);
? "battle:moveNotImplemented" } else if (move.getPpRatio() === 0) {
: "battle:moveNoPP"; cannotSelectKey = "battle:moveNoPP";
} else if (!applyChallenges(ChallengeType.POKEMON_MOVE, move.moveId)) {
cannotSelectKey = "battle:moveCannotUseChallenge";
} else if (move.getName().endsWith(" (N)")) {
cannotSelectKey = "battle:moveNotImplemented";
} else {
// TODO: Consider a message that signals a being unusable for an unknown reason
cannotSelectKey = "";
}
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
globalScene.ui.showText( globalScene.ui.showText(
i18next.t(errorMessage, { moveName: moveName }), i18next.t(cannotSelectKey, { moveName: moveName }),
null, null,
() => { () => {
globalScene.ui.clearText(); globalScene.ui.clearText();

View File

@ -65,7 +65,7 @@ export class VictoryPhase extends PokemonPhase {
break; break;
} }
} }
if (globalScene.currentBattle.waveIndex % 10 !== 0 || !applyChallenges(ChallengeType.PARTY_HEAL)) { if (globalScene.currentBattle.waveIndex % 10 || !applyChallenges(ChallengeType.PARTY_HEAL)) {
globalScene.phaseManager.pushNew( globalScene.phaseManager.pushNew(
"SelectModifierPhase", "SelectModifierPhase",
undefined, undefined,