diff --git a/QUICKSTART.md b/QUICKSTART.md index 0fa3be2..358216e 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -26,7 +26,7 @@ You'll also need the **playmat**, which has 13 locations plus the two starting S | Card | What it is | Where it goes | When you play it | |---|---|---|---| -| **Avatar** | Your units. **Cores** = dice in combat. **Expansion Slots** = how much Hardware it can hold. Its **Ability** can be used once per round by paying its RAM cost. | Your Avatar slots, then onto locations you control | Free, at the start of your command | +| **Avatar** | Your units. **Cores** = dice in combat. **Health** = damage it takes to destroy it. **Expansion Slots** = how much Hardware it can hold. Its **Ability** can be used once per round by paying its RAM cost. | Your Avatar slots, then onto locations you control | Free, at the start of your command | | **Server** | The locations you capture. Each has an ability that helps whoever holds it. | Onto a location when you capture it | Automatically | | **Program** | Buffs and traps for a location | A location you control, 2 at most | During your command | | **Hardware** | Upgrades for an Avatar | An Avatar in play, up to its Expansion Slots | During your command | @@ -42,7 +42,7 @@ Every card except Avatars and Servers costs the **RAM** printed on it. reveal it when the game starts. 3. Shuffle your deck and draw **7 cards**. 4. Start with **4 RAM**. -5. Pick a first player at random. They **skip their draw in round 1**. +5. Pick a first player at random. They lead every round. ## The Board @@ -81,12 +81,11 @@ More Avatars means more actions each round, so pushing forward early matters. ## How a Round Works -Each round, each player gets **2 commands**, and the order snakes: +Each round, each player gets **2 commands**, and the order snakes the same way every round: | Round | Commands | |---|---| -| 1, 3, 5… | P1, P2, P2, P1 | -| 2, 4, 6… | P2, P1, P1, P2 | +| every round | P1, P2, P2, P1 | **At your first command of each round:** draw a card, then **refresh** your Avatars so they can act again. @@ -94,8 +93,9 @@ act again. **Each command has five steps:** 1. **Place and advance.** Put any of your face-up Avatars on any locations you control, for free. - Then you may **advance** one Avatar into an **empty or undefended** location next to your - territory. + A damaged Avatar can instead be **recalled** to its slot to heal (it keeps its Hardware, but + that's its placement for the round). Then you may **advance** one Avatar into an **empty or + undefended** location next to your territory. 2. **Play cards** from your hand. 3. **Attack.** If you didn't advance, one Avatar may attack a **defended** enemy location next to the location it's standing on. @@ -121,17 +121,21 @@ enemy's, their Server goes to the bottom of their pile and their Programs there 1. Each side rolls **1d6 per Core**. Count the Avatar, its Hardware, Programs, effects, and the Server it's on. -2. **The higher total wins.** On a tie, both sides reroll. -3. **The loser** goes back to its Avatar slot and discards its Hardware. -4. **A winning attacker** captures the location. +2. **The higher total wins the roll.** The loser takes **damage equal to the difference**. On a tie, + nothing happens. +3. Damage stays on an Avatar. When it reaches its **Health**, the Avatar is **destroyed**: it goes + back to its Avatar slot at full Health and discards its Hardware. +4. **The location falls** only when its last defender is destroyed. Then the attacker moves in and + captures it. Otherwise everyone stays where they are, so a defended location usually takes two + or three attacks to take. Starting Servers can never be attacked. -| Your Cores vs theirs | You win about | -|---|---| -| Even | 50% | -| +1 Core | 75–90% | -| +2 Cores | 90–99% | +| Your Cores vs theirs | You win the roll about | Average damage when you win | +|---|---|---| +| Even | 45% (a tie about 9%) | 3–5 | +| +1 Core | 75–90% | 5–8 | +| +2 Cores | 90–99% | 7–11 | ## RAM diff --git a/decks/files-deck-1/avatar-front.css b/decks/files-deck-1/avatar-front.css index a9ffcdb..02e461a 100644 --- a/decks/files-deck-1/avatar-front.css +++ b/decks/files-deck-1/avatar-front.css @@ -189,7 +189,7 @@ position: absolute; z-index: 5; right: 22px; - top: 214px; + top: 322px; writing-mode: vertical-rl; font-size: 15px; font-weight: 700; @@ -332,3 +332,60 @@ margin-top: 2px; color: var(--accent); } + +/* ----- Health badge (damage to destroy) — same chassis as PORTS, with a pulse line ----- */ +.health { + position: absolute; + z-index: 5; + top: 204px; + right: 30px; + width: 96px; + height: 96px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + clip-path: polygon(14% 0, 100% 0, 100% 86%, 86% 100%, 0 100%, 0 14%); + background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dk) 100%); + box-shadow: 0 0 16px var(--accent); +} +.health::before { + content: ""; + position: absolute; + inset: 3px; + clip-path: polygon(14% 0, 100% 0, 100% 86%, 86% 100%, 0 100%, 0 14%); + background: linear-gradient(160deg, #12181f 0%, #0a0e13 100%); +} +/* heartbeat trace above the number */ +.health .pulse { + position: relative; + z-index: 1; + width: 56px; + height: 16px; + margin-bottom: 2px; + background: var(--accent); + filter: drop-shadow(0 0 6px var(--accent)); + clip-path: polygon( + 0 46%, 24% 46%, 32% 12%, 44% 88%, 54% 0, 62% 62%, 68% 46%, 100% 46%, + 100% 62%, 66% 62%, 58% 90%, 52% 30%, 44% 100%, 32% 40%, 26% 62%, 0 62% + ); +} +.health b { + position: relative; + z-index: 1; + font-size: 40px; + font-weight: 800; + line-height: 1; + color: #fff; + text-shadow: 0 0 10px var(--accent), 0 2px 3px #000; +} +.health i { + position: relative; + z-index: 1; + font-style: normal; + font-size: 15px; + font-weight: 800; + letter-spacing: 3px; + margin-top: 2px; + color: var(--accent); +} diff --git a/decks/files-deck-1/avatar-front.html b/decks/files-deck-1/avatar-front.html index f03f310..94021b8 100644 --- a/decks/files-deck-1/avatar-front.html +++ b/decks/files-deck-1/avatar-front.html @@ -1,10 +1,11 @@ +
+ + {{card.health}} + HEALTH +
+
FILES-TCG · SD01
{{#if (eq card.type "V")}}VIRUS{{/if}}{{#if (eq card.type "B")}}BUG{{/if}}{{#if (eq card.type "G")}}GLITCH{{/if}}{{#if (eq card.type "P")}}PATCH{{/if}}-CLASS UNIT
diff --git a/expansion-plan.md b/expansion-plan.md index f6cf55c..7d463dd 100644 --- a/expansion-plan.md +++ b/expansion-plan.md @@ -131,6 +131,10 @@ are all within 5.4 to 5.7, so no type is currently priced as premium. Keep it th The combat table in `rules.md` is the key balance constraint: a 1-Core edge is roughly 75 to 90%, a 2-Core edge 90 to 99%. Any card that swings 2 Cores in one combat is close to "win this fight". Price those like Executions at 6 to 7, or attach a real drawback, and avoid making them stack. +Since rules v0.9 (Health), winning the roll deals the margin as damage rather than deciding the +fight, so a 2-Core swing is about 3.5 damage more or less, and dice tricks that change one die +(reroll, swap, ±1) shift damage by a few points instead of flipping the result. That softens the +"win this fight" cards, but +Core Hardware now also raises the damage, so big stacks still one-shot. ## 5. Simulator Balance Data diff --git a/rules.md b/rules.md index 3c7f5a0..e7c372e 100644 --- a/rules.md +++ b/rules.md @@ -1,7 +1,10 @@ # Files TCG Rules -*Draft v0.8 — 2026-09-28.* The basic game rules are complete. v0.8 replaces whole turns with -[rounds of alternating commands](#rounds-and-commands). Card text and stats come from +*Draft v0.9 — 2026-09-29.* The basic game rules are complete. v0.9 gives Avatars +[Health](#combat): the roll is unchanged, but the loser takes the difference as damage instead of +being knocked out, and a location falls only when its last defender is destroyed. To keep the seats +even under Health, the first player now leads every round and draws in round 1. v0.8 replaced +whole turns with [rounds of alternating commands](#rounds-and-commands). Card text and stats come from `decks/files-deck-1/cards.csv` (`cards.md` is out of date). [Card Rules](#card-rules) says how card text is read; readings marked ⚠ are the simulator's guesses and are listed in [Open Questions](#open-questions). @@ -32,8 +35,8 @@ A deck can hold at most **2 copies** of any one card. 6. Start with **4 RAM**. This is the capture payout for your starting Server, not an extra 4. 7. Flip Avatar 1 face up. It is available from the start. -The first player is chosen at random. They take the first command of round 1 and skip their draw in -round 1. +The first player is chosen at random. They take the first command of every round, and both players +draw at their first command of round 1. ## The Playmat @@ -114,15 +117,15 @@ the location. An Avatar unlocked during a round can enter play from the next rou ## Rounds and Commands The game is played in **rounds**. In each round, each player gets **2 commands**, taken one at a -time in a snake order: +time in a snake order, the same every round: | Round | Order of commands | |---|---| -| 1, 3, 5… | first player, second player, second player, first player | -| 2, 4, 6… | second player, first player, first player, second player | +| every round | first player, second player, second player, first player | -Each player gets one pair of back-to-back commands per round, and the pair swaps sides every round. -Nobody acts twice in a row across the end of a round. +Each player gets one pair of back-to-back commands: the second player's pair sits in the middle of +a round, the first player's spans the end of one round and the start of the next. The first player +draws and refreshes between those two commands, since the second one starts a new round. **Your first command of a round** starts with: @@ -136,6 +139,10 @@ Nobody acts twice in a row across the end of a round. - First, place any of your face-up Avatars onto locations you control. This includes Avatars entering play from a slot and Avatars repositioning. Placement is free and doesn't count as a move. Each Avatar can be placed once per round. + - **Recall:** instead of placing an Avatar that's on the board, you may return it to its slot. + It heals to full Health and keeps its Hardware, but the recall counts as its placement for the + round, and the location it left is now undefended. An Avatar that can't move (Packet Flood, + Emergency Shutdown) can't be recalled. - Then you may **advance** one Avatar: move it to an unowned location, or an undefended enemy location, that is adjacent to any location you control. - Each location holds 1 of your Avatars. Cluster Server and Pingable Server raise this to 2. @@ -169,20 +176,32 @@ Card text is written for turns. With commands it reads like this: - **Undefended enemy location:** your Avatar moves in. The enemy puts their Server card on the bottom of their pile, and Programs there go to their discard pile. Then place your own Server and gain RAM, as above. -- **Defended enemy location:** combat. If you win, capture it as an undefended location. If you - lose, the location isn't captured. +- **Defended enemy location:** combat. If the combat destroys every defender there, capture it as + an undefended location. Otherwise the location holds and your Avatar stays where it attacked from. - **Starting Servers** can't be attacked or captured. ## Combat +Every Avatar has printed **Health**. Damage stays on an Avatar for as long as it's on the board, so +a defended location usually takes more than one attack to fall. Track damage with counters or a +dial on the card. + 1. Both players roll 1d6 per Core, counting Cores from the Avatar, Hardware, Programs, effects, and the Server each Avatar is on: the attacker's origin, and the location being defended. Each side always rolls at least 1 die. -2. The higher total wins. **On a tie, both sides reroll all their dice** until one wins. -3. The **loser** returns to its Avatar slot, face up. Its Hardware goes to its owner's discard pile - and all counters and effects on it are removed, debuffs included. It can be placed again from its - owner's next command, if it hasn't been placed yet this round. -4. The **winner** keeps everything. A winning attacker moves into the captured location. +2. The higher total wins the roll. **The loser takes damage equal to the difference.** The winner + takes none. **On a tie, nothing happens:** no reroll and no damage. The combat is over. +3. If several Avatars defend, the attacker splits the damage among them as it likes. +4. An Avatar whose damage reaches its Health is **destroyed**. It returns to its Avatar slot, face + up, at full Health. Its Hardware goes to its owner's discard pile and all counters and effects on + it are removed, debuffs included. It can be placed again from its owner's next command, if it + hasn't been placed yet this round. +5. Nobody else moves. A losing attacker stays where it attacked from, carrying its damage. A winning + attacker moves into the location only if every defender was destroyed, and captures it. + +An Avatar only heals by leaving the board: by being destroyed, or by a **recall** in the Deploy +step (which keeps its Hardware). No card heals an Avatar in place yet; that's design space for Patch +cards, and for Hardware that adds Health. ## RAM @@ -254,19 +273,24 @@ Avatars (such as Trace Route and Disconnect). stand on your locations. - **"A combat at this Server"** on an Avatar Ability means any combat that Avatar is fighting in, attacking or defending. -- **Destroyed / defeated** (Avatars) means losing a combat. A Program or Hardware is destroyed when an +- **Health / damage:** an Avatar's Health is printed on it. Damage is marked on the Avatar and + stays while it's on the board. Copies have the original's Health and their own damage. +- **Destroyed / defeated** (Avatars) means its damage reached its Health, so it left the board. + Losing a roll without being destroyed is not a defeat. A Program or Hardware is destroyed when an effect sends it to the discard pile (Overflow Error, Sabotage). Programs on a captured location are discarded, not destroyed. +- **Leaving the board** (destroyed or recalled) removes an Avatar's damage, counters and temporary + effects. Persistent Infection's counters stay. A recalled Avatar keeps its Hardware. ⚠ - **Breach:** capture an enemy-owned location, by advancing into it or winning an attack on it. - **Disabled Hardware or Program:** its effect stops. With no duration on the card, it stays disabled until something re-enables it (Execute: Defragment) or it leaves play. - **Disabled Avatar** (Emergency Shutdown): can't advance, attack, move or use its Ability. It still defends. ⚠ -- **Infection counters** come off when the Avatar is defeated, except the ones Persistent Infection - places. Code Zero (1+ counters: −1 Core) and Recursive Infection (3+: −2 Cores) apply everywhere +- **Infection counters** come off when the Avatar leaves the board, except the ones Persistent + Infection places. Code Zero (1+ counters: −1 Core) and Recursive Infection (3+: −2 Cores) apply everywhere while the card is in play, once each no matter how many copies are in play. -- **Bug counters** work like Infection counters, for Bug cards. They come off when the Avatar is - defeated, and Error Correction can remove one. No card places them yet; that needs new cards. +- **Bug counters** work like Infection counters, for Bug cards. They come off when the Avatar leaves + the board, and Error Correction can remove one. No card places them yet; that needs new cards. ECC Memory stops opponents from placing them. Purge removes only Virus/Infection counters. - **Temporary bonuses and penalties** are Core changes from Abilities, Executions and Program triggers that last one combat or one turn: Memory Leak, Visual Artifact, Race Condition, Low @@ -286,7 +310,7 @@ Avatars (such as Trace Route and Disconnect). - **Protected** (Execute: Root Access) means the Program Hardware Sandbox protects. No card protects Hardware yet. - **Two defenders** (Cluster Server, Pingable Server): both roll together as one side. If they lose, - both are defeated. + the attacker splits the damage between them. The location falls only when both are destroyed. ⚠ - **Cores that change after the roll** change the dice: each Core gained rolls one more die, and each Core lost removes one of that Avatar's rolled dice, the one showing the highest number. - **Once per turn** means once per round, counting uses in both players' commands (see @@ -333,7 +357,7 @@ Cards not listed here work exactly as printed. | RAM Expansion | +2 Cores. | | Overclocked CPU | After each combat, one of your Programs on the location it fought from is disabled through the end of the next turn. ⚠ | | Solid-State Cache | −3 RAM for the first Program you install each turn on the location the wearer stands on. | -| Redundant Power Supply | The first time the wearer is defeated, all its Hardware stays on it, in its slot. ⚠ | +| Redundant Power Supply | The first time the wearer is destroyed, all its Hardware stays on it, in its slot. ⚠ | | Network Interface Upgrade | Takes no port and adds one, so the wearer nets +1 Expansion Slot. The card text should say so. If it leaves (Sabotage, Rollback), the wearer discards Hardware until it fits, newest first. ⚠ | | Dedicated GPU | +1 to the number an Execution uses (cards drawn, Cores, RAM) when the Server the wearer stands on performs it. | | ECC Memory | Opponents can't give the wearer Bug counters. "Bug status effects" are opponents' Bug Program effects on it (Memory Leak, Stock Rice). ⚠ | @@ -367,7 +391,16 @@ Cards not listed here work exactly as printed. ## Open Questions -None for the basic game. For the cards: +For the basic game (v0.9 Health): + +1. **Health values** are a first guess: 4-Core Avatars 9, 3-Core 10, 2-Core 12, so the heavy hitters + are glass cannons and the 2-Core body can hold a location while its Hardware comes online. +2. **Recall** clears counters and effects, like a defeat does. That makes it a slow Purge. Intended? ⚠ +3. **Split damage** with two defenders is the attacker's choice. ⚠ +4. **RAM Expansion** says "+2 Core capacity". It's read as +2 Cores; with Health in the game it could + become +2 Health instead, which would also fix it dominating Additional Core. + +For the cards: 1. **Bug counters** need cards that place them, and cards that punish having them (like Code Zero and Recursive Infection do for Infection). @@ -391,23 +424,38 @@ Things the first sim runs should measure: - **Game length.** Deck is 45 cards, 7 of them in the opening hand, so 38 draws. Do games end before decks run out? - **First-player advantage.** With whole turns the first player won about 70% of sim games (with - bots that rush Avatar unlocks). Rounds of alternating commands in the snake order bring it to about - 50%. A plain alternating lead gave 49%, the first player always leading 51%. + bots that rush Avatar unlocks). Rounds of alternating commands in the snake order brought it to + about 50%. A plain alternating lead gave 49%, the first player always leading 51%. Under Health + (v0.9) the alternating lead fell to 48%, so the lead is fixed on the first player again and they + draw in round 1: 51% over 9,000 games (fixed lead alone 50%, fixed lead without snake 53.5%). - **Game length.** Commands make games longer: a median of 13 rounds (26 commands each), 90% within 35 rounds. +- **Health (v0.9).** 1,000 greedy-vs-greedy games, printed Health against one-roll combats: median + 14 rounds (13 before), 24.5 combats a game (27), 4.9 combat captures per player (9.3), 6.4 Avatars + destroyed per player (13), 34% of enemy locations taken were won in combat (41%). First player + 47% (49%). The bot attacks with big Core edges, so its winning margin averages about 10 and + roughly two thirds of its winning rolls destroy the defender outright; the rest take a second + attack. Bots recall under once a game. Every Avatar at Health 8: median 13 rounds, 40% of enemy + captures by combat; at 12: median 14, 30%. Attacking at 50%+ odds instead of 60%+ makes no + difference (48% vs 51%). ## Appendix: Combat Odds -Exact chance that the attacker wins, by Core count, with ties rerolled. Rows are the attacker's -Cores, columns the defender's. +For each matchup, three exact numbers: the chance the attacker **wins the roll**, the **average +damage** a win deals (the margin), and the chance one roll deals **10 or more**, enough to destroy a +10-Health Avatar outright. Rows are the attacker's Cores, columns the defender's. Ties are neither a +win nor a loss: 1 vs 1 ties 17% of the time, 3 vs 3 9%, 6 vs 6 7%. -| Atk \ Def | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -|---|---|---|---|---|---|---|---|---| -| **1** | 50% | 10% | 1% | 0% | 0% | 0% | 0% | 0% | -| **2** | 90% | 50% | 16% | 4% | 1% | 0% | 0% | 0% | -| **3** | 99% | 84% | 50% | 21% | 6% | 2% | 0% | 0% | -| **4** | 100% | 96% | 79% | 50% | 23% | 9% | 3% | 1% | -| **5** | 100% | 99% | 94% | 77% | 50% | 26% | 11% | 4% | -| **6** | 100% | 100% | 98% | 91% | 74% | 50% | 28% | 13% | -| **7** | 100% | 100% | 100% | 97% | 89% | 72% | 50% | 29% | -| **8** | 100% | 100% | 100% | 99% | 96% | 87% | 71% | 50% | +| Atk \ Def | 1 | 2 | 3 | 4 | 5 | 6 | +|---|---|---|---|---|---|---| +| **1** | 42% · 2.3 · 0% | 9% · 1.8 · 0% | 1% · 1.4 · 0% | 0% · 1.2 · 0% | 0% · 1.0 · 0% | 0% · — · 0% | +| **2** | 84% · 4.4 · 2% | 44% · 3.1 · 0% | 15% · 2.4 · 0% | 4% · 2.0 · 0% | 1% · 1.8 · 0% | 0% · 1.6 · 0% | +| **3** | 97% · 7.2 · 24% | 78% · 5.0 · 6% | 45% · 3.7 · 1% | 19% · 3.0 · 0% | 6% · 2.5 · 0% | 1% · 2.2 · 0% | +| **4** | 100% · 10.5 · 60% | 94% · 7.5 · 28% | 74% · 5.5 · 9% | 46% · 4.2 · 2% | 22% · 3.4 · 0% | 8% · 2.9 · 0% | +| **5** | 100% · 14.0 · 86% | 99% · 10.6 · 59% | 91% · 7.9 · 31% | 72% · 5.9 · 12% | 46% · 4.7 · 4% | 24% · 3.8 · 1% | +| **6** | 100% · 17.5 · 96% | 100% · 14.0 · 82% | 98% · 10.8 · 58% | 88% · 8.2 · 32% | 70% · 6.3 · 15% | 47% · 5.1 · 5% | +| **7** | 100% · 21.0 · 99% | 100% · 17.5 · 94% | 99% · 14.1 · 80% | 96% · 11.0 · 57% | 86% · 8.5 · 34% | 69% · 6.7 · 17% | +| **8** | 100% · 24.5 · 100% | 100% · 21.0 · 98% | 100% · 17.5 · 92% | 99% · 14.2 · 77% | 95% · 11.2 · 56% | 84% · 8.8 · 35% | + +The old one-roll rule (ties rerolled) gives the same win chances with the ties shared out, so a +1-Core edge is still roughly 75 to 90% and a 2-Core edge 90 to 99%. diff --git a/sim/README.md b/sim/README.md index b33e10a..7f14a7a 100644 --- a/sim/README.md +++ b/sim/README.md @@ -27,13 +27,14 @@ of how much a card helps. ## What's simulated - **Rules:** everything in `rules.md`: setup, rounds of alternating commands (or whole turns, with - `--rule commands.on=false`), placement and advancing, attacks, - combat with tie rerolls, captures, levels and RAM, Avatar unlocks, Firewalls, Salvage, response - windows and chains, and the win condition. + `--rule commands.on=false`), placement, recall and advancing, attacks, combat with Health and + damage (or one-roll combats with tie rerolls, with `--rule health.on=false`; `health.override=8` + gives every Avatar the same Health), captures, levels and RAM, Avatar unlocks, Firewalls, + Salvage, response windows and chains, and the win condition. - **Every card:** all 83 cards in `../decks/files-deck-1/cards.csv` have a script, including Avatar Abilities. Unclear card text follows the readings in `rules.md` → Card Rules; the ones marked ⚠ are guesses waiting for a decision. -- **Card edits:** stats (RAM, Cores, slots) come straight from the CSV. Each script records the text +- **Card edits:** stats (RAM, Cores, Health, slots) come straight from the CSV. Each script records the text it was written for, so if you reword a card the sim warns you, and `npm test` fails until the script is updated. diff --git a/sim/src/rules.ts b/sim/src/rules.ts index 182f468..30d0b9b 100644 --- a/sim/src/rules.ts +++ b/sim/src/rules.ts @@ -19,7 +19,7 @@ export interface RulesConfig { deck: { avatars: number; servers: number; main: number; maxCopies: number }; /** Avatars face up at the start (rules: Avatar 1 only). */ startingAvatars: number; - /** What the first player may do on turn 1 (the rules skip the draw and allow the rest). */ + /** What the first player may do on turn 1 (the rules since v0.9 allow all of it; v0.8 skipped the draw). */ firstTurn: { draw: boolean; advance: boolean; @@ -90,12 +90,12 @@ export const DEFAULT_RULES: RulesConfig = { maxProgramsPerLocation: 2, deck: { avatars: 4, servers: 20, main: 45, maxCopies: 2 }, startingAvatars: 1, - firstTurn: { draw: false, advance: true, captureRam: true, unlock: true, cards: true }, + firstTurn: { draw: true, advance: true, captureRam: true, unlock: true, cards: true }, secondPlayer: { ram: 0, avatars: 0, cards: 0, firstDraw: 0, locations: 0 }, recruit: { on: false, avatarsInDeck: 3, price: 6, pricePerCore: 0 }, buyAvatars: { on: false, prices: [8, 12, 16] }, copies: { allowed: true, waitATurn: false, needAvatar2: false }, - commands: { on: true, perPlayer: 2, leads: 'FS', snake: true }, + commands: { on: true, perPlayer: 2, leads: 'F', snake: true }, health: { on: true, override: 0, recall: true }, }; diff --git a/sim/test/engine.test.ts b/sim/test/engine.test.ts index c6fc5d5..1d6eb34 100644 --- a/sim/test/engine.test.ts +++ b/sim/test/engine.test.ts @@ -29,21 +29,21 @@ test('setup follows rules.md', () => { assert.deepEqual(checkInvariants(s), []); }); -test('the first player skips the draw; the second player draws', () => { +test('both players draw on their first turn (since v0.9); firstTurn.draw=false makes the first player skip it', () => { + // The test table pins the old skip, so card tests start from a known hand. const t = new Table({ south: { main: ['Additional Core'] }, north: { main: ['Additional Core'] } }); assert.equal(t.s.players[0].hand.length, 0); t.to('playAgain').end(); assert.equal(t.s.active, 1); assert.equal(t.s.players[1].hand.length, 1); -}); -test('rule variants: the first player draws on turn 1', () => { const pool = loadCards(); const hand = (rules: RulesConfig) => { const s = createGame({ pool, decks: [randomDeck(pool, makeRng(1), rules), randomDeck(pool, makeRng(2), rules)], seed: 5, rules }); return s.players[s.firstPlayer].hand.length; }; - assert.equal(hand(withRule(DEFAULT_RULES, 'firstTurn.draw=true')), hand(DEFAULT_RULES) + 1); + assert.equal(DEFAULT_RULES.firstTurn.draw, true); + assert.equal(hand(withRule(DEFAULT_RULES, 'firstTurn.draw=false')), hand(DEFAULT_RULES) - 1); }); test('rule variants: the second player draws extra in their first draw step only', () => { @@ -119,7 +119,8 @@ test('rule variants: the second player can start with extra cards and a location const rules = withRule(withRule(DEFAULT_RULES, 'secondPlayer.cards=2'), 'secondPlayer.locations=1'); const s = createGame({ pool, decks: [decks[0], decks[1]], seed: 3, rules }); const p2 = s.firstPlayer === 0 ? 1 : 0; - assert.equal(s.players[p2].hand.length, s.players[s.firstPlayer].hand.length + 2); + assert.equal(s.players[p2].hand.length, rules.openingHand + 2); + assert.equal(s.players[s.firstPlayer].hand.length, rules.openingHand + 1, 'the first player drew on turn 1'); assert.equal(s.locations[p2 === 0 ? 'A2' : 'E2'].owner, p2); assert.equal(s.players[p2].serverPile.length, 18); assert.deepEqual(checkInvariants(s), []); @@ -389,10 +390,10 @@ test('buy rule: captures unlock nothing', () => { // --------------------------------------------------------------------------------------------- // Command rule (prototype): alternating commands, 2 per player per round -/** Command rule with plain A B A B rounds, so tests can predict whose command it is. */ +/** Command rule with plain A B A B rounds and an alternating lead, so tests can predict whose command it is. */ function commandTable(): Table { const t = new Table(); - t.s.rules = withRule(withRule(t.s.rules, 'commands.on=true'), 'commands.snake=false'); + for (const sp of ['commands.on=true', 'commands.snake=false', 'commands.leads=FS']) t.s.rules = withRule(t.s.rules, sp); return t; } @@ -418,8 +419,8 @@ test('command rule: the order of commands can follow a pattern of round leads, o assert.equal(order('commands.leads=FFSS'), 'FSFS' + 'FSFS' + 'SFSF' + 'SFSF'); assert.equal(order('commands.leads=thue'), 'FSFS' + 'SFSF' + 'SFSF' + 'FSFS'); assert.equal(order('commands.snake=true', 'commands.leads=F'), 'FSSF'.repeat(4)); - assert.equal(order('commands.snake=true'), 'FSSF' + 'SFFS' + 'FSSF' + 'SFFS', 'the default order'); - assert.equal(DEFAULT_RULES.commands.snake, true); + assert.equal(order('commands.snake=true'), 'FSSF' + 'SFFS' + 'FSSF' + 'SFFS', 'the v0.8 order'); + assert.deepEqual(DEFAULT_RULES.commands, { on: true, perPlayer: 2, leads: 'F', snake: true }, 'the default since v0.9: the first player leads every round, snake order'); }); test('command rule: one advance or attack per command, each Avatar once a round', () => { diff --git a/sim/test/table.ts b/sim/test/table.ts index 4d3953e..1d5086d 100644 --- a/sim/test/table.ts +++ b/sim/test/table.ts @@ -36,12 +36,13 @@ export class Table { main: [...(x.main ?? []), ...Array(12).fill(FILLER)], }); const decks = [side(o.south), side(o.north)] as const; - // Classic turns (one turn each, every Avatar acts) and one-roll combats, which the card tests - // are written for. The command rule has its own tests in engine.test.ts, the health rule in - // health.test.ts (`health: true`). + // Classic turns (one turn each, every Avatar acts), no turn-1 draw for the first player, and + // one-roll combats, which the card tests are written for. The command rule has its own tests in + // engine.test.ts, the health rule in health.test.ts (`health: true`). const rules: RulesConfig = { ...DEFAULT_RULES, commands: { ...DEFAULT_RULES.commands, on: false }, + firstTurn: { ...DEFAULT_RULES.firstTurn, draw: false }, health: { ...DEFAULT_RULES.health, on: o.health ?? false }, openingHand: 0, deck: { avatars: 4, servers: decks[0].servers.length, main: decks[0].main.length, maxCopies: 99 },