mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
Misc. Changes
This commit is contained in:
parent
5c2c7cf3d1
commit
809a981893
@ -124,7 +124,7 @@ export abstract class Move implements Localizable {
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param moveKind - The string name of the move to check against
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { allMoves } from "#data/data-lists";
|
||||
import { ChallengeType } from "#enums/challenge-type";
|
||||
import type { MoveId } from "#enums/move-id";
|
||||
import type { Pokemon } from "#field/pokemon";
|
||||
import type { Move } from "#moves/move";
|
||||
import { applyChallenges } from "#utils/challenge-utils";
|
||||
import { toDmgValue } from "#utils/common";
|
||||
|
||||
/**
|
||||
@ -47,12 +45,14 @@ export class PokemonMove {
|
||||
* @returns Whether this {@linkcode PokemonMove} can be selected by this Pokemon.
|
||||
*/
|
||||
isUsable(pokemon: Pokemon, ignorePp = false, ignoreRestrictionTags = false): boolean {
|
||||
const move = this.getMove();
|
||||
// TODO: Add Sky Drop's 1 turn stall
|
||||
return (
|
||||
!(this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)) &&
|
||||
(ignorePp || this.ppUsed < this.getMovePp() || this.getMove().pp === -1) &&
|
||||
(!pokemon.isPlayer() || applyChallenges(ChallengeType.POKEMON_MOVE, this.moveId)) &&
|
||||
!this.getMove().name.endsWith(" (N)")
|
||||
(ignorePp || this.ppUsed < this.getMovePp() || move.pp === -1) &&
|
||||
// TODO: Fix apply calls
|
||||
//(!pokemon.isPlayer() || applyChallenges(ChallengeType.POKEMON_MOVE, this.moveId)) &&
|
||||
!move.name.endsWith(" (N)")
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -213,24 +213,24 @@ export class CommandPhase extends FieldPhase {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
|
||||
// Set the translation key for why the move cannot be selected
|
||||
let cannotUseKey: string;
|
||||
let cannotSelectKey: string;
|
||||
if (user.isMoveRestricted(move.moveId, user)) {
|
||||
cannotUseKey = user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId);
|
||||
cannotSelectKey = user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId);
|
||||
} else if (move.getPpRatio() === 0) {
|
||||
cannotUseKey = "battle:moveNoPP";
|
||||
cannotSelectKey = "battle:moveNoPP";
|
||||
} else if (!applyChallenges(ChallengeType.POKEMON_MOVE, move.moveId)) {
|
||||
cannotUseKey = "battle:moveCannotUseChallenge";
|
||||
cannotSelectKey = "battle:moveCannotUseChallenge";
|
||||
} else if (move.getName().endsWith(" (N)")) {
|
||||
cannotUseKey = "battle:moveNotImplemented";
|
||||
cannotSelectKey = "battle:moveNotImplemented";
|
||||
} else {
|
||||
// TODO: Consider a message that signals a being unusable for an unknown reason
|
||||
cannotUseKey = "";
|
||||
cannotSelectKey = "";
|
||||
}
|
||||
|
||||
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
|
||||
|
||||
globalScene.ui.showText(
|
||||
i18next.t(cannotUseKey, { moveName: moveName }),
|
||||
i18next.t(cannotSelectKey, { moveName: moveName }),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.clearText();
|
||||
|
@ -65,7 +65,7 @@ export class VictoryPhase extends PokemonPhase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (globalScene.currentBattle.waveIndex % 10 !== 0 || !applyChallenges(ChallengeType.PARTY_HEAL)) {
|
||||
if (globalScene.currentBattle.waveIndex % 10 || !applyChallenges(ChallengeType.PARTY_HEAL)) {
|
||||
globalScene.phaseManager.pushNew(
|
||||
"SelectModifierPhase",
|
||||
undefined,
|
||||
|
Loading…
Reference in New Issue
Block a user