Fixes Struggle Softlock (#531)
* Fixes Struggle Softlock Fixed an issue where moves marked as (N) would prevent you from being able to Struggle. Also fixes messaging so that a message shows when you are out of PP, Disabled, or trying to use an unimplemented move consistently. * Update phases.tspull/565/head
parent
c41546b680
commit
2b4dc9a4f0
|
@ -3172,7 +3172,7 @@ export class PokemonMove {
|
|||
isUsable(pokemon: Pokemon, ignorePp?: boolean): boolean {
|
||||
if (this.moveId && pokemon.summonData?.disabledMove === this.moveId)
|
||||
return false;
|
||||
return ignorePp || this.ppUsed < this.getMovePp() || this.getMove().pp === -1;
|
||||
return (ignorePp || this.ppUsed < this.getMovePp() || this.getMove().pp === -1) && !this.getMove().name.endsWith(' (N)');
|
||||
}
|
||||
|
||||
getMove(): Move {
|
||||
|
|
|
@ -33,6 +33,7 @@ export const battle: SimpleTranslationEntries = {
|
|||
"learnMoveForgetSuccess": "{{pokemonName}} forgot how to\nuse {{moveName}}.",
|
||||
"levelCapUp": "Das Levellimit\nhat sich zu {{levelCap}} erhöht!",
|
||||
"moveNotImplemented": "{{moveName}} ist noch nicht implementiert und kann nicht ausgewählt werden.",
|
||||
"moveNoPP": "There's no PP left for\nthis move!",
|
||||
"moveDisabled": "{{moveName}} ist deaktiviert!",
|
||||
"noPokeballForce": "Eine unsichtbare Kraft\nverhindert die Nutzung von Pokébällen.",
|
||||
"noPokeballTrainer": "Du kannst das Pokémon\neines anderen Trainers nicht fangen!",
|
||||
|
|
|
@ -33,6 +33,7 @@ export const battle: SimpleTranslationEntries = {
|
|||
"learnMoveForgetSuccess": "{{pokemonName}} forgot how to\nuse {{moveName}}.",
|
||||
"levelCapUp": "The level cap\nhas increased to {{levelCap}}!",
|
||||
"moveNotImplemented": "{{moveName}} is not yet implemented and cannot be selected.",
|
||||
"moveNoPP": "There's no PP left for\nthis move!",
|
||||
"moveDisabled": "{{moveName}} is disabled!",
|
||||
"noPokeballForce": "An unseen force\nprevents using Poké Balls.",
|
||||
"noPokeballTrainer": "You can't catch\nanother trainer's Pokémon!",
|
||||
|
|
|
@ -33,6 +33,7 @@ export const battle: SimpleTranslationEntries = {
|
|||
"learnMoveForgetSuccess": "{{pokemonName}} ha olvidado cómo utilizar {{moveName}}.",
|
||||
"levelCapUp": "¡Se ha incrementado el\nnivel máximo a {{levelCap}}!",
|
||||
"moveNotImplemented": "{{moveName}} aún no está implementado y no se puede seleccionar.",
|
||||
"moveNoPP": "There's no PP left for\nthis move!",
|
||||
"moveDisabled": "!No puede usar {{moveName}} porque ha sido anulado!",
|
||||
"noPokeballForce": "Una fuerza misteriosa\nte impide usar Poké Balls.",
|
||||
"noPokeballTrainer": "¡No puedes atrapar a los\nPokémon de los demás!",
|
||||
|
|
|
@ -33,6 +33,7 @@ export const battle: SimpleTranslationEntries = {
|
|||
"learnMoveForgetSuccess": "{{pokemonName}} oublie comment\nutiliser {{moveName}}.",
|
||||
"levelCapUp": "La limite de niveau\na été augmentée à {{levelCap}} !",
|
||||
"moveNotImplemented": "{{moveName}} n’est pas encore implémenté et ne peut pas être sélectionné.",
|
||||
"moveNoPP": "There's no PP left for\nthis move!",
|
||||
"moveDisabled": "{{moveName}} est sous entrave !",
|
||||
"noPokeballForce": "Une force mystérieuse\nempêche l’utilisation des Poké Balls.",
|
||||
"noPokeballTrainer": "Le Dresseur détourne la Ball\nVoler, c’est mal !",
|
||||
|
|
|
@ -33,6 +33,7 @@ export const battle: SimpleTranslationEntries = {
|
|||
"learnMoveForgetSuccess": "{{pokemonName}} ha dimenticato la mossa\n{{moveName}}.",
|
||||
"levelCapUp": "Il livello massimo\nè aumentato a {{levelCap}}!",
|
||||
"moveNotImplemented": "{{moveName}} non è ancora implementata e non può essere selezionata.",
|
||||
"moveNoPP": "There's no PP left for\nthis move!",
|
||||
"moveDisabled": "{{moveName}} è disabilitata!",
|
||||
"noPokeballForce": "Una forza misteriosa\nimpedisce l'uso dell Poké Ball.",
|
||||
"noPokeballTrainer": "Non puoi catturare\nPokémon di altri allenatori!",
|
||||
|
|
|
@ -1680,21 +1680,13 @@ export class CommandPhase extends FieldPhase {
|
|||
switch (command) {
|
||||
case Command.FIGHT:
|
||||
let useStruggle = false;
|
||||
if (cursor === -1 || playerPokemon.trySelectMove(cursor, args[0] as boolean) || (useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m.isUsable(playerPokemon)).length)) {
|
||||
if (cursor === -1 ||
|
||||
playerPokemon.trySelectMove(cursor, args[0] as boolean) ||
|
||||
(useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m.isUsable(playerPokemon)).length)) {
|
||||
const moveId = !useStruggle ? cursor > -1 ? playerPokemon.getMoveset()[cursor].moveId : Moves.NONE : Moves.STRUGGLE;
|
||||
const turnCommand: TurnCommand = { command: Command.FIGHT, cursor: cursor, move: { move: moveId, targets: [], ignorePP: args[0] }, args: args };
|
||||
const moveTargets: MoveTargetSet = args.length < 3 ? getMoveTargets(playerPokemon, moveId) : args[2];
|
||||
if (moveId) {
|
||||
const move = playerPokemon.getMoveset()[cursor];
|
||||
if (move.getName().endsWith(' (N)')) {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t('battle:moveNotImplemented', { moveName: move.getName().slice(0, -4) }), null, () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
}, null, true);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
if (!moveId)
|
||||
turnCommand.targets = [ this.fieldIndex ];
|
||||
console.log(moveTargets, playerPokemon.name);
|
||||
if (moveTargets.targets.length <= 1 || moveTargets.multiple)
|
||||
|
@ -1705,15 +1697,21 @@ export class CommandPhase extends FieldPhase {
|
|||
this.scene.unshiftPhase(new SelectTargetPhase(this.scene, this.fieldIndex));
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = turnCommand;
|
||||
success = true;
|
||||
} else if (cursor < playerPokemon.getMoveset().length) {
|
||||
}
|
||||
else if (cursor < playerPokemon.getMoveset().length) {
|
||||
const move = playerPokemon.getMoveset()[cursor];
|
||||
if (playerPokemon.summonData.disabledMove === move.moveId) {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t('battle:moveDisabled', { moveName: move.getName() }), null, () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
}, null, true);
|
||||
}
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
|
||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||
const errorMessage =
|
||||
playerPokemon.summonData.disabledMove === move.moveId ? 'battle:moveDisabled' :
|
||||
move.getName().endsWith(' (N)') ? 'battle:moveNotImplemented' : 'battle:moveNoPP';
|
||||
const moveName = move.getName().replace(' (N)', ''); // Trims off the indicator
|
||||
|
||||
this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
}, null, true);
|
||||
}
|
||||
break;
|
||||
case Command.BALL:
|
||||
|
|
Loading…
Reference in New Issue