pokerogue/src/ui/party-ui-handler.ts

1285 lines
49 KiB
TypeScript
Raw Normal View History

import { CommandPhase, SelectModifierPhase } from "../phases";
import BattleScene from "../battle-scene";
2024-03-01 01:08:50 +00:00
import { PlayerPokemon, PokemonMove } from "../field/pokemon";
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text";
2023-03-28 19:54:52 +01:00
import { Command } from "./command-ui-handler";
import MessageUiHandler from "./message-ui-handler";
2023-04-06 03:22:03 +01:00
import { Mode } from "./ui";
2023-04-11 06:31:18 +01:00
import * as Utils from "../utils";
import { PokemonBaseStatModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
import { allMoves } from "../data/move";
2023-07-05 05:29:22 +01:00
import { getGenderColor, getGenderSymbol } from "../data/gender";
import { StatusEffect } from "../data/status-effect";
2024-03-01 01:08:50 +00:00
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler";
import { pokemonEvolutions } from "../data/pokemon-evolutions";
import { addWindow } from "./ui-theme";
2024-01-10 04:34:43 +00:00
import { SpeciesFormChangeItemTrigger } from "../data/pokemon-forms";
2024-04-19 03:52:26 +01:00
import { getVariantTint } from "#app/data/variant";
import {Button} from "#enums/buttons";
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
import { applyChallenges, ChallengeType } from "#app/data/challenge.js";
import MoveInfoOverlay from "./move-info-overlay";
import i18next from "i18next";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { Moves } from "#enums/moves";
2023-03-28 19:54:52 +01:00
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
const defaultMessage = i18next.t("partyUiHandler:choosePokemon");
2023-03-28 19:54:52 +01:00
2023-04-06 03:22:03 +01:00
export enum PartyUiMode {
SWITCH,
2023-04-06 05:15:33 +01:00
FAINT_SWITCH,
POST_BATTLE_SWITCH,
2024-05-20 00:02:17 +01:00
REVIVAL_BLESSING,
2023-04-11 06:31:18 +01:00
MODIFIER,
2023-04-11 16:04:39 +01:00
MOVE_MODIFIER,
TM_MODIFIER,
REMEMBER_MOVE_MODIFIER,
2023-04-21 19:05:16 +01:00
MODIFIER_TRANSFER,
2023-11-04 04:32:12 +00:00
SPLICE,
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
RELEASE,
CHECK,
SELECT
2023-04-06 03:22:03 +01:00
}
export enum PartyOption {
2023-04-21 19:05:16 +01:00
CANCEL = -1,
2023-04-06 03:22:03 +01:00
SEND_OUT,
2023-04-29 00:26:41 +01:00
PASS_BATON,
2024-05-20 00:02:17 +01:00
REVIVE,
2023-04-06 03:22:03 +01:00
APPLY,
TEACH,
2023-04-21 19:05:16 +01:00
TRANSFER,
2023-04-06 03:22:03 +01:00
SUMMARY,
2024-01-10 04:34:43 +00:00
UNPAUSE_EVOLUTION,
2024-04-03 01:51:43 +01:00
SPLICE,
UNSPLICE,
2023-04-11 06:31:18 +01:00
RELEASE,
SELECT,
SCROLL_UP = 1000,
SCROLL_DOWN = 1001,
2024-01-10 04:34:43 +00:00
FORM_CHANGE_ITEM = 2000,
MOVE_1 = 3000,
2023-04-11 16:04:39 +01:00
MOVE_2,
MOVE_3,
MOVE_4,
ALL = 4000
2023-04-06 03:22:03 +01:00
}
2023-04-11 16:04:39 +01:00
export type PartySelectCallback = (cursor: integer, option: PartyOption) => void;
export type PartyModifierTransferSelectCallback = (fromCursor: integer, index: integer, itemQuantity?: integer, toCursor?: integer) => void;
2023-11-04 04:32:12 +00:00
export type PartyModifierSpliceSelectCallback = (fromCursor: integer, toCursor?: integer) => void;
2023-04-11 16:04:39 +01:00
export type PokemonSelectFilter = (pokemon: PlayerPokemon) => string;
2023-04-21 19:05:16 +01:00
export type PokemonModifierTransferSelectFilter = (pokemon: PlayerPokemon, modifier: PokemonHeldItemModifier) => string;
2023-04-11 16:04:39 +01:00
export type PokemonMoveSelectFilter = (pokemonMove: PokemonMove) => string;
2023-03-28 19:54:52 +01:00
export default class PartyUiHandler extends MessageUiHandler {
2023-04-06 03:22:03 +01:00
private partyUiMode: PartyUiMode;
private fieldIndex: integer;
2023-04-06 03:22:03 +01:00
private partyBg: Phaser.GameObjects.Image;
2023-03-28 19:54:52 +01:00
private partyContainer: Phaser.GameObjects.Container;
private partySlotsContainer: Phaser.GameObjects.Container;
private partySlots: PartySlot[];
private partyCancelButton: PartyCancelButton;
private partyMessageBox: Phaser.GameObjects.NineSlice;
private moveInfoOverlay: MoveInfoOverlay;
2023-03-28 19:54:52 +01:00
private optionsMode: boolean;
private optionsScroll: boolean;
private optionsCursor: integer = 0;
private optionsScrollCursor: integer = 0;
private optionsScrollTotal: integer = 0;
/** This is only public for test/ui/transfer-item.test.ts */
public optionsContainer: Phaser.GameObjects.Container;
2024-01-10 04:34:43 +00:00
private optionsBg: Phaser.GameObjects.NineSlice;
private optionsCursorObj: Phaser.GameObjects.Image;
2023-04-06 03:22:03 +01:00
private options: integer[];
2023-04-21 19:05:16 +01:00
private transferMode: boolean;
private transferOptionCursor: integer;
private transferCursor: integer;
/** Current quantity selection for every item held by the pokemon selected for the transfer */
private transferQuantities: integer[];
/** Stack size of every item that the selected pokemon is holding */
private transferQuantitiesMax: integer[];
/** Whether to transfer all items */
private transferAll: boolean;
2024-05-24 00:45:04 +01:00
2023-03-28 19:54:52 +01:00
private lastCursor: integer = 0;
2023-04-21 19:05:16 +01:00
private selectCallback: PartySelectCallback | PartyModifierTransferSelectCallback;
private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter;
2023-04-11 16:04:39 +01:00
private moveSelectFilter: PokemonMoveSelectFilter;
private tmMoveId: Moves;
private showMovePp: boolean;
2023-03-28 19:54:52 +01:00
private iconAnimHandler: PokemonIconAnimHandler;
2023-03-28 19:54:52 +01:00
private static FilterAll = (_pokemon: PlayerPokemon) => null;
public static FilterNonFainted = (pokemon: PlayerPokemon) => {
if (pokemon.isFainted()) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:noEnergy", { pokemonName: pokemon.name });
}
2023-03-28 19:54:52 +01:00
return null;
};
2024-05-20 00:02:17 +01:00
public static FilterFainted = (pokemon: PlayerPokemon) => {
if (!pokemon.isFainted()) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:hasEnergy", { pokemonName: pokemon.name });
}
2024-05-20 00:02:17 +01:00
return null;
};
2024-05-20 00:02:17 +01:00
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
/**
* For consistency reasons, this looks like the above filters. However this is used only internally and is always enforced for switching.
* @param pokemon The pokemon to check.
* @returns
*/
private FilterChallengeLegal = (pokemon: PlayerPokemon) => {
const challengeAllowed = new Utils.BooleanHolder(true);
applyChallenges(this.scene.gameMode, ChallengeType.POKEMON_IN_BATTLE, pokemon, challengeAllowed);
if (!challengeAllowed.value) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:cantBeUsed", { pokemonName: pokemon.name });
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
}
return null;
};
2023-04-11 16:04:39 +01:00
private static FilterAllMoves = (_pokemonMove: PokemonMove) => null;
2023-04-21 19:05:16 +01:00
public static FilterItemMaxStacks = (pokemon: PlayerPokemon, modifier: PokemonHeldItemModifier) => {
const matchingModifier = pokemon.scene.findModifier(m => m instanceof PokemonHeldItemModifier && m.pokemonId === pokemon.id && m.matchType(modifier)) as PokemonHeldItemModifier;
if (matchingModifier && matchingModifier.stackCount === matchingModifier.getMaxStackCount(pokemon.scene)) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:tooManyItems", { pokemonName: pokemon.name });
}
2023-04-21 19:05:16 +01:00
return null;
};
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
public static NoEffectMessage = i18next.t("partyUiHandler:anyEffect");
2023-03-28 19:54:52 +01:00
private localizedOptions = [PartyOption.SEND_OUT, PartyOption.SUMMARY, PartyOption.CANCEL, PartyOption.APPLY, PartyOption.RELEASE, PartyOption.TEACH, PartyOption.SPLICE, PartyOption.UNSPLICE, PartyOption.REVIVE, PartyOption.TRANSFER, PartyOption.UNPAUSE_EVOLUTION, PartyOption.PASS_BATON, PartyOption.SELECT];
2023-03-28 19:54:52 +01:00
constructor(scene: BattleScene) {
super(scene, Mode.PARTY);
}
setup() {
const ui = this.getUi();
const partyContainer = this.scene.add.container(0, 0);
partyContainer.setName("party");
2023-03-28 19:54:52 +01:00
partyContainer.setVisible(false);
ui.add(partyContainer);
this.partyContainer = partyContainer;
this.partyBg = this.scene.add.image(0, 0, "party_bg");
this.partyBg.setName("img-party-bg");
partyContainer.add(this.partyBg);
2023-03-28 19:54:52 +01:00
this.partyBg.setOrigin(0, 1);
2023-03-28 19:54:52 +01:00
const partySlotsContainer = this.scene.add.container(0, 0);
partySlotsContainer.setName("party-slots");
2023-03-28 19:54:52 +01:00
partyContainer.add(partySlotsContainer);
this.partySlotsContainer = partySlotsContainer;
const partyMessageBoxContainer = this.scene.add.container(0, -32);
partyMessageBoxContainer.setName("party-msg-box");
2023-03-28 19:54:52 +01:00
partyContainer.add(partyMessageBoxContainer);
const partyMessageBox = addWindow(this.scene, 1, 31, 262, 30);
partyMessageBox.setName("window-party-msg-box");
2023-03-28 19:54:52 +01:00
partyMessageBox.setOrigin(0, 1);
partyMessageBoxContainer.add(partyMessageBox);
this.partyMessageBox = partyMessageBox;
const partyMessageText = addTextObject(this.scene, 10, 8, defaultMessage, TextStyle.WINDOW, { maxLines: 2 });
partyMessageText.setName("text-party-msg");
2024-05-24 00:45:04 +01:00
2023-03-28 19:54:52 +01:00
partyMessageText.setOrigin(0, 0);
partyMessageBoxContainer.add(partyMessageText);
this.message = partyMessageText;
const partyCancelButton = new PartyCancelButton(this.scene, 291, -16);
partyContainer.add(partyCancelButton);
this.partyCancelButton = partyCancelButton;
this.optionsContainer = this.scene.add.container((this.scene.game.canvas.width / 6) - 1, -1);
partyContainer.add(this.optionsContainer);
this.iconAnimHandler = new PokemonIconAnimHandler();
this.iconAnimHandler.setup(this.scene);
// prepare move overlay. in case it appears to be too big, set the overlayScale to .5
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay(this.scene, {
scale: overlayScale,
top: true,
x: 1,
y: -MoveInfoOverlay.getHeight(overlayScale) - 1, //this.scene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29,
width: this.scene.game.canvas.width / 12 - 30,
});
ui.add(this.moveInfoOverlay);
2023-04-06 03:22:03 +01:00
this.options = [];
2023-03-28 19:54:52 +01:00
this.partySlots = [];
}
2023-12-30 23:41:25 +00:00
show(args: any[]): boolean {
if (!args.length || this.active) {
2023-12-30 23:41:25 +00:00
return false;
}
2023-04-06 03:22:03 +01:00
2023-03-28 19:54:52 +01:00
super.show(args);
// reset the infoOverlay
this.moveInfoOverlay.clear();
2023-04-06 03:22:03 +01:00
this.partyUiMode = args[0] as PartyUiMode;
this.fieldIndex = args.length > 1 ? args[1] as integer : -1;
2023-10-25 14:12:39 +01:00
this.selectCallback = args.length > 2 && args[2] instanceof Function ? args[2] : undefined;
this.selectFilter = args.length > 3 && args[3] instanceof Function
? args[3] as PokemonSelectFilter
2023-03-28 19:54:52 +01:00
: PartyUiHandler.FilterAll;
this.moveSelectFilter = args.length > 4 && args[4] instanceof Function
? args[4] as PokemonMoveSelectFilter
2023-04-11 16:04:39 +01:00
: PartyUiHandler.FilterAllMoves;
this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE;
this.showMovePp = args.length > 6 && args[6];
this.partyContainer.setVisible(true);
this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? "_double" : ""}`);
this.populatePartySlots();
this.setCursor(this.cursor < 6 ? this.cursor : 0);
2023-12-30 23:41:25 +00:00
return true;
2023-03-28 19:54:52 +01:00
}
processInput(button: Button): boolean {
2023-03-28 19:54:52 +01:00
const ui = this.getUi();
if (this.pendingPrompt) {
return false;
}
2023-03-28 19:54:52 +01:00
if (this.awaitingActionInput) {
if ((button === Button.ACTION || button === Button.CANCEL) && this.onActionInput) {
ui.playSelect();
const originalOnActionInput = this.onActionInput;
this.onActionInput = null;
originalOnActionInput();
this.awaitingActionInput = false;
return true;
2023-03-28 19:54:52 +01:00
}
return false;
2023-03-28 19:54:52 +01:00
}
let success = false;
if (this.optionsMode) {
const option = this.options[this.optionsCursor];
if (button === Button.ACTION) {
2023-04-11 06:31:18 +01:00
const pokemon = this.scene.getParty()[this.cursor];
2023-04-21 19:05:16 +01:00
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode && option !== PartyOption.CANCEL) {
this.startTransfer();
this.clearOptions();
ui.playSelect();
return true;
} else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER && option !== PartyOption.CANCEL) {
// clear overlay on cancel
this.moveInfoOverlay.clear();
const filterResult = (this.selectFilter as PokemonSelectFilter)(pokemon);
if (filterResult === null) {
this.selectCallback(this.cursor, option);
this.clearOptions();
} else {
this.clearOptions();
this.showText(filterResult as string, null, () => this.showText(null, 0), null, true);
}
ui.playSelect();
return true;
2024-04-03 01:51:43 +01:00
} else if ((option !== PartyOption.SUMMARY && option !== PartyOption.UNPAUSE_EVOLUTION && option !== PartyOption.UNSPLICE && option !== PartyOption.RELEASE && option !== PartyOption.CANCEL)
2023-04-11 16:04:39 +01:00
|| (option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)) {
2023-04-21 19:05:16 +01:00
let filterResult: string;
const getTransferrableItemsFromPokemon = (pokemon: PlayerPokemon) =>
this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === pokemon.id) as PokemonHeldItemModifier[];
2023-11-04 04:32:12 +00:00
if (option !== PartyOption.TRANSFER && option !== PartyOption.SPLICE) {
2023-04-21 19:05:16 +01:00
filterResult = (this.selectFilter as PokemonSelectFilter)(pokemon);
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
if (filterResult === null && (option === PartyOption.SEND_OUT || option === PartyOption.PASS_BATON)) {
filterResult = this.FilterChallengeLegal(pokemon);
}
if (filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER) {
2023-04-21 19:05:16 +01:00
filterResult = this.moveSelectFilter(pokemon.moveset[this.optionsCursor]);
}
2023-04-21 19:05:16 +01:00
} else {
filterResult = (this.selectFilter as PokemonModifierTransferSelectFilter)(pokemon, getTransferrableItemsFromPokemon(this.scene.getParty()[this.transferCursor])[this.transferOptionCursor]);
2023-04-21 19:05:16 +01:00
}
if (filterResult === null) {
if (this.partyUiMode !== PartyUiMode.SPLICE) {
2023-11-04 04:32:12 +00:00
this.clearOptions();
}
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
if (this.selectCallback && this.partyUiMode !== PartyUiMode.CHECK) {
2023-04-21 19:05:16 +01:00
if (option === PartyOption.TRANSFER) {
if (this.transferCursor !== this.cursor) {
if (this.transferAll) {
getTransferrableItemsFromPokemon(this.scene.getParty()[this.transferCursor]).forEach((_, i) => (this.selectCallback as PartyModifierTransferSelectCallback)(this.transferCursor, i, this.transferQuantitiesMax[i], this.cursor));
} else {
(this.selectCallback as PartyModifierTransferSelectCallback)(this.transferCursor, this.transferOptionCursor, this.transferQuantities[this.transferOptionCursor], this.cursor);
}
}
2023-04-21 19:05:16 +01:00
this.clearTransfer();
2023-11-04 04:32:12 +00:00
} else if (this.partyUiMode === PartyUiMode.SPLICE) {
if (option === PartyOption.SPLICE) {
(this.selectCallback as PartyModifierSpliceSelectCallback)(this.transferCursor, this.cursor);
this.clearTransfer();
} else {
2023-11-04 04:32:12 +00:00
this.startTransfer();
}
2023-11-04 04:32:12 +00:00
this.clearOptions();
} else if (option === PartyOption.RELEASE) {
2023-04-11 14:41:11 +01:00
this.doRelease(this.cursor);
} else {
2023-04-11 14:41:11 +01:00
const selectCallback = this.selectCallback;
2023-04-11 06:31:18 +01:00
this.selectCallback = null;
2023-04-11 16:04:39 +01:00
selectCallback(this.cursor, option);
2023-04-11 06:31:18 +01:00
}
2024-01-10 04:34:43 +00:00
} else {
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
if (option >= PartyOption.FORM_CHANGE_ITEM && this.scene.getCurrentPhase() instanceof SelectModifierPhase) {
if (this.partyUiMode === PartyUiMode.CHECK) {
let formChangeItemModifiers = this.scene.findModifiers(m => m instanceof PokemonFormChangeItemModifier && m.pokemonId === pokemon.id) as PokemonFormChangeItemModifier[];
if (formChangeItemModifiers.find(m => m.active)) {
formChangeItemModifiers = formChangeItemModifiers.filter(m => m.active);
}
const modifier = formChangeItemModifiers[option - PartyOption.FORM_CHANGE_ITEM];
modifier.active = !modifier.active;
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeItemTrigger, false, true);
2024-01-10 04:34:43 +00:00
}
} else if (this.cursor) {
2024-01-10 04:34:43 +00:00
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor, option === PartyOption.PASS_BATON);
}
2024-01-10 04:34:43 +00:00
}
if (this.partyUiMode !== PartyUiMode.MODIFIER && this.partyUiMode !== PartyUiMode.TM_MODIFIER && this.partyUiMode !== PartyUiMode.MOVE_MODIFIER) {
2023-04-10 00:15:21 +01:00
ui.playSelect();
}
return true;
} else {
this.clearOptions();
2023-04-23 03:14:53 +01:00
this.showText(filterResult as string, null, () => this.showText(null, 0), null, true);
}
2023-04-06 03:22:03 +01:00
} else if (option === PartyOption.SUMMARY) {
2023-03-28 19:54:52 +01:00
ui.playSelect();
2023-04-11 06:31:18 +01:00
ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions());
return true;
2024-01-10 04:34:43 +00:00
} else if (option === PartyOption.UNPAUSE_EVOLUTION) {
this.clearOptions();
ui.playSelect();
pokemon.pauseEvolutions = false;
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
this.showText(i18next.t("partyUiHandler:unpausedEvolutions", { pokemonName: pokemon.name }), null, () => this.showText(null, 0), null, true);
2024-04-03 01:51:43 +01:00
} else if (option === PartyOption.UNSPLICE) {
this.clearOptions();
ui.playSelect();
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
this.showText(i18next.t("partyUiHandler:unspliceConfirmation", { fusionName: pokemon.fusionSpecies.name, pokemonName: pokemon.name }), null, () => {
2024-04-03 01:51:43 +01:00
ui.setModeWithoutClear(Mode.CONFIRM, () => {
const fusionName = pokemon.name;
pokemon.unfuse().then(() => {
this.clearPartySlots();
this.populatePartySlots();
ui.setMode(Mode.PARTY);
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
this.showText(i18next.t("partyUiHandler:wasReverted", { fusionName: fusionName, pokemonName: pokemon.name }), null, () => {
2024-04-03 01:51:43 +01:00
ui.setMode(Mode.PARTY);
this.showText(null, 0);
}, null, true);
});
}, () => {
ui.setMode(Mode.PARTY);
this.showText(null, 0);
});
});
2023-04-11 14:41:11 +01:00
} else if (option === PartyOption.RELEASE) {
this.clearOptions();
ui.playSelect();
if (this.cursor >= this.scene.currentBattle.getBattlerCount() || !pokemon.isAllowedInBattle()) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
this.showText(i18next.t("partyUiHandler:releaseConfirmation", { pokemonName: pokemon.name }), null, () => {
2023-04-11 14:41:11 +01:00
ui.setModeWithoutClear(Mode.CONFIRM, () => {
ui.setMode(Mode.PARTY);
this.doRelease(this.cursor);
}, () => {
ui.setMode(Mode.PARTY);
2023-04-23 03:14:53 +01:00
this.showText(null, 0);
2023-04-11 14:41:11 +01:00
});
});
} else {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
this.showText(i18next.t("partyUiHandler:releaseInBattle"), null, () => this.showText(null, 0), null, true);
}
return true;
} else if (option === PartyOption.CANCEL) {
return this.processInput(Button.CANCEL);
} else if (option === PartyOption.SELECT) {
ui.playSelect();
// ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions());
return true;
}
} else if (button === Button.CANCEL) {
this.clearOptions();
ui.playSelect();
return true;
} else {
switch (button) {
case Button.LEFT:
/** Decrease quantity for the current item and update UI */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
this.transferQuantities[option] = this.transferQuantities[option] === 1 ? this.transferQuantitiesMax[option] : this.transferQuantities[option] - 1;
this.updateOptions();
success = this.setCursor(this.optionsCursor); /** Place again the cursor at the same position. Necessary, otherwise the cursor disappears */
}
break;
case Button.RIGHT:
/** Increase quantity for the current item and update UI */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
this.transferQuantities[option] = this.transferQuantities[option] === this.transferQuantitiesMax[option] ? 1 : this.transferQuantities[option] + 1;
this.updateOptions();
success = this.setCursor(this.optionsCursor); /** Place again the cursor at the same position. Necessary, otherwise the cursor disappears */
}
break;
case Button.UP:
/** If currently selecting items to transfer, reset quantity selection */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
if (option !== PartyOption.ALL) {
this.transferQuantities[option] = this.transferQuantitiesMax[option];
}
this.updateOptions();
}
success = this.setCursor(this.optionsCursor ? this.optionsCursor - 1 : this.options.length - 1); /** Move cursor */
break;
case Button.DOWN:
/** If currently selecting items to transfer, reset quantity selection */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
if (option !== PartyOption.ALL) {
this.transferQuantities[option] = this.transferQuantitiesMax[option];
}
this.updateOptions();
}
success = this.setCursor(this.optionsCursor < this.options.length - 1 ? this.optionsCursor + 1 : 0); /** Move cursor */
break;
}
// show move description
if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) {
const option = this.options[this.optionsCursor];
const pokemon = this.scene.getParty()[this.cursor];
const move = allMoves[pokemon.getLearnableLevelMoves()[option]];
if (move) {
this.moveInfoOverlay.show(move);
} else {
// or hide the overlay, in case it's the cancel button
this.moveInfoOverlay.clear();
}
}
}
} else {
if (button === Button.ACTION) {
if (this.cursor < 6) {
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode) {
/** Initialize item quantities for the selected Pokemon */
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === this.scene.getParty()[this.cursor].id) as PokemonHeldItemModifier[];
this.transferQuantities = itemModifiers.map(item => item.getStackCount());
this.transferQuantitiesMax = itemModifiers.map(item => item.getStackCount());
}
this.showOptions();
2023-03-28 19:54:52 +01:00
ui.playSelect();
} else if (this.partyUiMode === PartyUiMode.FAINT_SWITCH || this.partyUiMode === PartyUiMode.REVIVAL_BLESSING) {
ui.playError();
} else {
return this.processInput(Button.CANCEL);
}
return true;
} else if (button === Button.CANCEL) {
2023-11-04 04:32:12 +00:00
if ((this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) && this.transferMode) {
2023-04-21 19:05:16 +01:00
this.clearTransfer();
ui.playSelect();
2024-05-20 00:02:17 +01:00
} else if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH && this.partyUiMode !== PartyUiMode.REVIVAL_BLESSING) {
if (this.selectCallback) {
const selectCallback = this.selectCallback;
this.selectCallback = null;
2023-04-11 16:04:39 +01:00
selectCallback(6, PartyOption.CANCEL);
ui.playSelect();
} else {
ui.setMode(Mode.COMMAND, this.fieldIndex);
ui.playSelect();
}
2023-03-28 19:54:52 +01:00
}
2024-05-24 00:45:04 +01:00
return true;
2023-03-28 19:54:52 +01:00
}
const slotCount = this.partySlots.length;
2024-04-30 17:42:20 +01:00
const battlerCount = this.scene.currentBattle.getBattlerCount();
switch (button) {
case Button.UP:
success = this.setCursor(this.cursor ? this.cursor < 6 ? this.cursor - 1 : slotCount - 1 : 6);
break;
case Button.DOWN:
success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0);
break;
case Button.LEFT:
if (this.cursor >= battlerCount && this.cursor <= 6) {
success = this.setCursor(0);
}
break;
case Button.RIGHT:
if (slotCount === battlerCount) {
success = this.setCursor(6);
break;
} else if (battlerCount >= 2 && slotCount > battlerCount && this.getCursor() === 0 && this.lastCursor === 1) {
success = this.setCursor(2);
2024-04-30 17:42:20 +01:00
break;
} else if (slotCount > battlerCount && this.cursor < battlerCount) {
success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount);
2024-04-30 17:42:20 +01:00
break;
}
}
2023-03-28 19:54:52 +01:00
}
if (success) {
2023-03-28 19:54:52 +01:00
ui.playSelect();
}
return success;
2023-03-28 19:54:52 +01:00
}
populatePartySlots() {
2023-04-14 23:21:33 +01:00
const party = this.scene.getParty();
2023-03-28 19:54:52 +01:00
if (this.cursor < 6 && this.cursor >= party.length) {
2023-03-28 19:54:52 +01:00
this.cursor = party.length - 1;
} else if (this.cursor === 6) {
2023-03-28 19:54:52 +01:00
this.partyCancelButton.select();
}
2023-03-28 19:54:52 +01:00
for (const p in party) {
2023-03-28 19:54:52 +01:00
const slotIndex = parseInt(p);
const partySlot = new PartySlot(this.scene, slotIndex, party[p], this.iconAnimHandler, this.partyUiMode, this.tmMoveId);
2023-03-28 19:54:52 +01:00
this.scene.add.existing(partySlot);
this.partySlotsContainer.add(partySlot);
this.partySlots.push(partySlot);
if (this.cursor === slotIndex) {
2023-03-28 19:54:52 +01:00
partySlot.select();
}
2023-03-28 19:54:52 +01:00
}
}
2024-05-24 00:45:04 +01:00
setCursor(cursor: integer): boolean {
let changed: boolean;
2024-05-24 00:45:04 +01:00
if (this.optionsMode) {
changed = this.optionsCursor !== cursor;
let isScroll = false;
if (changed && this.optionsScroll) {
if (Math.abs(cursor - this.optionsCursor) === this.options.length - 1) {
this.optionsScrollCursor = cursor ? this.optionsScrollTotal - 8 : 0;
this.updateOptions();
} else {
const isDown = cursor && cursor > this.optionsCursor;
if (isDown) {
if (this.options[cursor] === PartyOption.SCROLL_DOWN) {
isScroll = true;
this.optionsScrollCursor++;
}
} else {
if (!cursor && this.optionsScrollCursor) {
isScroll = true;
this.optionsScrollCursor--;
}
}
if (isScroll && this.optionsScrollCursor === 1) {
this.optionsScrollCursor += isDown ? 1 : -1;
}
}
}
if (isScroll) {
this.updateOptions();
} else {
this.optionsCursor = cursor;
}
if (!this.optionsCursorObj) {
this.optionsCursorObj = this.scene.add.image(0, 0, "cursor");
this.optionsCursorObj.setOrigin(0, 0);
this.optionsContainer.add(this.optionsCursorObj);
}
2024-01-10 04:34:43 +00:00
this.optionsCursorObj.setPosition(8 - this.optionsBg.displayWidth, -19 - (16 * ((this.options.length - 1) - this.optionsCursor)));
} else {
changed = this.cursor !== cursor;
if (changed) {
this.lastCursor = this.cursor;
this.cursor = cursor;
if (this.lastCursor < 6) {
this.partySlots[this.lastCursor].deselect();
} else if (this.lastCursor === 6) {
this.partyCancelButton.deselect();
}
if (cursor < 6) {
this.partySlots[cursor].select();
} else if (cursor === 6) {
this.partyCancelButton.select();
}
}
}
return changed;
}
2023-04-23 03:14:53 +01:00
showText(text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
if (text === null) {
2023-04-23 03:14:53 +01:00
text = defaultMessage;
}
2023-04-23 03:14:53 +01:00
if (text?.indexOf("\n") === -1) {
this.partyMessageBox.setSize(262, 30);
2023-04-23 03:14:53 +01:00
this.message.setY(10);
} else {
this.partyMessageBox.setSize(262, 42);
2023-04-23 03:14:53 +01:00
this.message.setY(-5);
}
super.showText(text, delay, callback, callbackDelay, prompt, promptDelay);
}
showOptions() {
if (this.cursor === 6) {
return;
}
2024-05-24 00:45:04 +01:00
this.optionsMode = true;
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
let optionsMessage = i18next.t("partyUiHandler:doWhatWithThisPokemon");
2023-04-21 19:05:16 +01:00
switch (this.partyUiMode) {
case PartyUiMode.MOVE_MODIFIER:
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
optionsMessage = i18next.t("partyUiHandler:selectAMove");
break;
case PartyUiMode.MODIFIER_TRANSFER:
if (!this.transferMode) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
optionsMessage = i18next.t("partyUiHandler:changeQuantity");
}
break;
case PartyUiMode.SPLICE:
if (!this.transferMode) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
optionsMessage = i18next.t("partyUiHandler:selectAnotherPokemonToSplice");
}
break;
2023-04-21 19:05:16 +01:00
}
2023-04-23 03:14:53 +01:00
this.showText(optionsMessage, 0);
2023-04-21 19:05:16 +01:00
this.updateOptions();
/** When an item is being selected for transfer, the message box is taller as the message occupies two lines */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
this.partyMessageBox.setSize(262 - Math.max(this.optionsBg.displayWidth - 56, 0), 42);
} else {
this.partyMessageBox.setSize(262 - Math.max(this.optionsBg.displayWidth - 56, 0), 30);
}
this.setCursor(0);
}
updateOptions(): void {
2023-04-11 16:04:39 +01:00
const pokemon = this.scene.getParty()[this.cursor];
2023-04-06 03:22:03 +01:00
const learnableLevelMoves = this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER
? pokemon.getLearnableLevelMoves()
: null;
if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER && learnableLevelMoves?.length) {
// show the move overlay with info for the first move
this.moveInfoOverlay.show(allMoves[learnableLevelMoves[0]]);
}
2023-04-21 19:05:16 +01:00
const itemModifiers = this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER
? this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === pokemon.id) as PokemonHeldItemModifier[]
2023-04-21 19:05:16 +01:00
: null;
if (this.options.length) {
this.options.splice(0, this.options.length);
this.optionsContainer.removeAll(true);
this.eraseOptionsCursor();
}
2024-01-10 04:34:43 +00:00
let formChangeItemModifiers: PokemonFormChangeItemModifier[];
if (this.partyUiMode !== PartyUiMode.MOVE_MODIFIER && this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_MODIFIER && (this.transferMode || this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER)) {
2023-04-11 16:04:39 +01:00
switch (this.partyUiMode) {
case PartyUiMode.SWITCH:
case PartyUiMode.FAINT_SWITCH:
case PartyUiMode.POST_BATTLE_SWITCH:
if (this.cursor >= this.scene.currentBattle.getBattlerCount()) {
this.options.push(PartyOption.SEND_OUT);
if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH
&& this.scene.findModifier(m => m instanceof SwitchEffectTransferModifier
&& (m as SwitchEffectTransferModifier).pokemonId === this.scene.getPlayerField()[this.fieldIndex].id)) {
this.options.push(PartyOption.PASS_BATON);
2023-04-29 00:26:41 +01:00
}
}
break;
case PartyUiMode.REVIVAL_BLESSING:
this.options.push(PartyOption.REVIVE);
break;
case PartyUiMode.MODIFIER:
this.options.push(PartyOption.APPLY);
break;
case PartyUiMode.TM_MODIFIER:
this.options.push(PartyOption.TEACH);
break;
case PartyUiMode.MODIFIER_TRANSFER:
this.options.push(PartyOption.TRANSFER);
break;
case PartyUiMode.SPLICE:
if (this.transferMode) {
if (this.cursor !== this.transferCursor) {
this.options.push(PartyOption.SPLICE);
}
} else {
2023-04-11 16:04:39 +01:00
this.options.push(PartyOption.APPLY);
}
break;
case PartyUiMode.RELEASE:
this.options.push(PartyOption.RELEASE);
break;
Add Challenges (#1459) * Initial challenge framework * Add type localisation * Change how challenges are tracked Also fixes the difficulty total text * MVP Renames challenge types, temporarily hides difficulty, and implements challenge saving. * Attempt to fix one legal pokemon in a double battle * Make monotype ignore type changing effects * Make isOfType correctly detect normal types * Try to fix double battles again * Make challenge function more like classic * Add helper function for fainted or not allowed * Add framework for fresh start challenge and improve comments * Try to fix evolution issues * Make form changing items only usable from rewards screen * Update localisation * Additional localisation change * Add achievements for completing challenges * Fix initialisation bug with challenge achievements * Add support for gamemode specific fixed battles Also make monogen challenges face the e4 of their generation * Add better support for mobile in challenges * Localise illegal evolution/form change message * Update achievement names * Make alternate forms count for monogen * Update monotype achievement icons * Add more comments * Improve comments * Fix mid battle form changes * Reorder mode list * Remove currently unused localisation entry * Add type overrides for monotype challenges Meloetta always counts for psychic and castform always counts for normal * Change how form changes are handled Now attempts a switch at the start of each turn instead of immediately * Add start button to challenge select screen * Make starter select back out to challenge screen if using challenges * Fix daily runs * Update tests to new game mode logic
2024-06-08 06:07:23 +01:00
case PartyUiMode.CHECK:
if (this.scene.getCurrentPhase() instanceof SelectModifierPhase) {
formChangeItemModifiers = this.scene.findModifiers(m => m instanceof PokemonFormChangeItemModifier && m.pokemonId === pokemon.id) as PokemonFormChangeItemModifier[];
if (formChangeItemModifiers.find(m => m.active)) {
formChangeItemModifiers = formChangeItemModifiers.filter(m => m.active);
}
for (let i = 0; i < formChangeItemModifiers.length; i++) {
this.options.push(PartyOption.FORM_CHANGE_ITEM + i);
}
}
break;
case PartyUiMode.SELECT:
this.options.push(PartyOption.SELECT);
break;
2023-04-11 16:04:39 +01:00
}
2023-04-11 14:41:11 +01:00
2023-04-11 16:04:39 +01:00
this.options.push(PartyOption.SUMMARY);
if (pokemon.pauseEvolutions && pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId)) {
2024-01-10 04:34:43 +00:00
this.options.push(PartyOption.UNPAUSE_EVOLUTION);
}
2024-04-03 01:51:43 +01:00
if (this.partyUiMode === PartyUiMode.SWITCH) {
if (pokemon.isFusion()) {
2024-04-03 01:51:43 +01:00
this.options.push(PartyOption.UNSPLICE);
}
2023-04-11 16:04:39 +01:00
this.options.push(PartyOption.RELEASE);
} else if (this.partyUiMode === PartyUiMode.SPLICE && pokemon.isFusion()) {
2024-04-03 01:51:43 +01:00
this.options.push(PartyOption.UNSPLICE);
}
2023-04-21 19:05:16 +01:00
} else if (this.partyUiMode === PartyUiMode.MOVE_MODIFIER) {
for (let m = 0; m < pokemon.moveset.length; m++) {
2023-04-11 16:04:39 +01:00
this.options.push(PartyOption.MOVE_1 + m);
}
} else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) {
const learnableMoves = pokemon.getLearnableLevelMoves();
for (let m = 0; m < learnableMoves.length; m++) {
this.options.push(m);
}
2023-04-21 19:05:16 +01:00
} else {
for (let im = 0; im < itemModifiers.length; im++) {
2023-04-21 19:05:16 +01:00
this.options.push(im);
}
if (itemModifiers.length > 1) {
this.options.push(PartyOption.ALL);
}
2023-04-11 16:04:39 +01:00
}
2023-04-11 14:41:11 +01:00
this.optionsScrollTotal = this.options.length;
let optionStartIndex = this.optionsScrollCursor;
let optionEndIndex = Math.min(this.optionsScrollTotal, optionStartIndex + (!optionStartIndex || this.optionsScrollCursor + 8 >= this.optionsScrollTotal ? 8 : 7));
this.optionsScroll = this.optionsScrollTotal > 9;
if (this.optionsScroll) {
this.options.splice(optionEndIndex, this.optionsScrollTotal);
this.options.splice(0, optionStartIndex);
if (optionStartIndex) {
this.options.unshift(PartyOption.SCROLL_UP);
}
if (optionEndIndex < this.optionsScrollTotal) {
this.options.push(PartyOption.SCROLL_DOWN);
}
}
2023-04-11 14:41:11 +01:00
this.options.push(PartyOption.CANCEL);
2024-01-10 04:34:43 +00:00
this.optionsBg = addWindow(this.scene, 0, 0, 0, 16 * this.options.length + 13);
this.optionsBg.setOrigin(1, 1);
2024-01-10 04:34:43 +00:00
this.optionsContainer.add(this.optionsBg);
optionStartIndex = 0;
optionEndIndex = this.options.length;
2024-01-10 04:34:43 +00:00
let widestOptionWidth = 0;
const optionTexts: BBCodeText[] = [];
2024-01-10 04:34:43 +00:00
for (let o = optionStartIndex; o < optionEndIndex; o++) {
2023-04-11 16:04:39 +01:00
const option = this.options[this.options.length - (o + 1)];
let altText = false;
2023-04-11 16:04:39 +01:00
let optionName: string;
if (option === PartyOption.SCROLL_UP) {
optionName = "↑";
} else if (option === PartyOption.SCROLL_DOWN) {
optionName = "↓";
} else if ((this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_MODIFIER && (this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER || this.transferMode)) || option === PartyOption.CANCEL) {
2023-04-21 19:05:16 +01:00
switch (option) {
case PartyOption.MOVE_1:
case PartyOption.MOVE_2:
case PartyOption.MOVE_3:
case PartyOption.MOVE_4:
const move = pokemon.moveset[option - PartyOption.MOVE_1];
if (this.showMovePp) {
const maxPP = move.getMovePp();
const currPP = maxPP - move.ppUsed;
optionName = `${move.getName()} ${currPP}/${maxPP}`;
} else {
optionName = move.getName();
}
break;
default:
if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) {
const modifier = formChangeItemModifiers[option - PartyOption.FORM_CHANGE_ITEM];
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
optionName = `${modifier.active ? i18next.t("partyUiHandler:DEACTIVATE") : i18next.t("partyUiHandler:ACTIVATE")} ${modifier.type.name}`;
} else {
if (this.localizedOptions.includes(option)) {
optionName = i18next.t(`partyUiHandler:${PartyOption[option]}`);
} else {
optionName = Utils.toReadableString(PartyOption[option]);
}
}
break;
2023-04-21 19:05:16 +01:00
}
2024-04-26 06:18:08 +01:00
} else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) {
const move = learnableLevelMoves[option];
optionName = allMoves[move].name;
altText = !pokemon.getSpeciesForm().getLevelMoves().find(plm => plm[1] === move);
} else if (option === PartyOption.ALL) {
optionName = i18next.t("partyUiHandler:ALL");
} else {
const itemModifier = itemModifiers[option];
optionName = itemModifier.type.name;
2023-04-11 16:04:39 +01:00
}
const yCoord = -6 - 16 * o;
const optionText = addBBCodeTextObject(this.scene, 0, yCoord - 16, optionName, TextStyle.WINDOW, { maxLines: 1 });
if (altText) {
optionText.setColor("#40c8f8");
optionText.setShadowColor("#006090");
}
optionText.setOrigin(0, 0);
/** For every item that has stack bigger than 1, display the current quantity selection */
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferQuantitiesMax[option] > 1) {
const itemModifier = itemModifiers[option];
/** Not sure why getMaxHeldItemCount had an error, but it only checks the Pokemon parameter if the modifier is PokemonBaseStatModifier */
if (itemModifier === undefined || itemModifier instanceof PokemonBaseStatModifier) {
continue;
}
let amountText = ` (${this.transferQuantities[option]})`;
/** If the amount held is the maximum, display the count in red */
if (this.transferQuantitiesMax[option] === itemModifier.getMaxHeldItemCount(undefined)) {
amountText = `[color=${getTextColor(TextStyle.SUMMARY_RED)}]${amountText}[/color]`;
}
optionText.setText(optionName + amountText);
}
optionText.setText(`[shadow]${optionText.text}[/shadow]`);
2024-01-10 04:34:43 +00:00
optionTexts.push(optionText);
widestOptionWidth = Math.max(optionText.displayWidth, widestOptionWidth);
this.optionsContainer.add(optionText);
}
2024-01-10 04:34:43 +00:00
this.optionsBg.width = Math.max(widestOptionWidth + 24, 94);
for (const optionText of optionTexts) {
2024-01-10 04:34:43 +00:00
optionText.x = 15 - this.optionsBg.width;
}
}
2023-04-21 19:05:16 +01:00
startTransfer(): void {
this.transferMode = true;
this.transferCursor = this.cursor;
this.transferOptionCursor = this.getOptionsCursorWithScroll();
this.transferAll = this.options[this.optionsCursor] === PartyOption.ALL;
2023-04-21 19:05:16 +01:00
this.partySlots[this.transferCursor].setTransfer(true);
}
clearTransfer(): void {
this.transferMode = false;
this.transferAll = false;
2023-04-21 19:05:16 +01:00
this.partySlots[this.transferCursor].setTransfer(false);
}
2023-04-11 14:41:11 +01:00
doRelease(slotIndex: integer): void {
this.showText(this.getReleaseMessage(this.scene.getParty()[slotIndex].name), null, () => {
this.clearPartySlots();
this.scene.removePartyMemberModifiers(slotIndex);
const releasedPokemon = this.scene.getParty().splice(slotIndex, 1)[0];
releasedPokemon.destroy();
2023-04-11 14:41:11 +01:00
this.populatePartySlots();
if (this.cursor >= this.scene.getParty().length) {
2023-04-11 14:41:11 +01:00
this.setCursor(this.cursor - 1);
}
2023-04-11 14:41:11 +01:00
if (this.partyUiMode === PartyUiMode.RELEASE) {
const selectCallback = this.selectCallback;
this.selectCallback = null;
2023-04-11 16:04:39 +01:00
selectCallback(this.cursor, PartyOption.RELEASE);
2023-12-20 05:35:41 +00:00
}
this.showText(null, 0);
2023-04-11 14:41:11 +01:00
}, null, true);
}
2023-04-11 06:31:18 +01:00
getReleaseMessage(pokemonName: string): string {
const rand = Utils.randInt(128);
if (rand < 20) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:goodbye", { pokemonName: pokemonName });
} else if (rand < 40) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:byebye", { pokemonName: pokemonName });
} else if (rand < 60) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:farewell", { pokemonName: pokemonName });
} else if (rand < 80) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:soLong", { pokemonName: pokemonName });
} else if (rand < 100) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:thisIsWhereWePart", { pokemonName: pokemonName });
} else if (rand < 108) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:illMissYou", { pokemonName: pokemonName });
} else if (rand < 116) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:illNeverForgetYou", { pokemonName: pokemonName });
} else if (rand < 124) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:untilWeMeetAgain", { pokemonName: pokemonName });
} else if (rand < 127) {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:sayonara", { pokemonName: pokemonName });
} else {
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
return i18next.t("partyUiHandler:smellYaLater", { pokemonName: pokemonName });
}
2023-04-11 06:31:18 +01:00
}
getOptionsCursorWithScroll(): integer {
return this.optionsCursor + this.optionsScrollCursor + (this.options && this.options[0] === PartyOption.SCROLL_UP ? -1 : 0);
}
clearOptions() {
// hide the overlay
this.moveInfoOverlay.clear();
this.optionsMode = false;
this.optionsScroll = false;
this.optionsScrollCursor = 0;
this.optionsScrollTotal = 0;
2023-04-06 03:22:03 +01:00
this.options.splice(0, this.options.length);
this.optionsContainer.removeAll(true);
this.eraseOptionsCursor();
this.partyMessageBox.setSize(262, 30);
2023-04-23 03:14:53 +01:00
this.showText(null, 0);
}
eraseOptionsCursor() {
if (this.optionsCursorObj) {
this.optionsCursorObj.destroy();
}
this.optionsCursorObj = null;
}
2023-03-28 19:54:52 +01:00
clear() {
super.clear();
// hide the overlay
this.moveInfoOverlay.clear();
2023-03-28 19:54:52 +01:00
this.partyContainer.setVisible(false);
this.clearPartySlots();
}
clearPartySlots() {
this.partySlots.splice(0, this.partySlots.length);
this.partySlotsContainer.removeAll(true);
}
}
class PartySlot extends Phaser.GameObjects.Container {
private selected: boolean;
2023-04-21 19:05:16 +01:00
private transfer: boolean;
2023-03-28 19:54:52 +01:00
private slotIndex: integer;
private pokemon: PlayerPokemon;
private slotBg: Phaser.GameObjects.Image;
private slotPb: Phaser.GameObjects.Sprite;
2024-04-10 15:57:06 +01:00
private pokemonIcon: Phaser.GameObjects.Container;
private iconAnimHandler: PokemonIconAnimHandler;
constructor(scene: BattleScene, slotIndex: integer, pokemon: PlayerPokemon, iconAnimHandler: PokemonIconAnimHandler, partyUiMode: PartyUiMode, tmMoveId: Moves) {
super(scene, slotIndex >= scene.currentBattle.getBattlerCount() ? 230.5 : 64,
slotIndex >= scene.currentBattle.getBattlerCount() ? -184 + (scene.currentBattle.double ? -40 : 0)
+ (28 + (scene.currentBattle.double ? 8 : 0)) * slotIndex : -124 + (scene.currentBattle.double ? -8 : 0) + slotIndex * 64);
2023-03-28 19:54:52 +01:00
this.slotIndex = slotIndex;
this.pokemon = pokemon;
this.iconAnimHandler = iconAnimHandler;
2024-05-24 00:45:04 +01:00
this.setup(partyUiMode, tmMoveId);
2023-03-28 19:54:52 +01:00
}
setup(partyUiMode: PartyUiMode, tmMoveId: Moves) {
const battlerCount = (this.scene as BattleScene).currentBattle.getBattlerCount();
const slotKey = `party_slot${this.slotIndex >= battlerCount ? "" : "_main"}`;
2023-03-28 19:54:52 +01:00
const slotBg = this.scene.add.sprite(0, 0, slotKey, `${slotKey}${this.pokemon.hp ? "" : "_fnt"}`);
2023-03-28 19:54:52 +01:00
this.slotBg = slotBg;
this.add(slotBg);
const slotPb = this.scene.add.sprite(this.slotIndex >= battlerCount ? -85.5 : -51, this.slotIndex >= battlerCount ? 0 : -20.5, "party_pb");
2023-03-28 19:54:52 +01:00
this.slotPb = slotPb;
this.add(slotPb);
2024-04-10 15:57:06 +01:00
this.pokemonIcon = (this.scene as BattleScene).addPokemonIcon(this.pokemon, slotPb.x, slotPb.y, 0.5, 0.5, true);
this.add(this.pokemonIcon);
2023-03-28 19:54:52 +01:00
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE);
2023-03-28 19:54:52 +01:00
const slotInfoContainer = this.scene.add.container(0, 0);
this.add(slotInfoContainer);
let displayName = this.pokemon.name;
let nameTextWidth: number;
const nameSizeTest = addTextObject(this.scene, 0, 0, displayName, TextStyle.PARTY);
nameTextWidth = nameSizeTest.displayWidth;
while (nameTextWidth > (this.slotIndex >= battlerCount ? 52 : (76 - (this.pokemon.fusionSpecies ? 8 : 0)))) {
displayName = `${displayName.slice(0, displayName.endsWith(".") ? -2 : -1).trimEnd()}.`;
nameSizeTest.setText(displayName);
nameTextWidth = nameSizeTest.displayWidth;
}
nameSizeTest.destroy();
const slotName = addTextObject(this.scene, 0, 0, displayName, TextStyle.PARTY);
2023-07-05 05:29:22 +01:00
slotName.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 21 : 24, this.slotIndex >= battlerCount ? 2 : 10);
2023-03-28 19:54:52 +01:00
slotName.setOrigin(0, 0);
const slotLevelLabel = this.scene.add.image(0, 0, "party_slot_overlay_lv");
2023-03-28 19:54:52 +01:00
slotLevelLabel.setPositionRelative(slotName, 8, 12);
slotLevelLabel.setOrigin(0, 0);
const slotLevelText = addTextObject(this.scene, 0, 0, this.pokemon.level.toString(), this.pokemon.level < (this.scene as BattleScene).getMaxExpLevel() ? TextStyle.PARTY : TextStyle.PARTY_RED);
2023-03-28 19:54:52 +01:00
slotLevelText.setPositionRelative(slotLevelLabel, 9, 0);
slotLevelText.setOrigin(0, 0.25);
slotInfoContainer.add([ slotName, slotLevelLabel, slotLevelText ]);
const genderSymbol = getGenderSymbol(this.pokemon.getGender(true));
2023-07-05 05:29:22 +01:00
if (genderSymbol) {
const slotGenderText = addTextObject(this.scene, 0, 0, genderSymbol, TextStyle.PARTY);
slotGenderText.setColor(getGenderColor(this.pokemon.getGender(true)));
slotGenderText.setShadowColor(getGenderColor(this.pokemon.getGender(true), true));
if (this.slotIndex >= battlerCount) {
2023-07-10 16:21:05 +01:00
slotGenderText.setPositionRelative(slotLevelLabel, 36, 0);
} else {
slotGenderText.setPositionRelative(slotName, 76 - (this.pokemon.fusionSpecies ? 8 : 0), 3);
}
2023-07-05 05:29:22 +01:00
slotGenderText.setOrigin(0, 0.25);
slotInfoContainer.add(slotGenderText);
}
if (this.pokemon.fusionSpecies) {
const splicedIcon = this.scene.add.image(0, 0, "icon_spliced");
splicedIcon.setScale(0.5);
splicedIcon.setOrigin(0, 0);
if (this.slotIndex >= battlerCount) {
splicedIcon.setPositionRelative(slotLevelLabel, 36 + (genderSymbol ? 8 : 0), 0.5);
} else {
splicedIcon.setPositionRelative(slotName, 76, 3.5);
}
slotInfoContainer.add(splicedIcon);
}
2023-07-05 05:29:22 +01:00
if (this.pokemon.status) {
const statusIndicator = this.scene.add.sprite(0, 0, "statuses");
2023-07-10 16:21:05 +01:00
statusIndicator.setFrame(StatusEffect[this.pokemon.status?.effect].toLowerCase());
2023-07-05 05:29:22 +01:00
statusIndicator.setOrigin(0, 0);
statusIndicator.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 43 : 55, 0);
slotInfoContainer.add(statusIndicator);
}
2023-11-06 04:48:04 +00:00
if (this.pokemon.isShiny()) {
const doubleShiny = this.pokemon.isFusion() && this.pokemon.shiny && this.pokemon.fusionShiny;
const shinyStar = this.scene.add.image(0, 0, `shiny_star_small${doubleShiny ? "_1" : ""}`);
2023-07-05 05:29:22 +01:00
shinyStar.setOrigin(0, 0);
2024-04-19 03:52:26 +01:00
shinyStar.setPositionRelative(slotName, -9, 3);
shinyStar.setTint(getVariantTint(!doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant));
2023-07-05 05:29:22 +01:00
slotInfoContainer.add(shinyStar);
if (doubleShiny) {
const fusionShinyStar = this.scene.add.image(0, 0, "shiny_star_small_2");
fusionShinyStar.setOrigin(0, 0);
fusionShinyStar.setPosition(shinyStar.x, shinyStar.y);
fusionShinyStar.setTint(getVariantTint(this.pokemon.fusionVariant));
2024-05-24 00:45:04 +01:00
slotInfoContainer.add(fusionShinyStar);
}
2023-07-05 05:29:22 +01:00
}
if (partyUiMode !== PartyUiMode.TM_MODIFIER) {
const slotHpBar = this.scene.add.image(0, 0, "party_slot_hp_bar");
2023-07-05 05:29:22 +01:00
slotHpBar.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 72 : 8, this.slotIndex >= battlerCount ? 6 : 31);
slotHpBar.setOrigin(0, 0);
2023-03-28 19:54:52 +01:00
const hpRatio = this.pokemon.getHpRatio();
2023-03-28 19:54:52 +01:00
const slotHpOverlay = this.scene.add.sprite(0, 0, "party_slot_hp_overlay", hpRatio > 0.5 ? "high" : hpRatio > 0.25 ? "medium" : "low");
slotHpOverlay.setPositionRelative(slotHpBar, 16, 2);
slotHpOverlay.setOrigin(0, 0);
slotHpOverlay.setScale(hpRatio, 1);
2023-03-28 19:54:52 +01:00
const slotHpText = addTextObject(this.scene, 0, 0, `${this.pokemon.hp}/${this.pokemon.getMaxHp()}`, TextStyle.PARTY);
slotHpText.setPositionRelative(slotHpBar, slotHpBar.width - 3, slotHpBar.height - 2);
slotHpText.setOrigin(1, 0);
2023-03-28 19:54:52 +01:00
slotInfoContainer.add([ slotHpBar, slotHpOverlay, slotHpText ]);
} else {
let slotTmText: string;
switch (true) {
case (this.pokemon.compatibleTms.indexOf(tmMoveId) === -1):
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
slotTmText = i18next.t("partyUiHandler:notAble");
break;
case (this.pokemon.getMoveset().filter(m => m?.moveId === tmMoveId).length > 0):
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
slotTmText = i18next.t("partyUiHandler:learned");
break;
default:
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
slotTmText = i18next.t("partyUiHandler:able");
break;
}
2023-03-28 19:54:52 +01:00
2023-07-05 05:29:22 +01:00
const slotTmLabel = addTextObject(this.scene, 0, 0, slotTmText, TextStyle.MESSAGE);
slotTmLabel.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 94 : 32, this.slotIndex >= battlerCount ? 16 : 46);
slotTmLabel.setOrigin(0, 1);
slotInfoContainer.add(slotTmLabel);
}
2023-03-28 19:54:52 +01:00
}
2023-04-21 19:05:16 +01:00
select(): void {
if (this.selected) {
2023-03-28 19:54:52 +01:00
return;
}
2023-03-28 19:54:52 +01:00
this.selected = true;
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.ACTIVE);
2023-03-28 19:54:52 +01:00
2023-04-21 19:05:16 +01:00
this.updateSlotTexture();
this.slotPb.setFrame("party_pb_sel");
2023-03-28 19:54:52 +01:00
}
2023-04-21 19:05:16 +01:00
deselect(): void {
if (!this.selected) {
2023-03-28 19:54:52 +01:00
return;
}
2023-03-28 19:54:52 +01:00
this.selected = false;
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE);
2023-03-28 19:54:52 +01:00
2023-04-21 19:05:16 +01:00
this.updateSlotTexture();
this.slotPb.setFrame("party_pb");
2023-03-28 19:54:52 +01:00
}
2023-04-21 19:05:16 +01:00
setTransfer(transfer: boolean): void {
if (this.transfer === transfer) {
2023-04-21 19:05:16 +01:00
return;
}
2023-04-21 19:05:16 +01:00
this.transfer = transfer;
this.updateSlotTexture();
}
private updateSlotTexture(): void {
const battlerCount = (this.scene as BattleScene).currentBattle.getBattlerCount();
this.slotBg.setTexture(`party_slot${this.slotIndex >= battlerCount ? "" : "_main"}`,
`party_slot${this.slotIndex >= battlerCount ? "" : "_main"}${this.transfer ? "_swap" : this.pokemon.hp ? "" : "_fnt"}${this.selected ? "_sel" : ""}`);
2023-04-21 19:05:16 +01:00
}
2023-03-28 19:54:52 +01:00
}
class PartyCancelButton extends Phaser.GameObjects.Container {
private selected: boolean;
private partyCancelBg: Phaser.GameObjects.Sprite;
private partyCancelPb: Phaser.GameObjects.Sprite;
constructor(scene: BattleScene, x: number, y: number) {
super(scene, x, y);
this.setup();
}
setup() {
const partyCancelBg = this.scene.add.sprite(0, 0, "party_cancel");
2023-03-28 19:54:52 +01:00
this.add(partyCancelBg);
this.partyCancelBg = partyCancelBg;
const partyCancelPb = this.scene.add.sprite(-17, 0, "party_pb");
2023-03-28 19:54:52 +01:00
this.add(partyCancelPb);
this.partyCancelPb = partyCancelPb;
Localization: Add new translations for party UI handler (#2566) * Localization: Add new translations for party UI handler * fixes * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * minor fix * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * change order and name of "Do what with this Pokémon?" message * reverted imports * update party-ui-handler translations for multiple languages * Update src/locales/fr/party-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/party-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_CN/party-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * minor fix * pt tweak * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/ko/party-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/es/party-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com>
2024-07-05 02:40:11 +01:00
const partyCancelText = addTextObject(this.scene, -8, -7, i18next.t("partyUiHandler:cancel"), TextStyle.PARTY);
2023-03-28 19:54:52 +01:00
this.add(partyCancelText);
}
select() {
if (this.selected) {
2023-03-28 19:54:52 +01:00
return;
}
2023-03-28 19:54:52 +01:00
this.selected = true;
this.partyCancelBg.setFrame("party_cancel_sel");
this.partyCancelPb.setFrame("party_pb_sel");
2023-03-28 19:54:52 +01:00
}
deselect() {
if (!this.selected) {
2023-03-28 19:54:52 +01:00
return;
}
2023-03-28 19:54:52 +01:00
this.selected = false;
this.partyCancelBg.setFrame("party_cancel");
this.partyCancelPb.setFrame("party_pb");
2023-03-28 19:54:52 +01:00
}
}