Move command to own file

This commit is contained in:
Sirz Benjie 2025-06-08 11:14:49 -05:00
parent 98b72b8795
commit 2745a1b9d5
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
22 changed files with 29 additions and 28 deletions

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { Command } from "./ui/command-ui-handler"; import type { Command } from "#enums/command";
import { import {
randomString, randomString,
getEnumValues, getEnumValues,

View File

@ -44,7 +44,7 @@ import {
SpeciesFormChangeWeatherTrigger, SpeciesFormChangeWeatherTrigger,
} from "#app/data/pokemon-forms"; } from "#app/data/pokemon-forms";
import i18next from "i18next"; import i18next from "i18next";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { BerryModifierType } from "#app/modifier/modifier-type"; import { BerryModifierType } from "#app/modifier/modifier-type";
import { getPokeballName } from "#app/data/pokeball"; import { getPokeballName } from "#app/data/pokeball";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";

View File

@ -80,7 +80,7 @@ import type { BattlerIndex } from "#enums/battler-index";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import { TerrainType } from "../terrain"; import { TerrainType } from "../terrain";
import { ModifierPoolType } from "#app/modifier/modifier-type"; import { ModifierPoolType } from "#app/modifier/modifier-type";
import { Command } from "../../ui/command-ui-handler"; import { Command } from "#enums/command";
import i18next from "i18next"; import i18next from "i18next";
import type { Localizable } from "#app/@types/locales"; import type { Localizable } from "#app/@types/locales";
import { getBerryEffectFunc } from "../berry"; import { getBerryEffectFunc } from "../berry";

8
src/enums/command.ts Normal file
View File

@ -0,0 +1,8 @@
export enum Command {
FIGHT = 0,
BALL,
POKEMON,
RUN,
TERA
}

View File

@ -10,7 +10,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import { LearnMoveType } from "#app/phases/learn-move-phase"; import { LearnMoveType } from "#app/phases/learn-move-phase";
import type { VoucherType } from "#app/system/voucher"; import type { VoucherType } from "#app/system/voucher";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject, TextStyle } from "#app/ui/text";
import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, randSeedFloat, toDmgValue } from "#app/utils/common"; import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, randSeedFloat, toDmgValue } from "#app/utils/common";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";

View File

@ -14,7 +14,7 @@ import { PokeballType } from "#enums/pokeball";
import type { PlayerPokemon, TurnMove } from "#app/field/pokemon"; import type { PlayerPokemon, TurnMove } from "#app/field/pokemon";
import { FieldPosition } from "#enums/field-position"; import { FieldPosition } from "#enums/field-position";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import i18next from "i18next"; import i18next from "i18next";
import { FieldPhase } from "./field-phase"; import { FieldPhase } from "./field-phase";

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { FieldPhase } from "./field-phase"; import { FieldPhase } from "./field-phase";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { BattlerIndex } from "#enums/battler-index"; import type { BattlerIndex } from "#enums/battler-index";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { PokemonPhase } from "./pokemon-phase"; import { PokemonPhase } from "./pokemon-phase";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";

View File

@ -14,7 +14,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { SwitchEffectTransferModifier } from "#app/modifier/modifier"; import { SwitchEffectTransferModifier } from "#app/modifier/modifier";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import i18next from "i18next"; import i18next from "i18next";
import { SummonPhase } from "./summon-phase"; import { SummonPhase } from "./summon-phase";
import { SubstituteTag } from "#app/data/battler-tags"; import { SubstituteTag } from "#app/data/battler-tags";

View File

@ -6,7 +6,7 @@ import { Stat } from "#app/enums/stat";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
import { PokemonMove } from "#app/data/moves/pokemon-move"; import { PokemonMove } from "#app/data/moves/pokemon-move";
import { BypassSpeedChanceModifier } from "#app/modifier/modifier"; import { BypassSpeedChanceModifier } from "#app/modifier/modifier";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { randSeedShuffle, BooleanHolder } from "#app/utils/common"; import { randSeedShuffle, BooleanHolder } from "#app/utils/common";
import { FieldPhase } from "./field-phase"; import { FieldPhase } from "./field-phase";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";

