mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Move changes from old phases.ts
to src/phases/command-phase.ts
This commit is contained in:
parent
2f31e97fae
commit
54b180c3d4
@ -1,21 +1,21 @@
|
|||||||
import BattleScene from "#app/battle-scene.js";
|
import { BattleType, TurnCommand } from "#app/battle";
|
||||||
import { TurnCommand, BattleType } from "#app/battle.js";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { applyCheckTrappedAbAttrs, CheckTrappedAbAttr } from "#app/data/ability.js";
|
import { applyCheckTrappedAbAttrs, CheckTrappedAbAttr } from "#app/data/ability";
|
||||||
import { TrappedTag, EncoreTag } from "#app/data/battler-tags.js";
|
import { DamagingTrapTag, EncoreTag, TrappedTag } from "#app/data/battler-tags";
|
||||||
import { MoveTargetSet, getMoveTargets } from "#app/data/move.js";
|
import { getMoveTargets, MoveTargetSet } from "#app/data/move";
|
||||||
import { speciesStarters } from "#app/data/pokemon-species.js";
|
import { speciesStarters } from "#app/data/pokemon-species";
|
||||||
import { Type } from "#app/data/type.js";
|
import { Type } from "#app/data/type";
|
||||||
import { Abilities } from "#app/enums/abilities.js";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
import { Biome } from "#app/enums/biome.js";
|
import { Biome } from "#app/enums/biome";
|
||||||
import { Moves } from "#app/enums/moves.js";
|
import { Moves } from "#app/enums/moves";
|
||||||
import { PokeballType } from "#app/enums/pokeball.js";
|
import { PokeballType } from "#app/enums/pokeball";
|
||||||
import { FieldPosition, PlayerPokemon } from "#app/field/pokemon.js";
|
import { FieldPosition, PlayerPokemon } from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages.js";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { Command } from "#app/ui/command-ui-handler.js";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import { Mode } from "#app/ui/ui.js";
|
import { Mode } from "#app/ui/ui";
|
||||||
|
import * as Utils from "#app/utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils.js";
|
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { SelectTargetPhase } from "./select-target-phase";
|
import { SelectTargetPhase } from "./select-target-phase";
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||||
}, null, true);
|
}, null, true);
|
||||||
} else {
|
} else {
|
||||||
const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag;
|
const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag);
|
||||||
const trapped = new Utils.BooleanHolder(false);
|
const trapped = new Utils.BooleanHolder(false);
|
||||||
const batonPass = isSwitch && args[0] as boolean;
|
const batonPass = isSwitch && args[0] as boolean;
|
||||||
const trappedAbMessages: string[] = [];
|
const trappedAbMessages: string[] = [];
|
||||||
@ -200,7 +200,9 @@ export class CommandPhase extends FieldPhase {
|
|||||||
this.scene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
this.scene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
||||||
}
|
}
|
||||||
} else if (trapTag) {
|
} else if (trapTag) {
|
||||||
if (trapTag.sourceMove === Moves.INGRAIN && trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId)?.isOfType(Type.GHOST)) {
|
const isGhostPokemon = this.scene.getPokemonById(trapTag.sourceId!)?.isOfType(Type.GHOST);
|
||||||
|
const canSwitch = (trapTag.sourceMove === Moves.INGRAIN && isGhostPokemon) || (trapTag instanceof DamagingTrapTag && isGhostPokemon);
|
||||||
|
if (canSwitch) {
|
||||||
success = true;
|
success = true;
|
||||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||||
|
Loading…
Reference in New Issue
Block a user