updates
This commit is contained in:
parent
5368464042
commit
937f44defe
100 changed files with 10185 additions and 2042 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { test } from 'node:test';
|
||||
import { loadCards } from '../src/cards.ts';
|
||||
import { loadCards } from '../src/load.ts';
|
||||
import { randomDeck } from '../src/deck.ts';
|
||||
import { advanceTargets, avatarCores, createGame, legalActions, viewFor } from '../src/engine.ts';
|
||||
import { advanceTargets, anomalyCores, createGame, legalActions, viewFor } from '../src/engine.ts';
|
||||
import { checkInvariants } from '../src/invariants.ts';
|
||||
import { makeRng } from '../src/rng.ts';
|
||||
import { DEFAULT_RULES, withRule, type RulesConfig } from '../src/rules.ts';
|
||||
|
|
@ -19,9 +19,9 @@ test('setup follows rules.md', () => {
|
|||
const pl = s.players[p];
|
||||
assert.ok(pl.hand.length >= 7, 'opening hand');
|
||||
assert.equal(pl.serverPile.length, 19);
|
||||
assert.ok(pl.ram >= 4);
|
||||
assert.deepEqual(pl.avatars.slice(0, 4).map((a) => a.faceUp), [true, false, false, false]);
|
||||
assert.ok(pl.avatars.slice(4).every((a) => !a.faceUp && a.at === null), 'no copies yet');
|
||||
assert.ok(pl.bandwidth >= 4);
|
||||
assert.deepEqual(pl.anomalies.slice(0, 4).map((a) => a.faceUp), [true, false, false, false]);
|
||||
assert.ok(pl.anomalies.slice(4).every((a) => !a.faceUp && a.at === null), 'no copies yet');
|
||||
assert.equal(s.locations[p === 0 ? 'S1' : 'S2'].owner, p);
|
||||
}
|
||||
assert.equal(s.turn, 1);
|
||||
|
|
@ -62,53 +62,53 @@ test('rule variants: more cards per draw step', () => {
|
|||
assert.equal(t.s.players[1].hand.length, 2);
|
||||
});
|
||||
|
||||
test('advancing captures an unowned location in step 5 and pays 4 RAM; Lv 1 unlocks nothing', () => {
|
||||
test('advancing captures an unowned location in step 5 and pays 4 Gb; Lv 1 unlocks nothing', () => {
|
||||
const t = new Table();
|
||||
t.ram(0, 4);
|
||||
t.bandwidth(0, 4);
|
||||
assert.deepEqual(advanceTargets(t.s, 0), ['A2']);
|
||||
t.go({ type: 'place', slot: 1, to: 'S1' }).go({ type: 'advance', slot: 1, to: 'A2' });
|
||||
t.to('attack');
|
||||
assert.equal(t.s.locations.A2.owner, null);
|
||||
t.end();
|
||||
assert.equal(t.s.locations.A2.owner, 0);
|
||||
assert.equal(t.avatar(0, 1).at, 'A2');
|
||||
assert.equal(t.s.players[0].ram, 8, '4 RAM + 4 for the capture');
|
||||
assert.equal(t.avatar(0, 2).faceUp, false, 'A2 is Lv 1 for South');
|
||||
assert.equal(t.anomaly(0, 1).at, 'A2');
|
||||
assert.equal(t.s.players[0].bandwidth, 8, '4 Gb + 4 for the capture');
|
||||
assert.equal(t.anomaly(0, 2).faceUp, false, 'A2 is Lv 1 for South');
|
||||
assert.equal(t.s.step, 'playAgain');
|
||||
});
|
||||
|
||||
test('the second row (Lv 2) unlocks Avatar 2; the middle row (Lv 3) unlocks Avatars 2 and 3', () => {
|
||||
test('the second row (Lv 2) unlocks Anomaly 2; the middle row (Lv 3) unlocks Anomalies 2 and 3', () => {
|
||||
for (const [from, to, unlocked] of [['A2', 'B1', [true, false]], ['B1', 'C2', [true, true]]] as const) {
|
||||
const t = new Table();
|
||||
t.own(0, from);
|
||||
t.place(0, 1, from);
|
||||
t.go({ type: 'advance', slot: 1, to }).to('attack').end();
|
||||
assert.equal(t.s.locations[to].owner, 0);
|
||||
assert.deepEqual([t.avatar(0, 2).faceUp, t.avatar(0, 3).faceUp], unlocked, to);
|
||||
assert.deepEqual([t.anomaly(0, 2).faceUp, t.anomaly(0, 3).faceUp], unlocked, to);
|
||||
}
|
||||
});
|
||||
|
||||
test('rule variants: a turn-1 capture can pay no RAM and unlock nothing', () => {
|
||||
test('rule variants: a turn-1 capture can pay no Bandwidth and unlock nothing', () => {
|
||||
const t = new Table();
|
||||
t.s.rules = withRule(withRule(t.s.rules, 'firstTurn.captureRam=false'), 'firstTurn.unlock=false');
|
||||
t.ram(0, 4).own(0, 'A2');
|
||||
t.s.rules = withRule(withRule(t.s.rules, 'firstTurn.captureBandwidth=false'), 'firstTurn.unlock=false');
|
||||
t.bandwidth(0, 4).own(0, 'A2');
|
||||
t.place(0, 1, 'A2');
|
||||
t.go({ type: 'advance', slot: 1, to: 'B1' }).to('attack').end();
|
||||
assert.equal(t.s.locations.B1.owner, 0);
|
||||
assert.equal(t.s.players[0].ram, 4);
|
||||
assert.equal(t.avatar(0, 2).faceUp, false);
|
||||
assert.equal(t.s.players[0].bandwidth, 4);
|
||||
assert.equal(t.anomaly(0, 2).faceUp, false);
|
||||
});
|
||||
|
||||
test('rule variants: the first player can be barred from playing cards on turn 1', () => {
|
||||
const t = new Table({ south: { main: ['Additional Core'] }, north: { main: ['Additional Core'] } });
|
||||
t.s.rules = withRule(t.s.rules, 'firstTurn.cards=false');
|
||||
t.hand(0, 'Additional Core');
|
||||
t.ram(0, 9).place(0, 1, 'S1');
|
||||
t.bandwidth(0, 9).place(0, 1, 'S1');
|
||||
t.to('playAgain');
|
||||
assert.ok(!t.legal().some((a) => a.type === 'installHardware'));
|
||||
t.end();
|
||||
t.hand(1, 'Additional Core');
|
||||
t.ram(1, 9).place(1, 1, 'S2');
|
||||
t.bandwidth(1, 9).place(1, 1, 'S2');
|
||||
t.to('playAgain');
|
||||
assert.ok(t.legal().some((a) => a.type === 'installHardware'), 'the second player can on turn 2');
|
||||
});
|
||||
|
|
@ -136,21 +136,21 @@ test('a Firewall blocks movement until someone pays to clear it', () => {
|
|||
const t = new Table();
|
||||
t.own(0, 'A2');
|
||||
t.s.firewalls['A1-A2'] = 2;
|
||||
t.ram(0, 4).go({ type: 'place', slot: 1, to: 'S1' });
|
||||
t.bandwidth(0, 4).go({ type: 'place', slot: 1, to: 'S1' });
|
||||
assert.ok(!advanceTargets(t.s, 0).includes('A1'));
|
||||
assert.ok(!t.can({ type: 'advance', slot: 1, to: 'A1' }));
|
||||
t.go({ type: 'clearFirewall', line: 'A1-A2' });
|
||||
assert.equal(t.s.players[0].ram, 0, 'clearing a Lv 2 Firewall costs 4');
|
||||
assert.equal(t.s.players[0].bandwidth, 0, 'clearing a Lv 2 Firewall costs 4');
|
||||
assert.ok(advanceTargets(t.s, 0).includes('A1'));
|
||||
});
|
||||
|
||||
test('Firewalls go only on gateways, and upgrades cost the full price of the new level', () => {
|
||||
const t = new Table({ south: { servers: ['Upgraded Hardware'] } });
|
||||
t.own(0, 'A2', 'Upgraded Hardware');
|
||||
t.ram(0, 20).to('play');
|
||||
t.bandwidth(0, 20).to('play');
|
||||
assert.ok(!t.can({ type: 'firewall', line: 'S1-A2', level: 1 }));
|
||||
t.go({ type: 'firewall', line: 'A1-A2', level: 1 }).go({ type: 'firewall', line: 'A1-A2', level: 2 });
|
||||
assert.equal(t.s.players[0].ram, 20 - 2 - 4);
|
||||
assert.equal(t.s.players[0].bandwidth, 20 - 2 - 4);
|
||||
assert.equal(t.s.firewalls['A1-A2'], 2);
|
||||
});
|
||||
|
||||
|
|
@ -163,21 +163,21 @@ test('combat: the loser goes back to its slot and loses its Hardware; the winner
|
|||
t.place(1, 1, 'C1');
|
||||
const hw = t.hardware(1, 1, 'Additional Core');
|
||||
t.to('attack').go({ type: 'attack', slot: 1, to: 'C1' });
|
||||
assert.equal(avatarCores(t.s, 0, 1, 'attack'), 4);
|
||||
assert.equal(avatarCores(t.s, 1, 1, 'defend'), 5, '4 Cores + Additional Core');
|
||||
assert.equal(anomalyCores(t.s, 0, 1, 'attack'), 4);
|
||||
assert.equal(anomalyCores(t.s, 1, 1, 'defend'), 5, '4 Cores + Additional Core');
|
||||
t.rig(...(attackerWins ? [6, 6, 6, 6, 1, 1, 1, 1, 1] : [1, 1, 1, 1, 6, 6, 6, 6, 6]));
|
||||
t.end();
|
||||
if (attackerWins) {
|
||||
assert.equal(t.s.locations.C1.owner, 0);
|
||||
assert.equal(t.avatar(0, 1).at, 'C1');
|
||||
assert.equal(t.avatar(1, 1).at, null);
|
||||
assert.deepEqual(t.avatar(1, 1).hardware, []);
|
||||
assert.equal(t.anomaly(0, 1).at, 'C1');
|
||||
assert.equal(t.anomaly(1, 1).at, null);
|
||||
assert.deepEqual(t.anomaly(1, 1).hardware, []);
|
||||
assert.ok(t.s.players[1].discard.includes(hw));
|
||||
assert.equal(t.s.stats.attacksWon[0], 1);
|
||||
} else {
|
||||
assert.equal(t.avatar(0, 1).at, null);
|
||||
assert.equal(t.avatar(1, 1).at, 'C1');
|
||||
assert.deepEqual(t.avatar(1, 1).hardware, [hw]);
|
||||
assert.equal(t.anomaly(0, 1).at, null);
|
||||
assert.equal(t.anomaly(1, 1).at, 'C1');
|
||||
assert.deepEqual(t.anomaly(1, 1).hardware, [hw]);
|
||||
}
|
||||
assert.equal(t.s.stats.attacks[0], 1);
|
||||
}
|
||||
|
|
@ -222,15 +222,15 @@ test('reaching the location target wins immediately', () => {
|
|||
assert.deepEqual(legalActions(t.s), []);
|
||||
});
|
||||
|
||||
test('Salvage pays full printed RAM, from hand only', () => {
|
||||
test('Salvage pays full printed Bandwidth, from hand only', () => {
|
||||
const t = new Table({ south: { main: ['Cooling System'] } });
|
||||
const [card] = t.hand(0, 'Cooling System');
|
||||
t.go({ type: 'salvage', card });
|
||||
assert.equal(t.s.players[0].ram, 6);
|
||||
assert.equal(t.s.players[0].bandwidth, 6);
|
||||
assert.ok(t.s.players[0].discard.includes(card));
|
||||
});
|
||||
|
||||
test('views hide the opponent hand, both decks, face-down Avatars and the RNG', () => {
|
||||
test('views hide the opponent hand, both decks, face-down Anomalies and the RNG', () => {
|
||||
const t = new Table({ south: { main: ['Additional Core'] }, north: { main: ['Additional Core'] } });
|
||||
t.hand(0, 'Additional Core');
|
||||
t.hand(1, 'Additional Core');
|
||||
|
|
@ -239,8 +239,8 @@ test('views hide the opponent hand, both decks, face-down Avatars and the RNG',
|
|||
assert.deepEqual(v.players[0].hand, t.s.players[0].hand);
|
||||
assert.ok(v.players[0].deck.every((id) => id === -1));
|
||||
assert.ok(v.players[1].serverPile.every((id) => id === -1));
|
||||
assert.equal(v.players[0].avatars[1].card, -1);
|
||||
assert.equal(v.players[1].avatars[1].card, -1);
|
||||
assert.equal(v.players[0].anomalies[1].card, -1);
|
||||
assert.equal(v.players[1].anomalies[1].card, -1);
|
||||
assert.equal(v.rng.s, 0);
|
||||
assert.notEqual(t.s.rng.s, 0);
|
||||
});
|
||||
|
|
@ -259,9 +259,9 @@ test('an opponent with a response gets a window after a declaration; without one
|
|||
t.place(0, 1, 'S1');
|
||||
t.place(0, 2, 'A2');
|
||||
t.act({ type: 'advance', slot: 1, to: 'A1' });
|
||||
assert.equal(t.decider, 0, 'North has no RAM, so no window');
|
||||
assert.equal(t.decider, 0, 'North has no Bandwidth, so no window');
|
||||
t.hand(1, 'Execute: Ping Sweep');
|
||||
t.ram(1, 4);
|
||||
t.bandwidth(1, 4);
|
||||
t.act({ type: 'advance', slot: 2, to: 'A3' });
|
||||
assert.equal(t.decider, 1, 'North may respond');
|
||||
t.act({ type: 'pass' });
|
||||
|
|
@ -269,17 +269,17 @@ test('an opponent with a response gets a window after a declaration; without one
|
|||
});
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Recruit rule (prototype): Avatars in the deck, bought with RAM
|
||||
// Recruit rule (prototype): Anomalies in the deck, bought with Bandwidth
|
||||
|
||||
/** A table under the recruit rule: Avatar 1 stays, Avatars 2–4 move to their owner's hand, priced at 6 RAM. */
|
||||
/** A table under the recruit rule: Anomaly 1 stays, Anomalies 2–4 move to their owner's hand, priced at 6 Gb. */
|
||||
function recruitTable(o: ConstructorParameters<typeof Table>[0] = {}): Table {
|
||||
const t = new Table(o);
|
||||
t.s.rules = withRule(t.s.rules, 'recruit.on=true');
|
||||
for (const p of [0, 1] as const) {
|
||||
const avs = t.s.players[p].avatars;
|
||||
const avs = t.s.players[p].anomalies;
|
||||
for (let i = 1; i < 4; i++) {
|
||||
const name = t.s.cards[avs[i].card].name;
|
||||
t.s.defs[name] = { ...t.s.defs[name], ram: 6 };
|
||||
t.s.defs[name] = { ...t.s.defs[name], bandwidth: 6 };
|
||||
t.s.players[p].hand.push(avs[i].card);
|
||||
avs[i].card = avs[i + 4].card = -1;
|
||||
avs[i].faceUp = false;
|
||||
|
|
@ -290,101 +290,101 @@ function recruitTable(o: ConstructorParameters<typeof Table>[0] = {}): Table {
|
|||
|
||||
const recruits = (t: Table) => t.legal().filter((a) => a.type === 'recruit');
|
||||
|
||||
test('recruit rule: buy an Avatar from hand into an empty slot; it enters play on a later turn', () => {
|
||||
test('recruit rule: buy an Anomaly from hand into an empty slot; it enters play on a later turn', () => {
|
||||
const t = recruitTable();
|
||||
const card = t.s.players[0].hand[0];
|
||||
t.ram(0, 5).to('play');
|
||||
assert.equal(recruits(t).length, 0, "can't afford 6 RAM");
|
||||
t.ram(0, 6);
|
||||
assert.deepEqual(recruits(t).map((a) => a.type === 'recruit' && a.slot), [2, 1, 2, 1, 2, 1], 'first empty slot, or over Avatar 1');
|
||||
t.bandwidth(0, 5).to('play');
|
||||
assert.equal(recruits(t).length, 0, "can't afford 6 Gb");
|
||||
t.bandwidth(0, 6);
|
||||
assert.deepEqual(recruits(t).map((a) => a.type === 'recruit' && a.slot), [2, 1, 2, 1, 2, 1], 'first empty slot, or over Anomaly 1');
|
||||
t.go({ type: 'recruit', card, slot: 2 });
|
||||
assert.equal(t.s.players[0].ram, 0);
|
||||
assert.equal(t.avatar(0, 2).card, card);
|
||||
assert.equal(t.avatar(0, 2).faceUp, true);
|
||||
assert.equal(t.s.players[0].bandwidth, 0);
|
||||
assert.equal(t.anomaly(0, 2).card, card);
|
||||
assert.equal(t.anomaly(0, 2).faceUp, true);
|
||||
assert.ok(!t.s.players[0].hand.includes(card));
|
||||
t.to('playAgain').end().to('playAgain').end();
|
||||
assert.ok(t.can({ type: 'place', slot: 2, to: 'S1' }));
|
||||
});
|
||||
|
||||
test('recruit rule: captures unlock nothing, and a salvaged Avatar pays its price', () => {
|
||||
test('recruit rule: captures unlock nothing, and a salvaged Anomaly pays its price', () => {
|
||||
const t = recruitTable();
|
||||
t.own(0, 'B1');
|
||||
t.place(0, 1, 'B1');
|
||||
t.go({ type: 'advance', slot: 1, to: 'C2' }).to('attack').end();
|
||||
assert.equal(t.s.locations.C2.owner, 0);
|
||||
assert.equal(t.avatar(0, 2).card, -1);
|
||||
const ram = t.s.players[0].ram;
|
||||
assert.equal(t.anomaly(0, 2).card, -1);
|
||||
const bandwidth = t.s.players[0].bandwidth;
|
||||
t.go({ type: 'salvage', card: t.s.players[0].hand[0] });
|
||||
assert.equal(t.s.players[0].ram, ram + 6);
|
||||
assert.equal(t.s.players[0].bandwidth, bandwidth + 6);
|
||||
});
|
||||
|
||||
test('recruit rule: copies count toward the 4 Avatars', () => {
|
||||
const t = recruitTable({ south: { avatars: ['Carbon NanoBots', 'Broken Bits', 'Pixelated Picture', 'Corrupt Driver'] } });
|
||||
test('recruit rule: copies count toward the 4 Anomalies', () => {
|
||||
const t = recruitTable({ south: { anomalies: ['Carbon NanoBots', 'Broken Bits', 'Pixelated Picture', 'Corrupt Driver'] } });
|
||||
t.own(0, 'A2');
|
||||
t.place(0, 1, 'A2');
|
||||
const [a, b] = t.s.players[0].hand;
|
||||
t.ram(0, 30).to('play');
|
||||
t.bandwidth(0, 30).to('play');
|
||||
t.go({ type: 'recruit', card: a, slot: 2 }).go({ type: 'recruit', card: b, slot: 3 });
|
||||
const replicate = t.legal().find((x) => x.type === 'activate' && x.name === 'Carbon NanoBots' && x.args.to === 'S1');
|
||||
assert.ok(replicate, '3 Avatars, so a copy fits');
|
||||
assert.ok(replicate, '3 Anomalies, so a copy fits');
|
||||
t.go(replicate).settle();
|
||||
assert.equal(t.avatar(0, 5).at, 'S1');
|
||||
assert.equal(t.anomaly(0, 5).at, 'S1');
|
||||
assert.ok(!recruits(t).some((r) => r.type === 'recruit' && r.slot === 4), 'no room for a fourth with the copy out');
|
||||
});
|
||||
|
||||
test('recruit rule: recruiting over an Avatar retires it and its Hardware', () => {
|
||||
test('recruit rule: recruiting over an Anomaly retires it and its Hardware', () => {
|
||||
const t = recruitTable({ south: { main: ['Additional Core'] } });
|
||||
t.own(0, 'A2');
|
||||
const ref = t.place(0, 1, 'A2');
|
||||
const old = t.avatar(0, 1).card;
|
||||
const old = t.anomaly(0, 1).card;
|
||||
const hw = t.hardware(ref.player, ref.slot, 'Additional Core');
|
||||
const card = t.s.players[0].hand.find((id) => t.s.defs[t.s.cards[id].name].kind === 'avatar')!;
|
||||
t.ram(0, 6).to('play').go({ type: 'recruit', card, slot: 1 });
|
||||
assert.equal(t.avatar(0, 1).card, card);
|
||||
assert.equal(t.avatar(0, 1).at, null);
|
||||
assert.deepEqual(t.avatar(0, 1).hardware, []);
|
||||
const card = t.s.players[0].hand.find((id) => t.s.defs[t.s.cards[id].name].kind === 'anomaly')!;
|
||||
t.bandwidth(0, 6).to('play').go({ type: 'recruit', card, slot: 1 });
|
||||
assert.equal(t.anomaly(0, 1).card, card);
|
||||
assert.equal(t.anomaly(0, 1).at, null);
|
||||
assert.deepEqual(t.anomaly(0, 1).hardware, []);
|
||||
assert.ok(t.s.players[0].discard.includes(old) && t.s.players[0].discard.includes(hw));
|
||||
assert.equal(t.s.locations.A2.owner, 0, 'the location stays yours');
|
||||
});
|
||||
|
||||
test('recruit rule: decks keep one Avatar outside and shuffle the rest into the main deck', () => {
|
||||
test('recruit rule: decks keep one Anomaly outside and shuffle the rest into the main deck', () => {
|
||||
const pool = loadCards();
|
||||
const rules = withRule(withRule(DEFAULT_RULES, 'recruit.on=true'), 'recruit.avatarsInDeck=5');
|
||||
const rules = withRule(withRule(DEFAULT_RULES, 'recruit.on=true'), 'recruit.anomaliesInDeck=5');
|
||||
const deck = randomDeck(pool, makeRng(3), rules);
|
||||
assert.equal(deck.avatars.length, 1);
|
||||
assert.equal(deck.anomalies.length, 1);
|
||||
assert.equal(deck.main.length, 45);
|
||||
assert.equal(deck.main.filter((n) => pool.byName.get(n)!.kind === 'avatar').length, 5);
|
||||
assert.equal(deck.main.filter((n) => pool.byName.get(n)!.kind === 'anomaly').length, 5);
|
||||
const s = createGame({ pool, decks: [deck, randomDeck(pool, makeRng(4), rules)], seed: 1, rules });
|
||||
assert.deepEqual(s.players[0].avatars.slice(0, 4).map((a) => a.card >= 0), [true, false, false, false]);
|
||||
assert.deepEqual(s.players[0].anomalies.slice(0, 4).map((a) => a.card >= 0), [true, false, false, false]);
|
||||
assert.equal(checkInvariants(s).length, 0);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Buy-Avatars rule (prototype): pay RAM to flip the next Avatar instead of unlocking by level
|
||||
// Buy-Anomalies rule (prototype): pay Bandwidth to flip the next Anomaly instead of unlocking by level
|
||||
|
||||
test('buy rule: pay to flip the next face-down Avatar; it enters play on a later turn', () => {
|
||||
test('buy rule: pay to flip the next face-down Anomaly; it enters play on a later turn', () => {
|
||||
const t = new Table();
|
||||
t.s.rules = withRule(withRule(t.s.rules, 'buyAvatars.on=true'), 'buyAvatars.prices=8,12,16');
|
||||
t.ram(0, 7).to('play');
|
||||
assert.ok(!t.can({ type: 'buyAvatar', slot: 2 }), "can't afford 8 RAM");
|
||||
t.ram(0, 20).go({ type: 'buyAvatar', slot: 2 });
|
||||
assert.equal(t.avatar(0, 2).faceUp, true);
|
||||
assert.equal(t.s.players[0].ram, 12);
|
||||
assert.ok(t.can({ type: 'buyAvatar', slot: 3 }), 'Avatar 3 is next, at 12');
|
||||
t.go({ type: 'buyAvatar', slot: 3 });
|
||||
assert.equal(t.s.players[0].ram, 0);
|
||||
t.s.rules = withRule(withRule(t.s.rules, 'buyAnomalies.on=true'), 'buyAnomalies.prices=8,12,16');
|
||||
t.bandwidth(0, 7).to('play');
|
||||
assert.ok(!t.can({ type: 'buyAnomaly', slot: 2 }), "can't afford 8 Gb");
|
||||
t.bandwidth(0, 20).go({ type: 'buyAnomaly', slot: 2 });
|
||||
assert.equal(t.anomaly(0, 2).faceUp, true);
|
||||
assert.equal(t.s.players[0].bandwidth, 12);
|
||||
assert.ok(t.can({ type: 'buyAnomaly', slot: 3 }), 'Anomaly 3 is next, at 12');
|
||||
t.go({ type: 'buyAnomaly', slot: 3 });
|
||||
assert.equal(t.s.players[0].bandwidth, 0);
|
||||
t.to('playAgain').end().to('playAgain').end();
|
||||
assert.ok(t.can({ type: 'place', slot: 2, to: 'S1' }));
|
||||
});
|
||||
|
||||
test('buy rule: captures unlock nothing', () => {
|
||||
const t = new Table();
|
||||
t.s.rules = withRule(t.s.rules, 'buyAvatars.on=true');
|
||||
t.s.rules = withRule(t.s.rules, 'buyAnomalies.on=true');
|
||||
t.own(0, 'B1');
|
||||
t.place(0, 1, 'B1');
|
||||
t.go({ type: 'advance', slot: 1, to: 'C2' }).to('attack').end();
|
||||
assert.equal(t.s.locations.C2.owner, 0);
|
||||
assert.deepEqual([t.avatar(0, 2).faceUp, t.avatar(0, 3).faceUp], [false, false]);
|
||||
assert.deepEqual([t.anomaly(0, 2).faceUp, t.anomaly(0, 3).faceUp], [false, false]);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
|
@ -423,7 +423,7 @@ test('command rule: the order of commands can follow a pattern of round leads, o
|
|||
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', () => {
|
||||
test('command rule: one advance or attack per command, each Anomaly once a round', () => {
|
||||
const t = commandTable();
|
||||
t.own(0, 'A2');
|
||||
t.own(0, 'A1');
|
||||
|
|
@ -436,15 +436,15 @@ test('command rule: one advance or attack per command, each Avatar once a round'
|
|||
t.to('playAgain').end().to('playAgain').end();
|
||||
assert.equal(t.s.turn, 3);
|
||||
const movers = new Set(t.legal().filter((a) => a.type === 'advance').map((a) => a.type === 'advance' && a.slot));
|
||||
assert.deepEqual([...movers], [2], 'Avatar 1 already acted this round');
|
||||
assert.deepEqual([...movers], [2], 'Anomaly 1 already acted this round');
|
||||
});
|
||||
|
||||
test('command rule: an Avatar unlocked this round enters play next round', () => {
|
||||
test('command rule: an Anomaly unlocked this round enters play next round', () => {
|
||||
const t = commandTable();
|
||||
t.own(0, 'A2');
|
||||
t.place(0, 1, 'A2');
|
||||
t.go({ type: 'advance', slot: 1, to: 'B1' }).to('attack').end();
|
||||
assert.equal(t.avatar(0, 2).faceUp, true);
|
||||
assert.equal(t.anomaly(0, 2).faceUp, true);
|
||||
t.to('playAgain').end().to('playAgain').end();
|
||||
assert.equal(t.s.turn, 3);
|
||||
assert.ok(!t.legal().some((a) => a.type === 'place' && a.slot === 2));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue