Rules v0.8: rounds of alternating commands; sim updates

Rules (rules.md, new file):
- Rounds of 2 commands per player in snake order (A B B A, then B A A B).
  A command is one advance or one attack; each Avatar acts once per round.
- Flat 4 RAM captures, first row Lv 1, A2-C2 and C2-E2 lines cut,
  45-card decks, Code Zero at 3 Cores with Patient Zero at 1+ counters.

Simulator:
- Command rule (default on): commands.perPlayer, commands.leads,
  commands.snake; commands.on=false restores whole turns.
- Greedy bot values Avatar unlocks (unlockPoints) and picks one action
  per command.
- Prototype switches, off by default: Avatars in the deck (recruit.*),
  buying Avatars (buyAvatars.*), copy limits (copies.*), turn-1 draw and
  second-player draw options.
- cards.csv card-text revisions, with scripts and tests to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-09-28 14:07:45 -04:00
parent 6382de19c9
commit a3eb6850ee
21 changed files with 1089 additions and 96 deletions

View file

@ -82,6 +82,18 @@ export function removeCopy(s: GameState, ref: AvatarRef): void {
dropFromCombat(s, ref);
}
/** Recruit rule: an Avatar recruited over leaves for the discard pile with its Hardware, and its copy leaves play. */
export function retireAvatar(s: GameState, ref: AvatarRef): void {
const av = avatar(s, ref);
removeCopy(s, copyOf(ref));
if (av.hardware.length) stat(s, 'hardwareLost', ref.player, av.hardware.length);
for (const hw of av.hardware) toDiscard(s, hw);
say(s, `${playerName(ref.player)} retires ${avatarName(s, ref)}${av.at ? ` from ${av.at}` : ''}.`);
dropFromCombat(s, ref);
toDiscard(s, av.card);
stat(s, 'avatarsRetired', ref.player);
}
/**
* The loser of a combat goes back to its slot. Its Hardware is discarded unless `keepHardware`,
* and its counters and effects are removed (Persistent Infection's counters stay).
@ -125,6 +137,7 @@ export function createCopy(s: GameState, original: AvatarRef, to: LocId): void {
disabledUntil: 0,
rootedUntil: 0,
breachedTurn: 0,
createdTurn: s.turn,
} satisfies Partial<AvatarState>);
say(s, `${playerName(ref.player)} creates ${avatarName(s, ref)} on ${to}.`);
}
@ -382,11 +395,13 @@ export function captureMain(s: GameState, ref: AvatarRef, loc: LocId, how: Captu
const from = previous === null ? '' : ` from ${playerName(previous)}`;
say(s, `${playerName(p)} captures ${loc}${from} (Lv ${level}) with ${L.server === null ? 'no Server' : nameOf(s, L.server)}: +${ram} RAM (now ${me.ram}).`);
if (level > me.unlockedLevel && turn1?.unlock !== false) {
const unlocks = !s.rules.recruit.on && !s.rules.buyAvatars.on;
if (unlocks && level > me.unlockedLevel && turn1?.unlock !== false) {
me.unlockedLevel = level;
me.avatars.slice(0, 4).forEach((av, i) => {
if (i < level && !av.faceUp) {
av.faceUp = true;
av.unlockedTurn = s.turn;
say(s, `${playerName(p)} unlocks Avatar ${i + 1}: ${nameOf(s, av.card)}.`);
}
});