Release v0.1.7 2026-07-12

This commit is contained in:
Warren H
2026-07-12 23:39:57 -04:00
parent 122f159b94
commit 77fd434226
31 changed files with 545 additions and 113 deletions
+23 -11
View File
@@ -2,7 +2,7 @@ import { useEffect, useRef } from "react";
import { subscribeControllerToken } from "../input/controller";
import { ABILITY_ORDER } from "./data";
import { isRunBuffInputLocked, useGameStore } from "./store";
import type { AbilityId } from "./types";
import { ABILITY_BY_CONTROLLER_BUTTON } from "./controllerBindings";
function cycleRunBuff(direction: 1 | -1) {
const store = useGameStore.getState();
@@ -12,15 +12,6 @@ function cycleRunBuff(direction: 1 | -1) {
store.setSelectedRunBuff(store.draftBuffIds[nextIndex]);
}
const gamepadAbilityMap: Record<number, AbilityId> = {
0: "purify",
1: "shield",
2: "mend",
3: "renew",
4: "radiance",
5: "barrier",
};
export function useActionBindings(enabled = true, onExit?: () => void) {
const exitRef = useRef(onExit);
exitRef.current = onExit;
@@ -53,6 +44,17 @@ export function useActionBindings(enabled = true, onExit?: () => void) {
if (key === "escape") exitRef.current?.();
return;
}
if (store.phase === "victory" && store.runMode === "rogue-trials" && store.round === 5 && !store.endlessMode) {
if (["arrowleft", "arrowup", "arrowright", "arrowdown", "enter"].includes(key)) event.preventDefault();
if (key === "arrowleft" || key === "arrowup") store.setEndlessChoiceSelection("continue");
if (key === "arrowright" || key === "arrowdown") store.setEndlessChoiceSelection("quit");
if (key === "enter") {
if (store.endlessChoiceSelection === "continue") store.startRogueTrialsEndless();
else exitRef.current?.();
}
if (key === "escape") exitRef.current?.();
return;
}
const numberIndex = Number(event.key) - 1;
if (numberIndex >= 0 && numberIndex < ABILITY_ORDER.length) {
store.castAbility(ABILITY_ORDER[numberIndex]);
@@ -110,9 +112,19 @@ export function useActionBindings(enabled = true, onExit?: () => void) {
if (!repeat && token === "Button1") exitRef.current?.();
return;
}
if (store.phase === "victory" && store.runMode === "rogue-trials" && store.round === 5 && !store.endlessMode) {
if (["Button12", "Button14", "Axis0-", "Axis1-"].includes(token)) store.setEndlessChoiceSelection("continue");
if (["Button13", "Button15", "Axis0+", "Axis1+"].includes(token)) store.setEndlessChoiceSelection("quit");
if (!repeat && token === "Button0") {
if (store.endlessChoiceSelection === "continue") store.startRogueTrialsEndless();
else exitRef.current?.();
}
if (!repeat && token === "Button1") exitRef.current?.();
return;
}
if (repeat) return;
if (token.startsWith("Button")) {
const ability = gamepadAbilityMap[Number(token.slice("Button".length))];
const ability = ABILITY_BY_CONTROLLER_BUTTON[Number(token.slice("Button".length))];
if (ability && store.phase === "combat") store.castAbility(ability);
}
if (token === "Button12") store.cycleMember(-1);