Support board-wide Truthtrance force questions
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
f1007a4ea8
commit
89589878fc
12 files changed
+144
-29
No files matched your search
@@ -37,6 +37,7 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
|
||||
for (const zone of [
|
||||
{ kind: 'reserves' },
|
||||
{ kind: 'tanks' },
|
||||
{ kind: 'board' },
|
||||
{ kind: 'territory', territory: 'imperial_basin' },
|
||||
{ kind: 'location', territory: 'imperial_basin', sector: 9 },
|
||||
])
|
||||
@@ -48,6 +49,7 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
|
||||
for (const malformed of [
|
||||
{ ...input, privateHint: true },
|
||||
{ ...input, zone: { kind: 'reserves', territory: 'arrakeen' } },
|
||||
{ ...input, zone: { kind: 'board', territory: 'arrakeen' } },
|
||||
{ ...input, zone: { kind: 'territory', territory: 'unknown' } },
|
||||
{ ...input, zone: { kind: 'territory', territory: 'arrakeen', sector: 10 } },
|
||||
{
|
||||
@@ -85,6 +87,24 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
|
||||
assert.throws(() => parseForceCountFact({ ...input, value }, locations));
|
||||
});
|
||||
|
||||
void test('board pool sums only the supplied active locations and preserves typed counters', () => {
|
||||
const p: ForceCountPlayer = { faction: 'ixians', reserves: 6, tanks: 2,
|
||||
forces: { 'arrakeen:10': 4, 'imperial_basin:9': 3, 'hidden_mobile_stronghold:0': 6, 'cistern:0': 5, 'invalid:0': 10 },
|
||||
elites: { reserves: 0, tanks: 0, forces: { 'arrakeen:10': 1, 'imperial_basin:9': 2, 'hidden_mobile_stronghold:0': 3 } } };
|
||||
const zone = { kind: 'board' } as const;
|
||||
for (const [counter, n] of [['total', 7], ['normal', 4], ['elite', 3]] as const)
|
||||
assert.equal(forceCountFactMatches(p, fact(zone, counter, 'eq', n), locations), true);
|
||||
const withHms = [...locations, { territory: 'hidden_mobile_stronghold', sector: 0 }];
|
||||
assert.equal(forceCountFactMatches(p, fact(zone, 'total', 'eq', 13), withHms), true);
|
||||
assert.equal(forceCountFactMatches(p, fact(zone, 'elite', 'eq', 6), withHms), true);
|
||||
assert.throws(() => forceCountFactMatches(p, fact(zone)), /board locations/);
|
||||
assert.throws(() => forceCountFactMatches(p, fact(zone), []), /board locations/);
|
||||
assert.throws(() => forceCountFactMatches(p, fact(zone), [...locations, locations[0]]), /duplicate/);
|
||||
assert.throws(() => forceCountFactMatches(p, fact(zone), [{ territory: 'arrakeen', sector: 999 }]), /malformed/);
|
||||
assert.equal(forceCountFactText(fact(zone, 'total', 'eq', 7)),
|
||||
'you currently have exactly 7 physical forces on the current Arrakis board');
|
||||
});
|
||||
|
||||
void test('territory-wide facts sum physical sectors and their typed subsets without counting nearby or interior territories', () => {
|
||||
const player: ForceCountPlayer = {
|
||||
faction: 'ixians', reserves: 9, tanks: 0,
|
||||
|
||||
Reference in new issue
Block a user