health items

This commit is contained in:
Forrest 2026-09-29 12:07:31 -04:00
parent cb3513bd99
commit 62b2b9feca
17 changed files with 611 additions and 141 deletions

View file

@ -14,6 +14,7 @@ import {
defeat,
drawNow,
drawTask,
recallAvatar,
resolveDeclaration,
retireAvatar,
} from './flow.ts';
@ -154,6 +155,7 @@ function newAvatar(card: number, faceUp: boolean, copyOf: number | null): Avatar
faceUp,
at: null,
hardware: [],
damage: 0,
placed: false,
advanced: false,
attacks: 0,
@ -561,6 +563,7 @@ export function legalActions(s: GameState): Action[] {
if (av.at !== null && !canAct(s, ref)) return;
if (placementOpen && !av.placed && !waitsForRound(s, av)) {
for (const to of LOCATIONS) if (to !== av.at && hasRoom(s, p, to)) out.push({ type: 'place', slot: i + 1, to });
if (s.rules.health.on && s.rules.health.recall && av.at !== null && !isCopy(ref)) out.push({ type: 'recall', slot: i + 1 });
}
if (av.at !== null && !freshCopy(s, ref) && !commandSpent(s)) for (const to of targets) out.push({ type: 'advance', slot: i + 1, to });
});
@ -651,6 +654,8 @@ export function actionKey(a: Action): string {
case 'advance':
case 'attack':
return `${a.type}:${a.slot}:${a.to}`;
case 'recall':
return `recall:${a.slot}`;
case 'clearFirewall':
return `clear:${a.line}`;
case 'firewall':
@ -761,6 +766,9 @@ export function applyAction(s: GameState, a: Action, legal: Action[] = legalActi
av.placed = true;
break;
}
case 'recall':
recallAvatar(s, ref(a.slot));
break;
case 'advance':
case 'attack': {
const r = ref(a.slot);