Preserve Intrusion views across JSON save boundaries
This commit is contained in:
1 parent
0d01d18ddd
commit
51ef855d19
4 files changed
+47
-2
No files matched your search
@@ -220,6 +220,19 @@ void test('advisors moving to an empty territory become fighters; optional occup
|
||||
assert.equal(isAdvisor(empty.players[1], 'imperial_basin'), false);
|
||||
assert.equal(empty.response, null);
|
||||
});
|
||||
void test('intrusion without advisor accompaniment restores the same decision and private views', () => {
|
||||
const g = fixture();
|
||||
army(g, 'b', { 'arrakeen:10': 20 });
|
||||
const pending = applyAction(g, 'a', {
|
||||
type: 'ship', territory: 'arrakeen', sector: 10, amount: 2,
|
||||
});
|
||||
assert.equal(pending.decision?.kind, 'intrusion');
|
||||
assert.equal(Object.hasOwn(pending.decision!, 'followup'), false);
|
||||
const restored = JSON.parse(JSON.stringify(pending)) as Game;
|
||||
for (const player of pending.players)
|
||||
assert.deepEqual(viewGame(restored, player.id), viewGame(pending, player.id));
|
||||
});
|
||||
|
||||
void test('intrusion resolves before free accompaniment, with a separate cancelable token flip and same-turn advisor lock', () => {
|
||||
let g = fixture();
|
||||
g.players[0].hand = [baseDeck().find((c) => c.effect === 'karama')!];
|
||||
|
||||
@@ -279,3 +279,26 @@ void test('Junction distinguishes native Fremen Arrakis arrival from a foreign H
|
||||
viewGame(foreign, 'beneGesserit').decision,
|
||||
);
|
||||
});
|
||||
|
||||
void test('Junction Intrusion without accompanying advisors survives JSON restoration', () => {
|
||||
let g = fixture(true);
|
||||
g.active = 'fremen';
|
||||
g.movementRemaining = ['fremen', 'atreides', 'beneGesserit', 'guild'];
|
||||
const bg = player(g, 'beneGesserit');
|
||||
bg.forces = { 'wind_pass:14': 1 };
|
||||
bg.reserves = 19;
|
||||
g = offered(g);
|
||||
const option = viewGame(g, 'fremen').junctionTransport!;
|
||||
g = applyAction(g, 'fremen', {
|
||||
type: 'junctionShip',
|
||||
event: option.event,
|
||||
offer: option.offer!.event,
|
||||
destination: 'wind_pass:14',
|
||||
sources: { 'homeworld:fremen': { normal: 1, elite: 0 } },
|
||||
});
|
||||
assert.equal(g.decision?.kind, 'intrusion');
|
||||
assert.equal(Object.hasOwn(g.decision!, 'followup'), false);
|
||||
const restored: Game = JSON.parse(JSON.stringify(g));
|
||||
for (const seat of g.players)
|
||||
assert.deepEqual(viewGame(restored, seat.id), viewGame(g, seat.id));
|
||||
});
|
||||
Reference in new issue
Block a user