From 03ee764e230626b1a175795c938b8e38a2d1ddc8 Mon Sep 17 00:00:00 2001 From: "Adrian T." <68144167+torranx@users.noreply.github.com> Date: Fri, 23 Aug 2024 00:26:10 +0800 Subject: [PATCH] [QoL] Settings Option: Shop Cursor Target (#3666) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [QoL] Post Reroll UI Targeting * removed hasRolled from battlescene and handled in UI * Added getter for reroll count and ternary * Explicit catch instead of falsy * Fixed Settings errors with proper labeling * changed setting label to translate as well * translations and fixes * move option further down * change integer to number * change integer to number * update implementation * remove unused method * change name set to update * Update src/ui/modifier-select-ui-handler.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/system/settings/settings.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/locales/fr/settings.ts Co-authored-by: Lugiad' * Update src/locales/pt_BR/settings.ts Co-authored-by: José Ricardo Fleury Oliveira * Update src/locales/ko/settings.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * Update src/locales/zh_CN/settings.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/it/settings.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Revert "Update src/locales/ko/settings.ts" This reverts commit 08c0b89f4caf7c33f49722200d7aeb20b79b0ba5. * Update src/locales/ko/settings.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * Revert "Revert "Update src/locales/ko/settings.ts"" This reverts commit a57d8777f2e0538ee34764c91d6841bd3ef0dc60. --------- Co-authored-by: Matthew Kroeger Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Lugiad' Co-authored-by: José Ricardo Fleury Oliveira Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> --- src/battle-scene.ts | 2 ++ src/enums/shop-cursor-target.ts | 13 +++++++++++++ src/locales/ca_ES/settings.ts | 7 ++++++- src/locales/de/settings.ts | 5 +++++ src/locales/en/settings.ts | 7 ++++++- src/locales/es/settings.ts | 7 ++++++- src/locales/fr/settings.ts | 7 ++++++- src/locales/it/settings.ts | 7 ++++++- src/locales/ja/settings.ts | 5 +++++ src/locales/ko/settings.ts | 7 ++++++- src/locales/pt_BR/settings.ts | 7 ++++++- src/locales/zh_CN/settings.ts | 7 ++++++- src/locales/zh_TW/settings.ts | 7 ++++++- src/phases/select-modifier-phase.ts | 2 +- src/system/settings/settings.ts | 28 ++++++++++++++++++++++++++++ src/ui/modifier-select-ui-handler.ts | 20 ++++++++++++++++---- 16 files changed, 124 insertions(+), 14 deletions(-) create mode 100644 src/enums/shop-cursor-target.ts diff --git a/src/battle-scene.ts b/src/battle-scene.ts index af63f0b0a39..eaf550e7d10 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -83,6 +83,7 @@ import { SwitchPhase } from "./phases/switch-phase"; import { TitlePhase } from "./phases/title-phase"; import { ToggleDoublePositionPhase } from "./phases/toggle-double-position-phase"; import { TurnInitPhase } from "./phases/turn-init-phase"; +import { ShopCursorTarget } from "./enums/shop-cursor-target"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; @@ -127,6 +128,7 @@ export default class BattleScene extends SceneBase { public gameSpeed: integer = 1; public damageNumbersMode: integer = 0; public reroll: boolean = false; + public shopCursorTarget: number = ShopCursorTarget.CHECK_TEAM; public showMovesetFlyout: boolean = true; public showArenaFlyout: boolean = true; public showTimeOfDayWidget: boolean = true; diff --git a/src/enums/shop-cursor-target.ts b/src/enums/shop-cursor-target.ts new file mode 100644 index 00000000000..d2f72fed0d6 --- /dev/null +++ b/src/enums/shop-cursor-target.ts @@ -0,0 +1,13 @@ +/** + * Determines the cursor target when entering the shop phase. + */ +export enum ShopCursorTarget { + /** Cursor points to Reroll */ + REROLL, + /** Cursor points to Items */ + ITEMS, + /** Cursor points to Shop */ + SHOP, + /** Cursor points to Check Team */ + CHECK_TEAM +} diff --git a/src/locales/ca_ES/settings.ts b/src/locales/ca_ES/settings.ts index 491bfa4a481..9c0b3f36365 100644 --- a/src/locales/ca_ES/settings.ts +++ b/src/locales/ca_ES/settings.ts @@ -96,5 +96,10 @@ export const settings: SimpleTranslationEntries = { "controller": "Controller", "gamepadSupport": "Gamepad Support", "showBgmBar": "Show Music Names", - "shopOverlayOpacity": "Shop Overlay Opacity" + "shopOverlayOpacity": "Shop Overlay Opacity", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/locales/de/settings.ts b/src/locales/de/settings.ts index 7d4523c8cbd..3942e470e3f 100644 --- a/src/locales/de/settings.ts +++ b/src/locales/de/settings.ts @@ -99,4 +99,9 @@ export const settings: SimpleTranslationEntries = { "showBgmBar": "Musiknamen anzeigen", "moveTouchControls": "Bewegung Touch Steuerung", "shopOverlayOpacity": "Shop Overlay Deckkraft", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/locales/en/settings.ts b/src/locales/en/settings.ts index c63f9de6049..ad2ea914dc9 100644 --- a/src/locales/en/settings.ts +++ b/src/locales/en/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "Gamepad Support", "showBgmBar": "Show Music Names", "moveTouchControls": "Move Touch Controls", - "shopOverlayOpacity": "Shop Overlay Opacity" + "shopOverlayOpacity": "Shop Overlay Opacity", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/locales/es/settings.ts b/src/locales/es/settings.ts index c7f723fe80c..fbc56d92fe5 100644 --- a/src/locales/es/settings.ts +++ b/src/locales/es/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "Gamepad Support", "showBgmBar": "Show Music Names", "moveTouchControls": "Move Touch Controls", - "shopOverlayOpacity": "Opacidad de la fase de compra" + "shopOverlayOpacity": "Opacidad de la fase de compra", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/locales/fr/settings.ts b/src/locales/fr/settings.ts index 95246ccb7d0..d5e4047bb12 100644 --- a/src/locales/fr/settings.ts +++ b/src/locales/fr/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "Gamepad Support", "showBgmBar": "Titre de la musique", "moveTouchControls": "Déplacer les contrôles tactiles", - "shopOverlayOpacity": "Opacité boutique" + "shopOverlayOpacity": "Opacité boutique", + "shopCursorTarget": "Choix après relance", + "items": "Obj. gratuits", + "reroll": "Relance", + "shop": "Boutique", + "checkTeam": "Équipe" } as const; diff --git a/src/locales/it/settings.ts b/src/locales/it/settings.ts index 0d05d01ba1c..278a02bef52 100644 --- a/src/locales/it/settings.ts +++ b/src/locales/it/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "Supporto Gamepad", "showBgmBar": "Mostra Nomi Musica", "moveTouchControls": "Move Touch Controls", - "shopOverlayOpacity": "Opacità Finestra Negozio" + "shopOverlayOpacity": "Opacità Finestra Negozio", + "shopCursorTarget": "Target Cursore Negozio", + "items": "Oggetti", + "reroll": "Rerolla", + "shop": "Negozio", + "checkTeam": "Squadra" } as const; diff --git a/src/locales/ja/settings.ts b/src/locales/ja/settings.ts index ef20d071d2d..3be237e26ae 100644 --- a/src/locales/ja/settings.ts +++ b/src/locales/ja/settings.ts @@ -98,4 +98,9 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "コントローラーサポート", "showBgmBar": "Show Music Names", "shopOverlayOpacity": "Shop Overlay Opacity", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/locales/ko/settings.ts b/src/locales/ko/settings.ts index aa4adfc4e41..38b0679d911 100644 --- a/src/locales/ko/settings.ts +++ b/src/locales/ko/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "게임패드 지원", "showBgmBar": "BGM 제목 보여주기", "moveTouchControls": "터치 컨트롤 이동", - "shopOverlayOpacity": "상점 오버레이 투명도" + "shopOverlayOpacity": "상점 오버레이 투명도", + "shopCursorTarget": "상점 커서 위치", + "items": "아이템", + "reroll": "갱신", + "shop": "상점", + "checkTeam": "파티 확인" } as const; diff --git a/src/locales/pt_BR/settings.ts b/src/locales/pt_BR/settings.ts index 14646b59742..e34fdfa0e5d 100644 --- a/src/locales/pt_BR/settings.ts +++ b/src/locales/pt_BR/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "Suporte para Controle", "showBgmBar": "Exibir Nomes das Músicas", "moveTouchControls": "Move Touch Controls", - "shopOverlayOpacity": "Opacidade da Loja" + "shopOverlayOpacity": "Opacidade da Loja", + "shopCursorTarget": "Alvo do Cursor da Loja", + "items": "Itens", + "reroll": "Atualizar", + "shop": "Loja", + "checkTeam": "Checar Time" } as const; diff --git a/src/locales/zh_CN/settings.ts b/src/locales/zh_CN/settings.ts index 422b1bd591d..d727ac2bef5 100644 --- a/src/locales/zh_CN/settings.ts +++ b/src/locales/zh_CN/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "手柄支持", "showBgmBar": "显示音乐名称", "moveTouchControls": "移动触摸控制", - "shopOverlayOpacity": "商店显示不透明度" + "shopOverlayOpacity": "商店显示不透明度", + "shopCursorTarget": "商店指针位置", + "items": "道具", + "reroll": "刷新", + "shop": "购买", + "checkTeam": "检查队伍" } as const; diff --git a/src/locales/zh_TW/settings.ts b/src/locales/zh_TW/settings.ts index 35499f45d15..7e6bf25bd7a 100644 --- a/src/locales/zh_TW/settings.ts +++ b/src/locales/zh_TW/settings.ts @@ -98,5 +98,10 @@ export const settings: SimpleTranslationEntries = { "gamepadSupport": "手柄支持", "showBgmBar": "Show Music Names", "moveTouchControls": "移動觸控控制", - "shopOverlayOpacity": "Shop Overlay Opacity" + "shopOverlayOpacity": "Shop Overlay Opacity", + "shopCursorTarget": "Shop Cursor Target", + "items": "Items", + "reroll": "Reroll", + "shop": "Shop", + "checkTeam": "Check Team" } as const; diff --git a/src/phases/select-modifier-phase.ts b/src/phases/select-modifier-phase.ts index 67ae904fb58..57b842e7b38 100644 --- a/src/phases/select-modifier-phase.ts +++ b/src/phases/select-modifier-phase.ts @@ -205,7 +205,7 @@ export class SelectModifierPhase extends BattlePhase { return true; } - getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer { + getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): number { let baseValue = 0; if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) { return baseValue; diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 7263ae3a3de..4bd69788f04 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -9,6 +9,7 @@ import { EaseType } from "#enums/ease-type"; import { MoneyFormat } from "#enums/money-format"; import { PlayerGender } from "#enums/player-gender"; import { getIsInitialized, initI18n } from "#app/plugins/i18n.js"; +import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; function getTranslation(key: string): string { if (!getIsInitialized()) { @@ -102,6 +103,7 @@ export const SettingKeys = { Damage_Numbers: "DAMAGE_NUMBERS", Move_Animations: "MOVE_ANIMATIONS", Show_Stats_on_Level_Up: "SHOW_LEVEL_UP_STATS", + Reroll_Target: "REROLL_TARGET", Candy_Upgrade_Notification: "CANDY_UPGRADE_NOTIFICATION", Candy_Upgrade_Display: "CANDY_UPGRADE_DISPLAY", Move_Info: "MOVE_INFO", @@ -577,6 +579,30 @@ export const Setting: Array = [ activatable: true, isHidden: () => !hasTouchscreen() }, + { + key: SettingKeys.Reroll_Target, + label: i18next.t("settings:shopCursorTarget"), + options: [ + { + value:"Reroll", + label: i18next.t("settings:reroll") + }, + { + value:"Items", + label: i18next.t("settings:items") + }, + { + value:"Shop", + label: i18next.t("settings:shop") + }, + { + value:"Check Team", + label: i18next.t("settings:checkTeam") + } + ], + default: ShopCursorTarget.CHECK_TEAM, + type: SettingType.DISPLAY + }, { key: SettingKeys.Shop_Overlay_Opacity, label: i18next.t("settings:shopOverlayOpacity"), @@ -709,6 +735,8 @@ export function setSetting(scene: BattleScene, setting: string, value: integer): case SettingKeys.Show_Stats_on_Level_Up: scene.showLevelUpStats = Setting[index].options[value].value === "On"; break; + case SettingKeys.Reroll_Target: + scene.shopCursorTarget = value; case SettingKeys.EXP_Gains_Speed: scene.expGainsSpeed = value; break; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 016708027ca..bb1f970fe1c 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -12,6 +12,7 @@ import { allMoves } from "../data/move"; import * as Utils from "./../utils"; import Overrides from "#app/overrides"; import i18next from "i18next"; +import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; export const SHOP_OPTIONS_ROW_LIMIT = 6; @@ -249,11 +250,22 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { duration: 250 }); - this.setCursor(0); - this.setRowCursor(1); + const updateCursorTarget = () => { + if (this.scene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) { + this.setRowCursor(0); + this.setCursor(2); + } else { + this.setRowCursor(this.scene.shopCursorTarget); + this.setCursor(0); + } + }; - handleTutorial(this.scene, Tutorial.Select_Item).then(() => { - this.setCursor(0); + updateCursorTarget(); + + handleTutorial(this.scene, Tutorial.Select_Item).then((res) => { + if (res) { + updateCursorTarget(); + } this.awaitingActionInput = true; this.onActionInput = args[2]; });