rule change
This commit is contained in:
parent
62b2b9feca
commit
5d771eed1b
9 changed files with 199 additions and 75 deletions
|
|
@ -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', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue