Release v0.1.5 2026-07-12
This commit is contained in:
+10
-3
@@ -6,7 +6,8 @@ import type { AbilityId } from "./types";
|
||||
|
||||
function cycleRunBuff(direction: 1 | -1) {
|
||||
const store = useGameStore.getState();
|
||||
const currentIndex = store.draftBuffIds.indexOf(store.selectedRunBuffId);
|
||||
if (store.draftBuffIds.length === 0) return;
|
||||
const currentIndex = store.selectedRunBuffId ? store.draftBuffIds.indexOf(store.selectedRunBuffId) : -1;
|
||||
const nextIndex = (Math.max(0, currentIndex) + direction + store.draftBuffIds.length) % store.draftBuffIds.length;
|
||||
store.setSelectedRunBuff(store.draftBuffIds[nextIndex]);
|
||||
}
|
||||
@@ -44,7 +45,10 @@ export function useActionBindings(enabled = true, onExit?: () => void) {
|
||||
if (["arrowleft", "arrowup", "arrowright", "arrowdown", "enter"].includes(key)) event.preventDefault();
|
||||
if (key === "arrowleft" || key === "arrowup") cycleRunBuff(-1);
|
||||
if (key === "arrowright" || key === "arrowdown") cycleRunBuff(1);
|
||||
if (key === "enter") store.chooseRunBuff(store.selectedRunBuffId);
|
||||
if (key === "enter") {
|
||||
if (store.selectedRunBuffId) store.chooseRunBuff(store.selectedRunBuffId);
|
||||
else store.continueRoguelikeRound();
|
||||
}
|
||||
if (key === "escape") exitRef.current?.();
|
||||
return;
|
||||
}
|
||||
@@ -97,7 +101,10 @@ export function useActionBindings(enabled = true, onExit?: () => void) {
|
||||
if (store.phase === "intermission") {
|
||||
if (["Button12", "Button14", "Axis0-", "Axis1-"].includes(token)) cycleRunBuff(-1);
|
||||
if (["Button13", "Button15", "Axis0+", "Axis1+"].includes(token)) cycleRunBuff(1);
|
||||
if (!repeat && token === "Button0") store.chooseRunBuff(store.selectedRunBuffId);
|
||||
if (!repeat && token === "Button0") {
|
||||
if (store.selectedRunBuffId) store.chooseRunBuff(store.selectedRunBuffId);
|
||||
else store.continueRoguelikeRound();
|
||||
}
|
||||
if (!repeat && token === "Button1") exitRef.current?.();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user