Skip to content

Commit

Permalink
[UI/UX] Add cursor memory option (#5028)
Browse files Browse the repository at this point in the history
* Adding a new key determining whether the command cursor resets at the beginning of each new battle.

* Allowing user to toggle commandCursorReset on and off.

* Changing option name to commandCursorMemory

* Fixed caps in settings.ts

* Moved Command_Cursor_Memory from Display settings to General settings
  • Loading branch information
Wlowscha authored Dec 30, 2024
1 parent 8f884a7 commit 6946aba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default class BattleScene extends SceneBase {
public damageNumbersMode: integer = 0;
public reroll: boolean = false;
public shopCursorTarget: number = ShopCursorTarget.REWARDS;
public commandCursorMemory: boolean = false;
public showMovesetFlyout: boolean = true;
public showArenaFlyout: boolean = true;
public showTimeOfDayWidget: boolean = true;
Expand Down
8 changes: 7 additions & 1 deletion src/phases/command-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ export class CommandPhase extends FieldPhase {
this.scene.updateGameInfo();

const commandUiHandler = this.scene.ui.handlers[Mode.COMMAND];

// If one of these conditions is true, we always reset the cursor to Command.FIGHT
const cursorResetEvent = this.scene.currentBattle.battleType === BattleType.MYSTERY_ENCOUNTER ||
this.scene.currentBattle.battleType === BattleType.TRAINER ||
this.scene.arena.biomeType === Biome.END;

if (commandUiHandler) {
if (this.scene.currentBattle.turn === 1 || commandUiHandler.getCursor() === Command.POKEMON) {
if ((this.scene.currentBattle.turn === 1 && (!this.scene.commandCursorMemory || cursorResetEvent)) || commandUiHandler.getCursor() === Command.POKEMON) {
commandUiHandler.setCursor(Command.FIGHT);
} else {
commandUiHandler.setCursor(commandUiHandler.getCursor());
Expand Down
11 changes: 11 additions & 0 deletions src/system/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const SettingKeys = {
Move_Animations: "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up: "SHOW_LEVEL_UP_STATS",
Shop_Cursor_Target: "SHOP_CURSOR_TARGET",
Command_Cursor_Memory: "COMMAND_CURSOR_MEMORY",
Candy_Upgrade_Notification: "CANDY_UPGRADE_NOTIFICATION",
Candy_Upgrade_Display: "CANDY_UPGRADE_DISPLAY",
Move_Info: "MOVE_INFO",
Expand Down Expand Up @@ -339,6 +340,13 @@ export const Setting: Array<Setting> = [
default: 0,
type: SettingType.GENERAL
},
{
key: SettingKeys.Command_Cursor_Memory,
label: i18next.t("settings:commandCursorMemory"),
options: OFF_ON,
default: 0,
type: SettingType.GENERAL
},
{
key: SettingKeys.Enable_Retries,
label: i18next.t("settings:enableRetries"),
Expand Down Expand Up @@ -827,6 +835,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
const selectedValue = shopCursorTargetIndexMap[value];
scene.shopCursorTarget = selectedValue;
break;
case SettingKeys.Command_Cursor_Memory:
scene.commandCursorMemory = Setting[index].options[value].value === "On";
break;
case SettingKeys.EXP_Gains_Speed:
scene.expGainsSpeed = value;
break;
Expand Down

0 comments on commit 6946aba

Please sign in to comment.