Move items with Select and browse the party's moves

In the start menu's pack, Select marks an item and asks where it should
go; A or Select on another row moves it there, merging stacks of the
same item unless either holds 99, and B ends the move. The packs that
GIVE and the PC open ignore Select, as in the original.

Left and right on the MOVE screen show the previous or next party
member's moves, skipping Eggs, unless a move is being moved.

Part of #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-03 00:56:51 +02:00
1 parent 397dcef44c
commit e2dc5ba520
9 files changed
+362 -34

No files matched your search

+30 -6
View File
@@ -258,7 +258,14 @@ export type Choice =
/** The naming screen: an empty answer keeps `current`. */
| { kind: "name"; current: string; max: number; selected?: undefined }
/** A vertical menu; `selected` answers with that item's index. */
| { kind: "menu"; items: string[]; details?: string[]; selected: number }
| {
kind: "menu";
items: string[];
details?: string[];
selected: number;
/** Left and right answer "left" or "right". */
sides?: boolean;
}
/** The mart's BUY/SELL/QUIT box. */
| { kind: "martmenu"; prompt: string; selected: number }
/** The mart's item list; `selected` answers with that entry's index. */
@@ -268,12 +275,15 @@ export type Choice =
entries: MartEntry[];
selected: number;
}
/** The pack's pockets; `selected` is an entry of pocket `pocket`. */
/** The pack's pockets; `selected` is an entry of pocket `pocket`, and
* `switching` the one being moved with Select. */
| {
kind: "pack";
pockets: { name: string; entries: MartEntry[] }[];
pocket: number;
selected: number;
switching?: number;
prompt?: string;
}
/** A Pokégear card, answered with the button pressed. */
| { kind: "pokegear"; view: PokegearView; selected: 0 }
@@ -2134,6 +2144,10 @@ export class GameWorld {
this.choose("select");
return true;
}
if (this.dialogue?.choice?.kind === "pack") {
this.choosePackEntry(undefined, undefined, true);
return true;
}
return this.openStartMenu(true);
}
/** Start in PlayerEvents (StartMenuScript): the start menu opens while
@@ -2554,6 +2568,7 @@ export class GameWorld {
items: effect.items,
...(effect.details && { details: effect.details }),
selected: effect.selected,
...(effect.sides && { sides: true }),
},
};
return true;
@@ -2615,6 +2630,10 @@ export class GameWorld {
pockets: effect.pockets,
pocket: effect.pocket,
selected: effect.selected,
...(effect.switching !== undefined && {
switching: effect.switching,
prompt: effect.prompt,
}),
},
};
return true;
@@ -4005,6 +4024,8 @@ export class GameWorld {
if (direction === "up") choice.selected = (choice.selected + 2) % 3;
if (direction === "down") choice.selected = (choice.selected + 1) % 3;
} else if (choice.kind === "menu") {
if ((direction === "left" || direction === "right") && choice.sides)
return this.choose(direction);
if (direction === "up")
choice.selected = Math.max(0, choice.selected - 1);
if (direction === "down")
@@ -4018,9 +4039,11 @@ export class GameWorld {
if (direction === "down")
choice.selected = (choice.selected + length - 1) % length;
} else if (choice.kind === "pack") {
// Pack_InterpretJoypad: left and right change pockets.
// Pack_InterpretJoypad: left and right change pockets, except while
// an item is being moved (.switching_item).
const pockets = choice.pockets.length;
if (direction === "left" || direction === "right") {
if (choice.switching !== undefined) return;
choice.pocket =
(choice.pocket + (direction === "left" ? pockets - 1 : 1)) % pockets;
choice.selected = 0;
@@ -4054,14 +4077,15 @@ export class GameWorld {
} else if (direction === "up") choice.selected = (choice.selected + 1) % 7;
else if (direction === "down") choice.selected = (choice.selected + 6) % 7;
}
/** Choose the highlighted pack entry, if its pocket has one. */
choosePackEntry(pocket?: number, index?: number) {
/** Choose the highlighted pack entry, if its pocket has one, with A or
* (`select`) with the Select button. */
choosePackEntry(pocket?: number, index?: number, select = false) {
const choice = this.dialogue?.choice;
if (choice?.kind !== "pack") return;
pocket ??= choice.pocket;
index ??= choice.selected;
if (!choice.pockets[pocket]?.entries[index]) return;
this.choose(pocket * 256 + index);
this.choose(select ? `select:${pocket * 256 + index}` : pocket * 256 + index);
}
/** Answer the current choice: 1/0 for yes/no, a weekday index, or a
* name ("" keeps the current one). */