mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-21 04:25:50 +02:00
* Heal Block on new branch * Add/update code from previous PR * Re-add i18n from previous PR Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com> * Disabling Moves * Still need to update tests and write docs * removing partial tags from abilities to feel better * Pollen Puff works now * Implemented Psychic Noise * typedocs * Documentation * Update src/data/battler-tags.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/data/battler-tags.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/data/battler-tags.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Turns out the old condition wasn't buggy. Probably mixed up another change I made. * changed array clear --------- Co-authored-by: frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com>
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { BattlerIndex } from "#app/battle";
|
|
import { Command } from "#app/ui/command-ui-handler";
|
|
import { Mode } from "#app/ui/ui";
|
|
import { CommandPhase } from "./command-phase";
|
|
import { PokemonPhase } from "./pokemon-phase";
|
|
import i18next from "#app/plugins/i18n";
|
|
import { allMoves } from "#app/data/move";
|
|
|
|
export class SelectTargetPhase extends PokemonPhase {
|
|
constructor(scene: BattleScene, fieldIndex: integer) {
|
|
super(scene, fieldIndex);
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const turnCommand = this.scene.currentBattle.turnCommands[this.fieldIndex];
|
|
const move = turnCommand?.move?.move;
|
|
this.scene.ui.setMode(Mode.TARGET_SELECT, this.fieldIndex, move, (targets: BattlerIndex[]) => {
|
|
this.scene.ui.setMode(Mode.MESSAGE);
|
|
const fieldSide = this.scene.getField();
|
|
const user = fieldSide[this.fieldIndex];
|
|
const moveObject = allMoves[move!];
|
|
if (moveObject && user.isMoveTargetRestricted(moveObject.id, user, fieldSide[targets[0]])) {
|
|
const errorMessage = user.getRestrictingTag(move!, user, fieldSide[targets[0]])!.selectionDeniedText(user, moveObject.id);
|
|
user.scene.queueMessage(i18next.t(errorMessage, { moveName: moveObject.name }), 0, true);
|
|
targets = [];
|
|
}
|
|
if (targets.length < 1) {
|
|
this.scene.currentBattle.turnCommands[this.fieldIndex] = null;
|
|
this.scene.unshiftPhase(new CommandPhase(this.scene, this.fieldIndex));
|
|
} else {
|
|
turnCommand!.targets = targets; //TODO: is the bang correct here?
|
|
}
|
|
if (turnCommand?.command === Command.BALL && this.fieldIndex) {
|
|
this.scene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; //TODO: is the bang correct here?
|
|
}
|
|
this.end();
|
|
});
|
|
}
|
|
}
|