Add whole-territory Truthtrance force questions
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 03:37:52 +11:00
1 parent 7552bb5394
commit f1007a4ea8
9 files changed
+149 -21

No files matched your search

+39
View File
@@ -94,6 +94,40 @@ void test('Truthtrance counts physical total, normal and elite forces in reserve
}
});
void test('a whole-territory Basic question counts separate sectors and every bot answers the same real fact', () => {
const initial = knowledgeGame(false);
const fremen = player(initial, 'f');
// Preserve the original ten on-board and ten reserve Fremen counters.
fremen.forces = { 'wind_pass:14': 4, 'wind_pass:15': 6 };
const zone: ForceFact['zone'] = { kind: 'territory', territory: 'wind_pass' };
answer(ask(initial, 'f', fact(zone, 'total', 10)), 'f', 'yes');
answer(ask(initial, 'f', fact(zone, 'total', 11, 'gte')), 'f', 'no');
for (const difficulty of DIFFICULTIES) {
const waiting = ask(initial, 'f', fact(zone, 'total', 10));
const view = viewGame(waiting, 'f');
view.players.find(candidate => candidate.id === 'f')!.bot = difficulty;
const response = botActions(view);
assert.deepEqual(response, [{ type: 'truthAnswer', answer: 'yes' }]);
const done = act(waiting, 'f', response[0]);
assert.equal(done.truthtrance, null);
assert.equal(done.truthHistory!.at(-1)!.answer, 'yes');
}
});
void test('whole-territory typed facts aggregate elite and normal counters across sectors', () => {
const initial = typedGame();
const fremen = player(initial, 'f');
const before = knowledgePhysical(initial);
fremen.forces = { 'wind_pass:14': 4, 'wind_pass:15': 3 };
fremen.elites!.reserves = 0;
fremen.elites!.forces = { 'wind_pass:14': 1, 'wind_pass:15': 1 };
assert.deepEqual(knowledgePhysical(initial), before);
const zone: ForceFact['zone'] = { kind: 'territory', territory: 'wind_pass' };
answer(ask(initial, 'f', fact(zone, 'total', 7)), 'f', 'yes');
answer(ask(initial, 'f', fact(zone, 'normal', 5)), 'f', 'yes');
answer(ask(initial, 'f', fact(zone, 'elite', 2)), 'f', 'yes');
});
void test('Basic untracked starred factions allow total counts while ordinary absent elite tracking means zero elites', () => {
const initial = knowledgeGame(false);
assert.equal(player(initial, 'f').elites, undefined);
@@ -230,6 +264,8 @@ void test('the live HMS interior is an exact physical location distinct from its
assert.equal(player(initial, 'i').elites!.forces[MOBILE_LOCATION], 3);
for (const [counter, value] of [['total', 6], ['normal', 3], ['elite', 3]] as const)
assertIxSkillsCustody(answer(ask(initial, 'i', fact({ kind: 'location', territory: MOBILE_STRONGHOLD, sector: 0 }, counter, value), 'e'), 'i', 'yes'));
answer(ask(initial, 'i', fact({ kind: 'territory', territory: MOBILE_STRONGHOLD }, 'total', 6), 'e'), 'i', 'yes');
answer(ask(initial, 'i', fact({ kind: 'territory', territory: 'polar_sink' }, 'total', 0), 'e'), 'i', 'yes');
answer(ask(initial, 'i', fact({ kind: 'location', territory: 'polar_sink', sector: 0 }, 'total', 0), 'e'), 'i', 'yes');
const waiting = declared(initial, 'e');
reject(waiting, 'e', { type: 'truthAsk', question: { kind: 'fact', target: 'i',
@@ -243,10 +279,13 @@ void test('a Discovery location becomes queryable only after its genuine reveal'
const hidden = declared(game, 'g');
reject(hidden, 'g', { type: 'truthAsk', question: { kind: 'fact', target: 'a',
fact: fact({ kind: 'location', territory: 'cistern', sector: 0 }, 'total', 0) } });
reject(hidden, 'g', { type: 'truthAsk', question: { kind: 'fact', target: 'a',
fact: fact({ kind: 'territory', territory: 'cistern' }, 'total', 0) } });
game = act(game, 'a', { type: 'discovery', token: token.id, reveal: false });
game = act(game, 'a', { type: 'discovery', token: token.id, reveal: true });
assert.equal(game.discoveries!.tokens.find(candidate => candidate.id === token.id)!.revealedTurn, game.turn);
answer(ask(game, 'a', fact({ kind: 'location', territory: 'cistern', sector: 0 }, 'total', 0), 'g'), 'a', 'yes');
answer(ask(game, 'a', fact({ kind: 'territory', territory: 'cistern' }, 'total', 0), 'g'), 'a', 'yes');
});
void test('Homeworld reserve facts read the faction aggregate and do not add a separate Homeworld query', () => {