diff --git a/src/battle-scene.ts b/src/battle-scene.ts index c9f7362728a..4cc3f69ebee 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -130,7 +130,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 shopCursorTarget: number = ShopCursorTarget.REWARDS; 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 index d2f72fed0d6..11f524399b2 100644 --- a/src/enums/shop-cursor-target.ts +++ b/src/enums/shop-cursor-target.ts @@ -1,13 +1,13 @@ /** - * Determines the cursor target when entering the shop phase. + * Determines the row cursor target when entering the shop phase. */ export enum ShopCursorTarget { - /** Cursor points to Reroll */ + /** Cursor points to Reroll row */ REROLL, - /** Cursor points to Items */ - ITEMS, - /** Cursor points to Shop */ + /** Cursor points to Rewards row */ + REWARDS, + /** Cursor points to Shop row */ SHOP, - /** Cursor points to Check Team */ + /** Cursor points to Check Team row */ CHECK_TEAM } diff --git a/src/locales/de/settings.json b/src/locales/de/settings.json index d72a026cf5a..31406f28d17 100644 --- a/src/locales/de/settings.json +++ b/src/locales/de/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "Bewegung Touch Steuerung", "shopOverlayOpacity": "Shop Overlay Deckkraft", "shopCursorTarget": "Shop-Cursor Ziel", - "items": "Items", + "rewards": "Items", "reroll": "Neu rollen", "shop": "Shop", "checkTeam": "Team überprüfen" diff --git a/src/locales/en/settings.json b/src/locales/en/settings.json index 6528f0368fe..301ebea9b2b 100644 --- a/src/locales/en/settings.json +++ b/src/locales/en/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "Move Touch Controls", "shopOverlayOpacity": "Shop Overlay Opacity", "shopCursorTarget": "Shop Cursor Target", - "items": "Items", + "rewards": "Rewards", "reroll": "Reroll", "shop": "Shop", "checkTeam": "Check Team" diff --git a/src/locales/es/settings.json b/src/locales/es/settings.json index 9c16fbb0fd6..dc441d48eb8 100644 --- a/src/locales/es/settings.json +++ b/src/locales/es/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "Controles táctiles", "shopOverlayOpacity": "Opacidad de la fase de compra", "shopCursorTarget": "Cursor de la tienda", - "items": "Objetos", + "rewards": "Objetos", "reroll": "Actualizar", "shop": "Tienda", "checkTeam": "Ver equipo" diff --git a/src/locales/fr/settings.json b/src/locales/fr/settings.json index 181a593cc99..c752b336b6e 100644 --- a/src/locales/fr/settings.json +++ b/src/locales/fr/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "Déplacer les contrôles tactiles", "shopOverlayOpacity": "Opacité boutique", "shopCursorTarget": "Choix après relance", - "items": "Obj. gratuits", + "rewards": "Obj. gratuits", "reroll": "Relance", "shop": "Boutique", "checkTeam": "Équipe" diff --git a/src/locales/it/settings.json b/src/locales/it/settings.json index 381503f21bd..c09f5e22d4d 100644 --- a/src/locales/it/settings.json +++ b/src/locales/it/settings.json @@ -8,7 +8,7 @@ "moveTouchControls": "Move Touch Controls", "shopOverlayOpacity": "Opacità Finestra Negozio", "shopCursorTarget": "Target Cursore Negozio", - "items": "Oggetti", + "rewards": "Oggetti", "reroll": "Rerolla", "shop": "Negozio", "checkTeam": "Squadra" diff --git a/src/locales/ja/settings.json b/src/locales/ja/settings.json index 4cb10c670de..55d39ee70a4 100644 --- a/src/locales/ja/settings.json +++ b/src/locales/ja/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "タッチ移動操作", "shopOverlayOpacity": "ショップオーバレイ不透明度", "shopCursorTarget": "ショップカーソル初位置", - "items": "アイテム", + "rewards": "ご褒美", "reroll": "選択肢変更", "shop": "ショップ", "checkTeam": "手持ちを確認" diff --git a/src/locales/ko/settings.json b/src/locales/ko/settings.json index b7fc01cb148..c10046385e1 100644 --- a/src/locales/ko/settings.json +++ b/src/locales/ko/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "터치 컨트롤 이동", "shopOverlayOpacity": "상점 오버레이 투명도", "shopCursorTarget": "상점 커서 위치", - "items": "아이템", + "rewards": "아이템", "reroll": "갱신", "shop": "상점", "checkTeam": "파티 확인" diff --git a/src/locales/pt_BR/settings.json b/src/locales/pt_BR/settings.json index 58ccb45f86d..74f3918bed8 100644 --- a/src/locales/pt_BR/settings.json +++ b/src/locales/pt_BR/settings.json @@ -100,7 +100,7 @@ "moveTouchControls": "Mover Controles de Toque", "shopOverlayOpacity": "Opacidade da Loja", "shopCursorTarget": "Alvo do Cursor da Loja", - "items": "Itens", + "rewards": "Itens", "reroll": "Atualizar", "shop": "Loja", "checkTeam": "Checar Time" diff --git a/src/locales/zh_CN/settings.json b/src/locales/zh_CN/settings.json index 3ae0fa8204c..dd001213b9e 100644 --- a/src/locales/zh_CN/settings.json +++ b/src/locales/zh_CN/settings.json @@ -99,7 +99,7 @@ "moveTouchControls": "移动触摸控制", "shopOverlayOpacity": "商店显示不透明度", "shopCursorTarget": "商店指针位置", - "items": "道具", + "rewards": "道具", "reroll": "刷新", "shop": "购买", "checkTeam": "检查队伍" diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 7b0fea95a98..6b46b6fe96c 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -25,6 +25,7 @@ const VOLUME_OPTIONS: SettingOption[] = new Array(11).fill(null).map((_, i) => i value: "Mute", label: getTranslation("settings:mute") }); + const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).map((_, i) => { const value = ((i + 1) * 10).toString(); return { @@ -32,6 +33,7 @@ const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).ma label: value, }; }); + const OFF_ON: SettingOption[] = [ { value: "Off", @@ -53,6 +55,40 @@ const AUTO_DISABLED: SettingOption[] = [ } ]; +const SHOP_CURSOR_TARGET_OPTIONS: SettingOption[] = [ + { + value: "Rewards", + label: i18next.t("settings:rewards") + }, + { + value: "Shop", + label: i18next.t("settings:shop") + }, + { + value: "Reroll", + label: i18next.t("settings:reroll") + }, + { + value: "Check Team", + label: i18next.t("settings:checkTeam") + } +]; + +const shopCursorTargetIndexMap = SHOP_CURSOR_TARGET_OPTIONS.map(option => { + switch (option.value) { + case "Rewards": + return ShopCursorTarget.REWARDS; + case "Shop": + return ShopCursorTarget.SHOP; + case "Reroll": + return ShopCursorTarget.REROLL; + case "Check Team": + return ShopCursorTarget.CHECK_TEAM; + default: + throw new Error(`Unknown value: ${option.value}`); + } +}); + /** * Types for helping separate settings to different menus */ @@ -103,7 +139,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", + Shop_Cursor_Target: "SHOP_CURSOR_TARGET", Candy_Upgrade_Notification: "CANDY_UPGRADE_NOTIFICATION", Candy_Upgrade_Display: "CANDY_UPGRADE_DISPLAY", Move_Info: "MOVE_INFO", @@ -596,27 +632,10 @@ export const Setting: Array = [ isHidden: () => !hasTouchscreen() }, { - key: SettingKeys.Reroll_Target, + key: SettingKeys.Shop_Cursor_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, + options: SHOP_CURSOR_TARGET_OPTIONS, + default: 0, type: SettingType.DISPLAY }, { @@ -758,8 +777,10 @@ 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.Shop_Cursor_Target: + const selectedValue = shopCursorTargetIndexMap[value]; + scene.shopCursorTarget = selectedValue; + break; case SettingKeys.EXP_Gains_Speed: scene.expGainsSpeed = value; break; diff --git a/src/test/items/dire_hit.test.ts b/src/test/items/dire_hit.test.ts index c43091d1f03..02f7c0d06a4 100644 --- a/src/test/items/dire_hit.test.ts +++ b/src/test/items/dire_hit.test.ts @@ -13,6 +13,7 @@ import { Button } from "#app/enums/buttons"; import { CommandPhase } from "#app/phases/command-phase"; import { NewBattlePhase } from "#app/phases/new-battle-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; +import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; describe("Items - Dire Hit", () => { let phaserGame: Phaser.Game; @@ -77,8 +78,8 @@ describe("Items - Dire Hit", () => { game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; // Traverse to first modifier slot - handler.processInput(Button.LEFT); - handler.processInput(Button.UP); + handler.setCursor(0); + handler.setRowCursor(ShopCursorTarget.REWARDS); handler.processInput(Button.ACTION); }, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(NewBattlePhase), true); diff --git a/src/test/items/temp_stat_stage_booster.test.ts b/src/test/items/temp_stat_stage_booster.test.ts index e5b95c6c3b6..c81703220db 100644 --- a/src/test/items/temp_stat_stage_booster.test.ts +++ b/src/test/items/temp_stat_stage_booster.test.ts @@ -16,6 +16,7 @@ import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { BattleEndPhase } from "#app/phases/battle-end-phase"; import { EnemyCommandPhase } from "#app/phases/enemy-command-phase"; +import { ShopCursorTarget } from "#app/enums/shop-cursor-target"; describe("Items - Temporary Stat Stage Boosters", () => { @@ -154,8 +155,8 @@ describe("Items - Temporary Stat Stage Boosters", () => { game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler; // Traverse to first modifier slot - handler.processInput(Button.LEFT); - handler.processInput(Button.UP); + handler.setCursor(0); + handler.setRowCursor(ShopCursorTarget.REWARDS); handler.processInput(Button.ACTION); }, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(NewBattlePhase), true); diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 6e9a33df5d8..ca5d27f96a4 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -257,6 +257,9 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { if (this.scene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) { this.setRowCursor(0); this.setCursor(2); + } else if ((this.scene.shopCursorTarget === ShopCursorTarget.SHOP) && this.scene.gameMode.hasNoShop) { + this.setRowCursor(ShopCursorTarget.REWARDS); + this.setCursor(0); } else { this.setRowCursor(this.scene.shopCursorTarget); this.setCursor(0);