Allow Caladan reinforcement before Face Dance

This commit is contained in:
Quintine committed 2026-10-26 07:58:51 +11:00
1 parent 18bf5d4423
commit cab6b41c67
20 files changed
+1272 -118

No files matched your search

+49 -71
View File
@@ -16,13 +16,19 @@ import {
} from './fixture-caladan-victory';
import { caladanAmbassadorFixture as fixture } from './fixture-caladan-ambassador';
import { fighterCount } from '../game/advisors';
function open(native = 6) {
function open(native = 6, polarAlone = false) {
const initial = fixture();
if (native !== 6) {
p(initial, 'a').reserves = native;
p(initial, 'a').forces['polar_sink:0'] -= native - 6;
}
if (polarAlone) {
// Conserved controlled initial position for the automatic Polar conversion.
p(initial, 'a').forces['hagga_basin:12'] = p(initial, 'a').forces['polar_sink:0'];
delete p(initial, 'a').forces['polar_sink:0'];
}
let g = finishVictoryCalls(
commitVictoryPlans(prepareVictoryBattle(initial, 'arrakeen')),
);
@@ -53,87 +59,59 @@ function allow(g: Game) {
return g;
}
void test('actual Caladan victory reinforces once and preserves its battle through Guild, BG and Fremen Ambassador children', () => {
void test('actual Caladan victory keeps its Guild and Advanced Spiritual child without triggering an Ambassador for advisors', () => {
let g = open();
const event = g.homeworldVictoryReinforcement!.event;
const parent = g.pendingAmbassador!.event;
assert.equal(p(g, 'a').reserves, 5);
assert.equal(p(g, 'a').forces['arrakeen:10'], 3);
g = applyAction(reload(g), 'ec', {
type: 'decision',
event: parent,
trigger: true,
beneficiary: 'h',
});
g = applyAction(reload(g), 'h', {
type: 'decision',
event: parent,
amount: 2,
territory: 'sietch_tabr',
sector: 14,
});
const event = g.homeworldVictoryReinforcement!.event, parent = g.pendingAmbassador!.event;
assert.equal(p(g, 'a').reserves, 5); assert.equal(p(g, 'a').forces['arrakeen:10'], 3);
g = applyAction(g, 'ec', { type: 'decision', event: parent, trigger: true, beneficiary: 'h' });
g = applyAction(g, 'h', { type: 'decision', event: parent, amount: 2, territory: 'sietch_tabr', sector: 14 });
assert.equal(g.decision?.kind, 'intrusion');
g = applyAction(reload(g), 'bg', { type: 'decision', accept: false });
g = applyAction(reload(g), 'bg', {
type: 'decision',
accept: true,
accompany: true,
});
// Resolve real Intrusion before legal Advanced accompaniment into this territory.
g = allow(applyAction(g, 'bg', { type: 'decision', accept: true }));
assert.equal(fighterCount(p(g, 'bg'), 'sietch_tabr'), 0);
g = applyAction(g, 'bg', { type: 'decision', accept: true, accompany: true });
assert.equal(g.response?.kind, 'advisor');
assert.equal(g.pendingSpiritualAdvisor!.source!.phase, 6);
assert.equal(g.pendingAmbassador!.victoryEvent, event);
g = allow(g);
assert.equal(g.pendingAmbassador?.entrant, 'bg');
assert.equal(g.pendingAmbassador?.victoryEvent, event);
assert.equal(g.pendingAmbassador?.revivalEvent, undefined);
assert.deepEqual(
g.homeworldVictoryReinforcement!.ambassadors!.map(
(entry) => entry.completed,
),
[true, false],
);
assert.equal(g.lastBattleContext!.caladanReinforcement!.completed, false);
assert.deepEqual(normalizeAutomaticGame(reload(g)), reload(g));
const child = g.pendingAmbassador!.event;
g = applyAction(reload(g), 'ec', {
type: 'decision',
event: child,
trigger: true,
beneficiary: 'ec',
});
g = applyAction(reload(g), 'ec', {
type: 'decision',
event: child,
forces: { 'red_chasm:7': 1 },
territory: 'carthag',
sector: 11,
});
// Advisors are excluded from Ambassador triggers, including the waiting Fremen token.
assert.equal(g.pendingAmbassador, null);
assert.equal(g.pendingSpiritualAdvisor ?? null, null);
assert.equal(g.homeworldVictoryReinforcement!.stage, 'complete');
assert.equal(g.lastBattleContext!.caladanReinforcement!.completed, true);
assert.deepEqual(
g.homeworldVictoryReinforcement!.ambassadors!.map(
(entry) => entry.completed,
),
[true, true],
);
assert.deepEqual(g.homeworldVictoryReinforcement!.ambassadors!.map(entry => entry.completed), [true]);
assert.equal(g.ecazAmbassadors!.tokens.find(token => token.effect === 'fremen')!.zone, 'placed');
assert.equal(g.homeworldRevivalReturn, undefined);
assert.equal(p(g, 'a').reserves, 5);
assert.equal(p(g, 'a').forces['arrakeen:10'], 3);
assert.equal(p(g, 'a').reserves, 5); assert.equal(p(g, 'a').forces['arrakeen:10'], 3);
assert.equal(p(g, 'h').forces['sietch_tabr:14'], 2);
assert.equal(p(g, 'bg').forces['sietch_tabr:14'], 2);
assert.equal(p(g, 'ec').forces['carthag:11'], 1);
assert.equal(fighterCount(p(g, 'bg'), 'sietch_tabr'), 0);
assert.equal(p(g, 'ec').forces['red_chasm:7'], 1);
inventory(g); assert.deepEqual(normalizeAutomaticGame(reload(g)), reload(g));
assert.throws(() => applyAction(g, 'a', { type: 'decision', event, destination: 'arrakeen:10' }));
assert.throws(() => applyAction(g, 'ec', { type: 'decision', event: parent, trigger: true, beneficiary: 'h' }));
});
void test('the Battle-phase Guild child can send Spiritual Advisors to Polar and complete their automatic fighter conversion', () => {
let g = open(6, true);
const event = g.homeworldVictoryReinforcement!.event, parent = g.pendingAmbassador!.event;
g = applyAction(g, 'ec', { type: 'decision', event: parent, trigger: true, beneficiary: 'h' });
g = applyAction(g, 'h', { type: 'decision', event: parent, amount: 2, territory: 'sietch_tabr', sector: 14 });
g = applyAction(g, 'bg', { type: 'decision', accept: false });
g = applyAction(g, 'bg', { type: 'decision', accept: true, accompany: false });
assert.equal(g.pendingSpiritualAdvisor!.source!.phase, 6);
assert.equal(g.pendingSpiritualAdvisor!.source!.territory, 'polar_sink');
g = allow(g);
assert.equal(p(g, 'bg').forces['polar_sink:0'], 1);
assert.equal(fighterCount(p(g, 'bg'), 'polar_sink'), 1);
assert.equal(p(g, 'bg').forces['sietch_tabr:14'], 1);
assert.equal(fighterCount(p(g, 'bg'), 'sietch_tabr'), 1);
assert.equal(g.pendingSpiritualAdvisor ?? null, null);
assert.equal(g.pendingAmbassador, null);
assert.equal(g.homeworldVictoryReinforcement!.event, event);
assert.equal(g.homeworldVictoryReinforcement!.stage, 'complete');
assert.deepEqual(g.homeworldVictoryReinforcement!.ambassadors!.map(entry => entry.completed), [true]);
inventory(g);
assert.deepEqual(normalizeAutomaticGame(reload(g)), reload(g));
for (const action of [
{ type: 'decision', event, destination: 'arrakeen:10' },
{
type: 'decision',
event: child,
forces: { 'red_chasm:7': 1 },
territory: 'carthag',
sector: 11,
},
])
assert.throws(() => applyAction(g, 'a', action));
});
void test('a real victory arrival cannot lose its child, source tag or independent original obligation during recovery', () => {