Implement the five 7 October pending rule rulings

The user answered five recorded questions; each ruling is indexed in
RULE_DECISIONS.md and implemented with a focused regression.

- CHOAM opening income counts as a qualifying collection, so low-population
  Tupile adds its bank increment under the Inflation multiplier. The engine
  guard is removed and the projection/notice expose the added bonus.
- An exhausted Richese cache is legal and restores one ordinary lot; the
  canceled/prevented compulsory cache auction branch restores the reduction
  before the ordinary pool runs and the cache offer is skipped when no cache
  lot can run. The pure continuation quote mirrors the count.
- Suk-rescued casualties count toward Advanced Atreides' seven Kwisatz
  Haderach losses: the battle-loss counter gains the full dialed allocation in
  both rescue paths, and the earlier Suk availability restriction is removed.
- The Guild Nexus Secret Ally reserve return overrides the Arrakis-to-native-
  Homeworld restriction for the holder's own reserves and deposits through the
  shared native-reserve pipeline (generalized from the revival deposit).
- Interior passengers count as entering the territories a relocated Ixian HMS
  points into, so Sandmaster collects there before the native collection.

Full offline suite 7804/7804, types and lint pass. Historical evidence and
superseded test expectations are updated to the ruled behaviour; preserved
combined Homeworld/Nexus, occupation and Richese captures are unblocked but
not re-run here. No existing game, seat or saved state was changed.
This commit is contained in:
Quintine committed 2026-10-07 21:56:17 +11:00
1 parent e0101a937b
commit 7e3bec2721
41 files changed
+525 -234

No files matched your search

@@ -16,6 +16,9 @@ import {
nexusGuildSecretAllianceFixture,
} from './fixture-nexus-guild-secret-ally';
import { nexusAllow } from './fixture-nexus-cards';
import { homeworldContext } from '../game/homeworld-game';
import { quoteNativeReserveWithdrawal } from '../game/homeworld-native-reserves';
import { observeHomeworldOccupation } from '../game/homeworld-occupation-history';
function rejected(g: Game, owner: string, action: Action) {
const before = structuredClone(g);
assert.throws(() => applyAction(g, owner, action));
@@ -304,3 +307,53 @@ void test('a genuine Moritani arrival alliance preserves completed Guild Secret
assert.notEqual(g.active, f.owner);
stable(g);
});
void test('Guild Secret Ally returns typed counters to the holder own native Homeworld reserves under Homeworlds', () => {
const f = nexusGuildSecretAllyFixture({
ownerFaction: 'emperor',
advanced: true,
homeworlds: true,
});
const p = f.g.players[0];
// Withdraw the staged board group through the real native-reserve pipeline so
// Homeworld custody stays conserved; the Emperor splits normal/Sardaukar.
const withdrawal = quoteNativeReserveWithdrawal(
homeworldContext(f.g),
f.g.homeworlds!.custody!,
p.id,
{ normal: 3, elite: 2 },
);
const seat = withdrawal.players.find((s) => s.id === p.id)!;
p.reserves = seat.reserves;
p.elites!.reserves = seat.eliteReserves;
f.g.homeworlds!.custody = withdrawal.state;
// Mirror the engine's observeOccupation so the qualification history stays
// consistent with the staged custody change.
if (f.g.homeworlds!.historyVersion === 1 && f.g.homeworldOccupationHistory)
f.g.homeworldOccupationHistory = observeHomeworldOccupation(
f.g.homeworldOccupationHistory,
homeworldContext(f.g),
f.g.homeworlds!.custody!,
f.g.turn,
'change',
`homeworld-change-${f.g.homeworldOccupationHistory.sources[0].event}-${f.g.homeworldOccupationHistory.sources.length}`,
);
p.forces['arrakeen:10'] = 5;
p.elites!.forces['arrakeen:10'] = 2;
stable(f.g);
const action = nexusGuildSecretAllyRequest(f.g, f.owner, {
type: 'guildShip',
from: 'arrakeen:10',
territory: 'reserves',
sector: 0,
amount: 5,
elite: 2,
});
const g = applyAction(f.g, f.owner, action);
assert.equal(g.players[0].spice, 17);
assert.equal(g.players[0].reserves, 20);
assert.equal(g.players[0].elites!.reserves, 5);
assert.equal(g.players[0].forces['arrakeen:10'], undefined);
rejected(g, f.owner, action);
stable(g);
});