pokerogue/src/ui/modifier-select-ui-handler.ts

776 lines
27 KiB
TypeScript
Raw Normal View History

import BattleScene from "../battle-scene";
import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType } from "../modifier/modifier-type";
2023-04-20 15:46:05 -04:00
import { getPokeballAtlasKey, PokeballType } from "../data/pokeball";
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
2023-03-28 14:54:52 -04:00
import AwaitableUiHandler from "./awaitable-ui-handler";
import { Mode } from "./ui";
import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier";
2024-02-14 10:44:55 -05:00
import { handleTutorial, Tutorial } from "../tutorial";
2024-07-09 23:19:44 -04:00
import { Button } from "#enums/buttons";
import MoveInfoOverlay from "./move-info-overlay";
import { allMoves } from "../data/move";
import * as Utils from "./../utils";
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
import i18next from "i18next";
2023-03-28 14:54:52 -04:00
export const SHOP_OPTIONS_ROW_LIMIT = 6;
2023-03-28 14:54:52 -04:00
export default class ModifierSelectUiHandler extends AwaitableUiHandler {
private modifierContainer: Phaser.GameObjects.Container;
private rerollButtonContainer: Phaser.GameObjects.Container;
private lockRarityButtonContainer: Phaser.GameObjects.Container;
2023-04-21 14:05:16 -04:00
private transferButtonContainer: Phaser.GameObjects.Container;
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 15:07:23 +10:00
private checkButtonContainer: Phaser.GameObjects.Container;
private continueButtonContainer: Phaser.GameObjects.Container;
private rerollCostText: Phaser.GameObjects.Text;
private lockRarityButtonText: Phaser.GameObjects.Text;
2024-07-09 23:19:44 -04:00
private moveInfoOverlay: MoveInfoOverlay;
private moveInfoOverlayActive: boolean = false;
2023-04-21 14:05:16 -04:00
private rowCursor: integer = 0;
private player: boolean;
private rerollCost: integer;
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
private transferButtonWidth: integer;
private checkButtonWidth: integer;
2023-04-21 14:05:16 -04:00
2023-03-29 00:31:25 -04:00
public options: ModifierOption[];
public shopOptionsRows: ModifierOption[][];
2023-03-28 14:54:52 -04:00
private cursorObj: Phaser.GameObjects.Image;
constructor(scene: BattleScene) {
super(scene, Mode.CONFIRM);
2023-03-28 14:54:52 -04:00
this.options = [];
this.shopOptionsRows = [];
2023-03-28 14:54:52 -04:00
}
setup() {
const ui = this.getUi();
2024-05-24 01:45:04 +02:00
2023-03-28 14:54:52 -04:00
this.modifierContainer = this.scene.add.container(0, 0);
ui.add(this.modifierContainer);
2023-04-21 14:05:16 -04:00
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
2024-07-09 23:19:44 -04:00
const [, styleOptions, , ,] = getTextStyleOptions(TextStyle.PARTY, (this.scene as BattleScene).uiTheme);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
context.font = styleOptions.fontSize + "px " + styleOptions.fontFamily;
this.transferButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:transfer")).width;
this.checkButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:checkTeam")).width;
this.transferButtonContainer = this.scene.add.container((this.scene.game.canvas.width - this.checkButtonWidth) / 6 - 21, -64);
this.transferButtonContainer.setName("transfer-btn");
2023-04-21 14:05:16 -04:00
this.transferButtonContainer.setVisible(false);
ui.add(this.transferButtonContainer);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
const transferButtonText = addTextObject(this.scene, -4, -2, i18next.t("modifierSelectUiHandler:transfer"), TextStyle.PARTY);
transferButtonText.setName("text-transfer-btn");
2023-04-21 14:05:16 -04:00
transferButtonText.setOrigin(1, 0);
this.transferButtonContainer.add(transferButtonText);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
this.checkButtonContainer = this.scene.add.container((this.scene.game.canvas.width) / 6 - 1, -64);
this.checkButtonContainer.setName("use-btn");
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 15:07:23 +10:00
this.checkButtonContainer.setVisible(false);
ui.add(this.checkButtonContainer);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
const checkButtonText = addTextObject(this.scene, -4, -2, i18next.t("modifierSelectUiHandler:checkTeam"), TextStyle.PARTY);
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 15:07:23 +10:00
checkButtonText.setName("text-use-btn");
checkButtonText.setOrigin(1, 0);
this.checkButtonContainer.add(checkButtonText);
this.rerollButtonContainer = this.scene.add.container(16, -64);
this.rerollButtonContainer.setName("reroll-brn");
this.rerollButtonContainer.setVisible(false);
ui.add(this.rerollButtonContainer);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
const rerollButtonText = addTextObject(this.scene, -4, -2, i18next.t("modifierSelectUiHandler:reroll"), TextStyle.PARTY);
rerollButtonText.setName("text-reroll-btn");
rerollButtonText.setOrigin(0, 0);
this.rerollButtonContainer.add(rerollButtonText);
this.rerollCostText = addTextObject(this.scene, 0, 0, "", TextStyle.MONEY);
this.rerollCostText.setName("text-reroll-cost");
this.rerollCostText.setOrigin(0, 0);
this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1);
this.rerollButtonContainer.add(this.rerollCostText);
this.lockRarityButtonContainer = this.scene.add.container(16, -64);
this.lockRarityButtonContainer.setVisible(false);
ui.add(this.lockRarityButtonContainer);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
this.lockRarityButtonText = addTextObject(this.scene, -4, -2, i18next.t("modifierSelectUiHandler:lockRarities"), TextStyle.PARTY);
this.lockRarityButtonText.setOrigin(0, 0);
this.lockRarityButtonContainer.add(this.lockRarityButtonText);
this.continueButtonContainer = this.scene.add.container((this.scene.game.canvas.width / 12), -(this.scene.game.canvas.height / 12));
this.continueButtonContainer.setVisible(false);
ui.add(this.continueButtonContainer);
// prepare move overlay
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay(this.scene, {
delayVisibility: true,
scale: overlayScale,
onSide: true,
right: true,
x: 1,
2024-07-09 23:19:44 -04:00
y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1,
width: (this.scene.game.canvas.width / 6) - 2,
});
ui.add(this.moveInfoOverlay);
// register the overlay to receive toggle events
this.scene.addInfoToggle(this.moveInfoOverlay);
2023-03-28 14:54:52 -04:00
}
2023-12-30 18:41:25 -05:00
show(args: any[]): boolean {
2023-04-09 19:15:21 -04:00
if (this.active) {
if (args.length >= 3) {
2023-04-09 19:15:21 -04:00
this.awaitingActionInput = true;
this.onActionInput = args[2];
2023-04-09 19:15:21 -04:00
}
this.moveInfoOverlay.active = this.moveInfoOverlayActive;
2023-12-30 18:41:25 -05:00
return false;
2023-04-09 19:15:21 -04:00
}
if (args.length !== 4 || !(args[1] instanceof Array) || !(args[2] instanceof Function)) {
2023-12-30 18:41:25 -05:00
return false;
}
2023-03-28 14:54:52 -04:00
super.show(args);
this.getUi().clearText();
this.player = args[0];
const partyHasHeldItem = this.player && !!this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).getTransferrable(true)).length;
const canLockRarities = !!this.scene.findModifier(m => m instanceof LockModifierTiersModifier);
2023-04-21 14:05:16 -04:00
this.transferButtonContainer.setVisible(false);
this.transferButtonContainer.setAlpha(0);
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 15:07:23 +10:00
this.checkButtonContainer.setVisible(false);
this.checkButtonContainer.setAlpha(0);
this.rerollButtonContainer.setVisible(false);
this.rerollButtonContainer.setAlpha(0);
this.lockRarityButtonContainer.setVisible(false);
this.lockRarityButtonContainer.setAlpha(0);
this.continueButtonContainer.setVisible(false);
this.continueButtonContainer.setAlpha(0);
this.rerollButtonContainer.setPositionRelative(this.lockRarityButtonContainer, 0, canLockRarities ? -12 : 0);
this.rerollCost = args[3] as integer;
this.updateRerollCostText();
const typeOptions = args[1] as ModifierTypeOption[];
2024-03-16 22:06:56 -04:00
const shopTypeOptions = !this.scene.gameMode.hasNoShop
? getPlayerShopModifierTypeOptionsForWave(this.scene.currentBattle.waveIndex, this.scene.getWaveMoneyAmount(1))
: [];
const optionsYOffset = shopTypeOptions.length >= SHOP_OPTIONS_ROW_LIMIT ? -8 : -24;
2024-05-24 01:45:04 +02:00
2023-04-12 12:48:02 -04:00
for (let m = 0; m < typeOptions.length; m++) {
const sliceWidth = (this.scene.game.canvas.width / 6) / (typeOptions.length + 2);
const option = new ModifierOption(this.scene, sliceWidth * (m + 1) + (sliceWidth * 0.5), -this.scene.game.canvas.height / 12 + optionsYOffset, typeOptions[m]);
2023-03-28 14:54:52 -04:00
option.setScale(0.5);
this.scene.add.existing(option);
this.modifierContainer.add(option);
this.options.push(option);
}
// Add continue button
if (this.options.length === 0) {
const continueButtonText = addTextObject(this.scene, -24, optionsYOffset - 5, "Continue", TextStyle.MESSAGE);
continueButtonText.setName("text-continue-btn");
this.continueButtonContainer.add(continueButtonText);
}
for (let m = 0; m < shopTypeOptions.length; m++) {
const row = m < SHOP_OPTIONS_ROW_LIMIT ? 0 : 1;
const col = m < SHOP_OPTIONS_ROW_LIMIT ? m : m - SHOP_OPTIONS_ROW_LIMIT;
const rowOptions = shopTypeOptions.slice(row ? SHOP_OPTIONS_ROW_LIMIT : 0, row ? undefined : SHOP_OPTIONS_ROW_LIMIT);
const sliceWidth = (this.scene.game.canvas.width / SHOP_OPTIONS_ROW_LIMIT) / (rowOptions.length + 2);
const option = new ModifierOption(this.scene, sliceWidth * (col + 1) + (sliceWidth * 0.5), ((-this.scene.game.canvas.height / 12) - (this.scene.game.canvas.height / 32) - (40 - (28 * row - 1))), shopTypeOptions[m]);
option.setScale(0.375);
this.scene.add.existing(option);
this.modifierContainer.add(option);
if (row >= this.shopOptionsRows.length) {
this.shopOptionsRows.push([]);
}
this.shopOptionsRows[row].push(option);
}
const maxUpgradeCount = typeOptions.map(to => to.upgradeCount).reduce((max, current) => Math.max(current, max), 0);
2023-04-12 12:48:02 -04:00
/* Force updateModifiers without pokemonSpecificModifiers */
this.scene.getModifierBar().updateModifiers(this.scene.modifiers, true);
/* Multiplies the appearance duration by the speed parameter so that it is always constant, and avoids "flashbangs" at game speed x5 */
this.scene.showShopOverlay(750 * this.scene.gameSpeed);
this.scene.updateAndShowText(750);
this.scene.updateBiomeWaveText();
2024-05-30 13:45:30 -04:00
this.scene.updateMoneyText();
2023-03-28 14:54:52 -04:00
let i = 0;
2024-05-24 01:45:04 +02:00
2023-03-28 14:54:52 -04:00
this.scene.tweens.addCounter({
ease: "Sine.easeIn",
2023-03-28 14:54:52 -04:00
duration: 1250,
onUpdate: t => {
const value = t.getValue();
2023-04-12 12:48:02 -04:00
const index = Math.floor(value * typeOptions.length);
if (index > i && index <= typeOptions.length) {
const option = this.options[i];
option?.show(Math.floor((1 - value) * 1250) * 0.325 + 2000 * maxUpgradeCount, -(maxUpgradeCount - typeOptions[i].upgradeCount));
i++;
2023-03-29 00:31:25 -04:00
}
2023-03-28 14:54:52 -04:00
}
});
this.scene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => {
for (const shopOption of this.shopOptionsRows.flat()) {
shopOption.show(0, 0);
}
});
this.scene.time.delayedCall(4000 + maxUpgradeCount * 2000, () => {
2023-04-21 14:05:16 -04:00
if (partyHasHeldItem) {
this.transferButtonContainer.setAlpha(0);
this.transferButtonContainer.setVisible(true);
this.scene.tweens.add({
targets: this.transferButtonContainer,
alpha: 1,
duration: 250
});
}
this.rerollButtonContainer.setAlpha(0);
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 15:07:23 +10:00
this.checkButtonContainer.setAlpha(0);
this.lockRarityButtonContainer.setAlpha(0);
this.continueButtonContainer.setAlpha(0);
this.rerollButtonContainer.setVisible(true);
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 15:07:23 +10:00
this.checkButtonContainer.setVisible(true);
this.continueButtonContainer.setVisible(this.rerollCost === 0);
this.lockRarityButtonContainer.setVisible(canLockRarities);
this.scene.tweens.add({
targets: [ this.lockRarityButtonContainer, this.checkButtonContainer, this.continueButtonContainer ],
alpha: 1,
duration: 250
});
this.scene.tweens.add({
targets: [this.rerollButtonContainer],
alpha: this.rerollCost === 0 ? 0.5 : 1,
duration: 250
});
2023-03-28 14:54:52 -04:00
this.setCursor(0);
this.setRowCursor(1);
2024-02-14 10:44:55 -05:00
handleTutorial(this.scene, Tutorial.Select_Item).then(() => {
this.setCursor(0);
this.awaitingActionInput = true;
this.onActionInput = args[2];
});
2023-03-28 14:54:52 -04:00
});
2023-12-30 18:41:25 -05:00
return true;
2023-03-28 14:54:52 -04:00
}
processInput(button: Button): boolean {
2023-03-28 14:54:52 -04:00
const ui = this.getUi();
if (!this.awaitingActionInput) {
return false;
}
2023-03-28 14:54:52 -04:00
let success = false;
if (button === Button.ACTION) {
2023-03-28 14:54:52 -04:00
success = true;
2023-04-09 00:22:14 -04:00
if (this.onActionInput) {
const originalOnActionInput = this.onActionInput;
2023-04-09 19:15:21 -04:00
this.awaitingActionInput = false;
2023-04-09 00:22:14 -04:00
this.onActionInput = null;
if (!originalOnActionInput(this.rowCursor, this.cursor)) {
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
} else {
this.moveInfoOverlayActive = this.moveInfoOverlay.active;
this.moveInfoOverlay.setVisible(false);
this.moveInfoOverlay.active = false; // this is likely unnecessary, but it should help future prove the UI
}
2023-04-09 00:22:14 -04:00
}
} else if (button === Button.CANCEL) {
if (this.player) {
success = true;
if (this.onActionInput) {
const originalOnActionInput = this.onActionInput;
this.awaitingActionInput = false;
this.onActionInput = null;
originalOnActionInput(-1);
this.moveInfoOverlayActive = this.moveInfoOverlay.active;
this.moveInfoOverlay.setVisible(false);
this.moveInfoOverlay.active = false; // don't clear here as we might need to restore the UI in case the user cancels the action
}
2023-04-09 00:22:14 -04:00
}
2023-03-28 14:54:52 -04:00
} else {
switch (button) {
case Button.UP:
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 15:07:23 +10:00
if (this.rowCursor === 0 && this.cursor === 3) {
success = this.setCursor(0);
} else if (this.rowCursor < this.shopOptionsRows.length + 1) {
success = this.setRowCursor(this.rowCursor + 1);
}
break;
case Button.DOWN:
if (this.rowCursor) {
success = this.setRowCursor(this.rowCursor - 1);
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 15:07:23 +10:00
} else if (this.lockRarityButtonContainer.visible && this.cursor === 0) {
success = this.setCursor(3);
}
break;
case Button.LEFT:
if (!this.rowCursor) {
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 15:07:23 +10:00
switch (this.cursor) {
case 0:
success = false;
break;
case 1:
success = this.rerollButtonContainer.visible && this.setCursor(0);
break;
case 2:
if (this.transferButtonContainer.visible) {
success = this.setCursor(1);
} else if (this.rerollButtonContainer.visible) {
success = this.setCursor(0);
} else {
success = false;
}
break;
}
} else if (this.cursor) {
success = this.setCursor(this.cursor - 1);
} else if (this.rowCursor === 1 && this.rerollButtonContainer.visible) {
success = this.setRowCursor(0);
}
break;
case Button.RIGHT:
if (!this.rowCursor) {
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 15:07:23 +10:00
switch (this.cursor) {
case 0:
if (this.transferButtonContainer.visible) {
success = this.setCursor(1);
} else {
success = this.setCursor(2);
}
break;
case 1:
success = this.setCursor(2);
break;
case 2:
success = false;
break;
}
} else if (this.cursor < this.getRowItems(this.rowCursor) - 1) {
success = this.setCursor(this.cursor + 1);
} else if (this.rowCursor === 1 && this.transferButtonContainer.visible) {
success = this.setRowCursor(0);
}
break;
2023-03-28 14:54:52 -04:00
}
}
if (success) {
2023-03-28 14:54:52 -04:00
ui.playSelect();
}
return success;
2023-03-28 14:54:52 -04:00
}
setCursor(cursor: integer): boolean {
const ui = this.getUi();
const ret = super.setCursor(cursor);
if (!this.cursorObj) {
this.cursorObj = this.scene.add.image(0, 0, "cursor");
2023-03-28 14:54:52 -04:00
this.modifierContainer.add(this.cursorObj);
}
const options = (this.rowCursor === 1 ? this.options : this.shopOptionsRows[this.shopOptionsRows.length - (this.rowCursor - 1)]);
this.cursorObj.setScale(this.rowCursor === 1 ? 2 : this.rowCursor >= 2 ? 1.5 : 1);
2023-04-21 14:05:16 -04:00
// the modifier selection has been updated, always hide the overlay
this.moveInfoOverlay.clear();
if (this.rowCursor) {
if (this.rowCursor === 1 && options.length === 0) {
// Continue button when no shop items
this.cursorObj.setScale(1.25);
this.cursorObj.setPosition((this.scene.game.canvas.width / 18) + 23, (-this.scene.game.canvas.height / 12) - (this.shopOptionsRows.length > 1 ? 6 : 22));
ui.showText("Continue to the next wave.");
return ret;
}
const sliceWidth = (this.scene.game.canvas.width / 6) / (options.length + 2);
if (this.rowCursor < 2) {
this.cursorObj.setPosition(sliceWidth * (cursor + 1) + (sliceWidth * 0.5) - 20, (-this.scene.game.canvas.height / 12) - (this.shopOptionsRows.length > 1 ? 6 : 22));
} else {
this.cursorObj.setPosition(sliceWidth * (cursor + 1) + (sliceWidth * 0.5) - 16, (-this.scene.game.canvas.height / 12 - this.scene.game.canvas.height / 32) - (-16 + 28 * (this.rowCursor - (this.shopOptionsRows.length - 1))));
}
const type = options[this.cursor].modifierTypeOption.type;
ui.showText(type.getDescription(this.scene));
if (type instanceof TmModifierType) {
// prepare the move overlay to be shown with the toggle
this.moveInfoOverlay.show(allMoves[type.moveId]);
}
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 15:07:23 +10:00
} else if (cursor === 0) {
this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
ui.showText(i18next.t("modifierSelectUiHandler:rerollDesc"));
} else if (cursor === 1) {
2024-07-09 23:19:44 -04:00
this.cursorObj.setPosition((this.scene.game.canvas.width - this.transferButtonWidth - this.checkButtonWidth) / 6 - 30, -60);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
ui.showText(i18next.t("modifierSelectUiHandler:transferDesc"));
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 15:07:23 +10:00
} else if (cursor === 2) {
2024-07-09 23:19:44 -04:00
this.cursorObj.setPosition((this.scene.game.canvas.width - this.checkButtonWidth) / 6 - 10, -60);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
ui.showText(i18next.t("modifierSelectUiHandler:checkTeamDesc"));
} else {
this.cursorObj.setPosition(6, -60);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
ui.showText(i18next.t("modifierSelectUiHandler:lockRaritiesDesc"));
2023-04-21 14:05:16 -04:00
}
2023-03-28 14:54:52 -04:00
return ret;
}
setRowCursor(rowCursor: integer): boolean {
const lastRowCursor = this.rowCursor;
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 15:07:23 +10:00
if (rowCursor !== lastRowCursor) {
this.rowCursor = rowCursor;
let newCursor = Math.round(this.cursor / Math.max(this.getRowItems(lastRowCursor) - 1, 1) * (this.getRowItems(rowCursor) - 1));
if (rowCursor === 1 && this.options.length === 0) {
// Handle empty shop
newCursor = 0;
}
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 15:07:23 +10:00
if (rowCursor === 0) {
if (this.options.length === 0) {
newCursor = 1;
}
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 15:07:23 +10:00
if (newCursor === 0 && !this.rerollButtonContainer.visible) {
newCursor = 1;
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 15:07:23 +10:00
}
if (newCursor === 1 && !this.transferButtonContainer.visible) {
newCursor = 2;
}
}
this.cursor = -1;
this.setCursor(newCursor);
return true;
}
return false;
}
private getRowItems(rowCursor: integer): integer {
switch (rowCursor) {
case 0:
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 15:07:23 +10:00
return 3;
case 1:
return this.options.length;
default:
return this.shopOptionsRows[this.shopOptionsRows.length - (rowCursor - 1)].length;
}
}
setRerollCost(rerollCost: integer): void {
this.rerollCost = rerollCost;
}
updateCostText(): void {
const shopOptions = this.shopOptionsRows.flat();
for (const shopOption of shopOptions) {
shopOption.updateCostText();
}
this.updateRerollCostText();
}
updateRerollCostText(): void {
const canReroll = this.scene.money >= this.rerollCost;
const formattedMoney = Utils.formatMoney(this.scene.moneyFormat, this.rerollCost);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
this.rerollCostText.setText(i18next.t("modifierSelectUiHandler:rerollCost", { formattedMoney }));
this.rerollCostText.setColor(this.getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED));
this.rerollCostText.setShadowColor(this.getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED, true));
}
updateLockRaritiesText(): void {
const textStyle = this.scene.lockModifierTiers ? TextStyle.SUMMARY_BLUE : TextStyle.PARTY;
this.lockRarityButtonText.setColor(this.getTextColor(textStyle));
this.lockRarityButtonText.setShadowColor(this.getTextColor(textStyle, true));
}
2023-03-28 14:54:52 -04:00
clear() {
super.clear();
this.moveInfoOverlay.clear();
this.moveInfoOverlayActive = false;
2023-03-28 14:54:52 -04:00
this.awaitingActionInput = false;
this.onActionInput = null;
this.getUi().clearText();
this.eraseCursor();
/* Multiplies the fade time duration by the speed parameter so that it is always constant, and avoids "flashbangs" at game speed x5 */
this.scene.hideShopOverlay(750 * this.scene.gameSpeed);
2024-05-30 13:45:30 -04:00
this.scene.hideLuckText(250);
/* Normally already called just after the shop, but not sure if it happens in 100% of cases */
this.scene.getModifierBar().updateModifiers(this.scene.modifiers);
const options = this.options.concat(this.shopOptionsRows.flat());
this.options.splice(0, this.options.length);
this.shopOptionsRows.splice(0, this.shopOptionsRows.length);
2024-05-24 01:45:04 +02:00
2023-03-28 14:54:52 -04:00
this.scene.tweens.add({
targets: options,
2023-03-28 14:54:52 -04:00
scale: 0.01,
duration: 250,
ease: "Cubic.easeIn",
onComplete: () => options.forEach(o => o.destroy())
2023-03-28 14:54:52 -04:00
});
2024-05-24 01:45:04 +02:00
[ this.rerollButtonContainer, this.checkButtonContainer, this.transferButtonContainer, this.lockRarityButtonContainer, this.continueButtonContainer ].forEach(container => {
2023-11-10 16:41:02 -05:00
if (container.visible) {
this.scene.tweens.add({
targets: container,
alpha: 0,
duration: 250,
ease: "Cubic.easeIn",
2023-11-10 16:41:02 -05:00
onComplete: () => {
if (!this.options.length) {
2023-11-10 16:41:02 -05:00
container.setVisible(false);
} else {
2023-11-10 16:41:02 -05:00
container.setAlpha(1);
}
}
2023-11-10 16:41:02 -05:00
});
}
});
2023-03-28 14:54:52 -04:00
}
eraseCursor() {
if (this.cursorObj) {
2023-03-28 14:54:52 -04:00
this.cursorObj.destroy();
}
2023-03-28 14:54:52 -04:00
this.cursorObj = null;
}
}
class ModifierOption extends Phaser.GameObjects.Container {
2023-04-12 12:48:02 -04:00
public modifierTypeOption: ModifierTypeOption;
2023-03-28 14:54:52 -04:00
private pb: Phaser.GameObjects.Sprite;
2023-04-12 12:48:02 -04:00
private pbTint: Phaser.GameObjects.Sprite;
2023-03-28 14:54:52 -04:00
private itemContainer: Phaser.GameObjects.Container;
private item: Phaser.GameObjects.Sprite;
private itemTint: Phaser.GameObjects.Sprite;
private itemText: Phaser.GameObjects.Text;
private itemCostText: Phaser.GameObjects.Text;
2023-03-28 14:54:52 -04:00
2023-04-12 12:48:02 -04:00
constructor(scene: BattleScene, x: number, y: number, modifierTypeOption: ModifierTypeOption) {
2023-03-28 14:54:52 -04:00
super(scene, x, y);
2023-04-12 12:48:02 -04:00
this.modifierTypeOption = modifierTypeOption;
2023-03-28 14:54:52 -04:00
this.setup();
}
setup() {
if (!this.modifierTypeOption.cost) {
const getPb = (): Phaser.GameObjects.Sprite => {
const pb = this.scene.add.sprite(0, -182, "pb", this.getPbAtlasKey(-this.modifierTypeOption.upgradeCount));
pb.setScale(2);
return pb;
};
this.pb = getPb();
this.add(this.pb);
this.pbTint = getPb();
this.pbTint.setVisible(false);
this.add(this.pbTint);
}
2023-04-12 12:48:02 -04:00
2023-03-28 14:54:52 -04:00
this.itemContainer = this.scene.add.container(0, 0);
this.itemContainer.setScale(0.5);
this.itemContainer.setAlpha(0);
this.add(this.itemContainer);
const getItem = () => {
const item = this.scene.add.sprite(0, 0, "items", this.modifierTypeOption.type.iconImage);
2023-03-28 14:54:52 -04:00
return item;
};
this.item = getItem();
this.itemContainer.add(this.item);
if (!this.modifierTypeOption.cost) {
this.itemTint = getItem();
this.itemTint.setTintFill(Phaser.Display.Color.GetColor(255, 192, 255));
this.itemContainer.add(this.itemTint);
}
2023-03-28 14:54:52 -04:00
this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type.name, TextStyle.PARTY, { align: "center" });
2023-03-28 14:54:52 -04:00
this.itemText.setOrigin(0.5, 0);
this.itemText.setAlpha(0);
2023-11-02 00:55:20 -04:00
this.itemText.setTint(getModifierTierTextTint(this.modifierTypeOption.type.tier));
2023-03-28 14:54:52 -04:00
this.add(this.itemText);
if (this.modifierTypeOption.cost) {
this.itemCostText = addTextObject(this.scene, 0, 45, "", TextStyle.MONEY, { align: "center" });
2024-05-24 01:45:04 +02:00
this.itemCostText.setOrigin(0.5, 0);
this.itemCostText.setAlpha(0);
this.add(this.itemCostText);
this.updateCostText();
}
2023-03-28 14:54:52 -04:00
}
show(remainingDuration: integer, upgradeCountOffset: integer) {
if (!this.modifierTypeOption.cost) {
this.scene.tweens.add({
targets: this.pb,
y: 0,
duration: 1250,
ease: "Bounce.Out"
});
2023-03-28 14:54:52 -04:00
let lastValue = 1;
let bounceCount = 0;
let bounce = false;
this.scene.tweens.addCounter({
from: 1,
to: 0,
duration: 1250,
ease: "Bounce.Out",
onUpdate: t => {
if (!this.scene) {
return;
}
const value = t.getValue();
if (!bounce && value > lastValue) {
(this.scene as BattleScene).playSound("pb_bounce_1", { volume: 1 / ++bounceCount });
bounce = true;
} else if (bounce && value < lastValue) {
bounce = false;
}
lastValue = value;
}
});
2023-03-28 14:54:52 -04:00
for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) {
const upgradeIndex = u;
this.scene.time.delayedCall(remainingDuration - 2000 * (this.modifierTypeOption.upgradeCount - (upgradeIndex + 1 + upgradeCountOffset)), () => {
(this.scene as BattleScene).playSound("upgrade", { rate: 1 + 0.25 * upgradeIndex });
this.pbTint.setPosition(this.pb.x, this.pb.y);
this.pbTint.setTintFill(0xFFFFFF);
this.pbTint.setAlpha(0);
this.pbTint.setVisible(true);
this.scene.tweens.add({
targets: this.pbTint,
alpha: 1,
duration: 1000,
ease: "Sine.easeIn",
onComplete: () => {
this.pb.setTexture("pb", this.getPbAtlasKey(-this.modifierTypeOption.upgradeCount + (upgradeIndex + 1)));
this.scene.tweens.add({
targets: this.pbTint,
alpha: 0,
duration: 750,
ease: "Sine.easeOut",
onComplete: () => {
this.pbTint.setVisible(false);
}
});
}
});
2023-04-12 12:48:02 -04:00
});
}
2023-04-12 12:48:02 -04:00
}
2023-03-28 14:54:52 -04:00
this.scene.time.delayedCall(remainingDuration + 2000, () => {
if (!this.scene) {
2023-03-29 00:31:25 -04:00
return;
}
2023-03-29 00:31:25 -04:00
if (!this.modifierTypeOption.cost) {
this.pb.setTexture("pb", `${this.getPbAtlasKey(0)}_open`);
(this.scene as BattleScene).playSound("pb_rel");
2024-05-24 01:45:04 +02:00
this.scene.tweens.add({
targets: this.pb,
duration: 500,
delay: 250,
ease: "Sine.easeIn",
alpha: 0,
onComplete: () => this.pb.destroy()
});
}
2023-03-28 14:54:52 -04:00
this.scene.tweens.add({
targets: this.itemContainer,
duration: 500,
ease: "Elastic.Out",
2023-03-28 14:54:52 -04:00
scale: 2,
alpha: 1
});
if (!this.modifierTypeOption.cost) {
this.scene.tweens.add({
targets: this.itemTint,
alpha: 0,
duration: 500,
ease: "Sine.easeIn",
onComplete: () => this.itemTint.destroy()
});
}
2023-03-28 14:54:52 -04:00
this.scene.tweens.add({
targets: this.itemText,
duration: 500,
alpha: 1,
y: 25,
ease: "Cubic.easeInOut"
2023-03-28 14:54:52 -04:00
});
if (this.itemCostText) {
this.scene.tweens.add({
targets: this.itemCostText,
duration: 500,
alpha: 1,
y: 35,
ease: "Cubic.easeInOut"
});
}
});
2023-03-28 14:54:52 -04:00
}
getPbAtlasKey(tierOffset: integer = 0) {
return getPokeballAtlasKey((this.modifierTypeOption.type.tier + tierOffset) as integer as PokeballType);
2023-03-28 14:54:52 -04:00
}
updateCostText(): void {
const scene = this.scene as BattleScene;
const textStyle = this.modifierTypeOption.cost <= scene.money ? TextStyle.MONEY : TextStyle.PARTY_RED;
const formattedMoney = Utils.formatMoney(scene.moneyFormat, this.modifierTypeOption.cost);
[Localization] modifier-select-ui-handler Locales (#2527) * Update modifier-select-ui-handler.ts * Update i18next.d.ts * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts * Update src/locales/ko/modifier-select-ui-handler.ts Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> * Update src/locales/zh_CN/modifier-select-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/modifier-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update config.ts * Update modifier-select-ui-handler.ts * Update src/locales/pt_BR/modifier-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> * Update modifier-select-ui-handler.ts [Localization(it)] * Update src/locales/es/modifier-select-ui-handler.ts Co-authored-by: InnocentGameDev <asdargmng@gmail.com> * Adaptive buttons and cursors * Update modifier-select-ui-handler.ts * Update modifier-select-ui-handler.ts --------- Co-authored-by: yun <97648143+ddullgi@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: GoldTra <162721984+GoldTra@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: InnocentGameDev <asdargmng@gmail.com> Co-authored-by: hjh <j1441257360@163.com>
2024-07-04 22:40:54 +02:00
this.itemCostText.setText(i18next.t("modifierSelectUiHandler:itemCost", { formattedMoney }));
this.itemCostText.setColor(getTextColor(textStyle, false, scene.uiTheme));
this.itemCostText.setShadowColor(getTextColor(textStyle, true, scene.uiTheme));
}
}