View File

@ -1,6 +1,6 @@
import { getPokeballName } from "../data/pokeball"; import { getPokeballName } from "../data/pokeball";
import { addTextObject, getTextStyleOptions, TextStyle } from "./text"; import { addTextObject, getTextStyleOptions, TextStyle } from "./text";
import { Command } from "./command-ui-handler"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -11,14 +11,7 @@ import { TerastallizeAccessModifier } from "#app/modifier/modifier";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { getTypeRgb } from "#app/data/type"; import { getTypeRgb } from "#app/data/type";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { Command } from "#enums/command";
export enum Command {
FIGHT = 0,
BALL,
POKEMON,
RUN,
TERA,
}
export default class CommandUiHandler extends UiHandler { export default class CommandUiHandler extends UiHandler {
private commandsContainer: Phaser.GameObjects.Container; private commandsContainer: Phaser.GameObjects.Container;

View File

@ -3,7 +3,7 @@ import { globalScene } from "#app/global-scene";
import { addTextObject, TextStyle } from "./text"; import { addTextObject, TextStyle } from "./text";
import { getTypeDamageMultiplierColor } from "#app/data/type"; import { getTypeDamageMultiplierColor } from "#app/data/type";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { Command } from "./command-ui-handler"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils/common"; import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils/common";

View File

@ -3,7 +3,7 @@ import type { PokemonMove } from "#app/data/moves/pokemon-move";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
import { MoveResult } from "#enums/move-result"; import { MoveResult } from "#enums/move-result";
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#app/ui/text"; import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#app/ui/text";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils/common"; import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils/common";

View File

@ -1,7 +1,7 @@
import { PokeballType } from "#app/enums/pokeball"; import { PokeballType } from "#app/enums/pokeball";
import { WeatherType } from "#app/enums/weather-type"; import { WeatherType } from "#app/enums/weather-type";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";

View File

@ -1,5 +1,5 @@
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";

View File

@ -1,6 +1,6 @@
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { PostSummonWeatherChangeAbAttr } from "#app/data/abilities/ability"; import { PostSummonWeatherChangeAbAttr } from "#app/data/abilities/ability";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { ArenaTagType } from "#enums/arena-tag-type"; import { ArenaTagType } from "#enums/arena-tag-type";

View File

@ -6,7 +6,7 @@ import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { AttemptRunPhase } from "#app/phases/attempt-run-phase"; import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
describe("Abilities - Speed Boost", () => { describe("Abilities - Speed Boost", () => {

View File

@ -1,6 +1,6 @@
import { AttemptRunPhase } from "#app/phases/attempt-run-phase"; import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { NumberHolder } from "#app/utils/common"; import { NumberHolder } from "#app/utils/common";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";

View File

@ -6,7 +6,7 @@ import { allMoves } from "#app/data/data-lists";
import { MoveResult } from "#enums/move-result"; import { MoveResult } from "#enums/move-result";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { ArenaTagType } from "#enums/arena-tag-type"; import { ArenaTagType } from "#enums/arena-tag-type";

View File

@ -22,7 +22,7 @@ import { CommandPhase } from "#app/phases/command-phase";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import { FunAndGamesEncounter } from "#app/data/mystery-encounters/encounters/fun-and-games-encounter"; import { FunAndGamesEncounter } from "#app/data/mystery-encounters/encounters/fun-and-games-encounter";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
const namespace = "mysteryEncounters/funAndGames"; const namespace = "mysteryEncounters/funAndGames";

View File

@ -6,7 +6,7 @@ import Overrides from "#app/overrides";
import type { CommandPhase } from "#app/phases/command-phase"; import type { CommandPhase } from "#app/phases/command-phase";
import type { EnemyCommandPhase } from "#app/phases/enemy-command-phase"; import type { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#enums/command";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { getMovePosition } from "#test/testUtils/gameManagerUtils"; import { getMovePosition } from "#test/testUtils/gameManagerUtils";