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.
106 lines
3.3 KiB
TypeScript
106 lines
3.3 KiB
TypeScript
import type { Action, GameView } from './engine';
|
|
import { gameTerritories, MOBILE_STRONGHOLD } from './board';
|
|
import { quoteNexusGuildSecretShipment } from './nexus-guild-secret-ally';
|
|
|
|
/** Consume only the current actor's private offer and public faction roster. */
|
|
export function nexusGuildSecretAllyCanAct(g: GameView): boolean {
|
|
const me = g.players.find((p) => p.id === g.me);
|
|
if (
|
|
!me ||
|
|
me.ally ||
|
|
g.nexusCards?.card !== 'guild' ||
|
|
g.players.some((p) => p.faction === 'guild')
|
|
)
|
|
return false;
|
|
const offer = g.nexusGuildSecretAlly;
|
|
return !!(
|
|
offer &&
|
|
!offer.blocked &&
|
|
offer.event === JSON.stringify(['nexusGuildSecretAlly', g.turn, g.me]) &&
|
|
g.status === 'playing' &&
|
|
g.phase === 5 &&
|
|
g.active === g.me &&
|
|
!me.shipped &&
|
|
!g.response &&
|
|
!g.decision &&
|
|
!g.truthtrance &&
|
|
!g.phaseOpening &&
|
|
!g.automaticContinuationPending &&
|
|
!g.nexusCards.waiting.length &&
|
|
!g.nexusTraitors?.pending
|
|
);
|
|
}
|
|
|
|
/** Price is independent of native faction; route permission is still separate. */
|
|
export function nexusGuildSecretAllyQuote(
|
|
g: GameView,
|
|
destination: string,
|
|
amount: number,
|
|
) {
|
|
if (
|
|
!nexusGuildSecretAllyCanAct(g) ||
|
|
!Number.isSafeInteger(amount) ||
|
|
amount < 1 ||
|
|
amount > 20
|
|
)
|
|
return null;
|
|
const me = g.players.find((p) => p.id === g.me)!;
|
|
if (destination === 'reserves') {
|
|
// User ruling 7 October 2026: the Secret Ally return grant overrides the
|
|
// Arrakis-to-native-Homeworld restriction for the holder's own reserves.
|
|
return quoteNexusGuildSecretShipment('reserves', amount);
|
|
}
|
|
const world = g.homeworlds?.worlds?.find((w) => w.id === destination);
|
|
if (world) {
|
|
if (world.native === me.id || world.native === me.ally) return null;
|
|
return quoteNexusGuildSecretShipment('homeworld', amount);
|
|
}
|
|
const to = gameTerritories(g).find((t) => t.id === destination);
|
|
if (!to || (destination === MOBILE_STRONGHOLD && me.faction !== 'ixians'))
|
|
return null;
|
|
return quoteNexusGuildSecretShipment(to.type, amount);
|
|
}
|
|
|
|
/** Add a selected source, never infer card use just from possession. */
|
|
export function nexusGuildSecretAllyAction(
|
|
g: GameView,
|
|
event: string,
|
|
action: Action,
|
|
): Action | null {
|
|
if (
|
|
!nexusGuildSecretAllyCanAct(g) ||
|
|
event !== g.nexusGuildSecretAlly!.event ||
|
|
!['ship', 'guildShip', 'homeworldShip'].includes(action.type) ||
|
|
action.nexus !== undefined ||
|
|
action.noField !== undefined ||
|
|
(action.type === 'guildShip' && action.from === 'reserves')
|
|
)
|
|
return null;
|
|
const amount =
|
|
action.type === 'homeworldShip'
|
|
? Object.values(
|
|
(action.sources ?? {}) as Record<
|
|
string,
|
|
{ normal: number; elite: number }
|
|
>,
|
|
).reduce((n, p) => n + p.normal + p.elite, 0)
|
|
: action.forces
|
|
? Object.values(action.forces as Record<string, number>).reduce(
|
|
(n, p) => n + p,
|
|
0,
|
|
)
|
|
: Number(action.amount);
|
|
const destination = String(
|
|
action.type === 'homeworldShip' ? action.destination : action.territory,
|
|
);
|
|
if (!nexusGuildSecretAllyQuote(g, destination, amount)) return null;
|
|
const me = g.players.find((p) => p.id === g.me)!;
|
|
if (
|
|
action.type === 'ship' &&
|
|
(amount > me.reserves ||
|
|
!gameTerritories(g).some((t) => t.id === destination))
|
|
)
|
|
return null;
|
|
return { ...action, nexus: event };
|
|
}
|