Preserve revealed traitor income and No-Field timing
Verify and publish checkpoint container / container (push) Successful in 11m12s
Verify and publish checkpoint container / container (push) Successful in 11m12s
This commit is contained in:
1 parent
a2e7029a72
commit
e81725e4b2
12 files changed
+497
-4
No files matched your search
@@ -152,6 +152,9 @@ export type BattleResolutionInput = {
|
||||
called: boolean;
|
||||
traitors: readonly string[];
|
||||
}[];
|
||||
/** Engine-derived same-battle Nexus receipt: a publicly revealed Harkonnen
|
||||
* Traitor was canceled after declaration, even though its vote is now false. */
|
||||
nexusCanceledTraitorRevealed?: true;
|
||||
participants: readonly ResolutionParticipant[];
|
||||
/** Live physical zones only, excluding historical receipts and knowledge aliases. */
|
||||
physicalCards: readonly { id: string }[];
|
||||
@@ -373,6 +376,7 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
|
||||
d = input.defender;
|
||||
requireQuote(
|
||||
typeof input.advanced === 'boolean' &&
|
||||
(input.nexusCanceledTraitorRevealed === undefined || input.nexusCanceledTraitorRevealed === true) &&
|
||||
whole(input.turn) &&
|
||||
input.turn > 0 &&
|
||||
id(input.territory) &&
|
||||
@@ -677,7 +681,7 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
|
||||
// CHOAM's prepaid ally contribution is excluded from this receipt. The
|
||||
// adopted Advanced source rounds once after totaling the eligible support.
|
||||
const choamAmount =
|
||||
input.advanced && choam && !ac && !dc
|
||||
input.advanced && choam && !ac && !dc && !input.nexusCanceledTraitorRevealed
|
||||
? Math.floor(
|
||||
[a, d].reduce(
|
||||
(sum, s) =>
|
||||
|
||||
@@ -36533,6 +36533,8 @@ function currentBattleResolutionInput(g: Game, canceledVoter?: string): BattleRe
|
||||
called: id === canceledVoter ? false : b.traitorCalls[id],
|
||||
traitors: b.traitorDeclarations?.[id] ? [b.traitorDeclarations[id].identity] : getPlayer(g, id).traitors,
|
||||
})),
|
||||
...(g.nexusHarkonnenBetrayalHistory?.some(r => r.outcome === 'use' && r.source.battle.event === b.event)
|
||||
? { nexusCanceledTraitorRevealed: true as const } : {}),
|
||||
participants: g.players.map((p) => ({
|
||||
id: p.id,
|
||||
faction: p.faction,
|
||||
|
||||
+3
-2
@@ -1143,6 +1143,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
'In supported Basic games the voluntary reveal can also occur while CHOAM decides whether to prevent an already-declared free Revival. Reveal uses current reserves; the original Revival and CHOAM decision then continue once.',
|
||||
'In supported Basic auctions, reveal can also occur during the Emperor’s allied gift opportunity or its response. The original lot, pledged funds and gift continue unchanged.',
|
||||
'In supported Basic native games, voluntary revelation is also available during an Ix phase opening or selected auction and market decisions without replacing that decision. Other interruption windows remain unfinished.',
|
||||
'Those supported interruption windows also admit original Tech Tokens and Advanced Stronghold Cards when their selected roster and physical module states are valid. Their existing owners and the interrupted decision remain unchanged; revealing a zero marker can still remove its board presence.',
|
||||
'In supported Basic games, your voluntary reveal can also interrupt a clean Emperor allied spice gift or extra-revival response, Tleilaxu revival-income response, Atreides Movement-phase Spice forecast without Bene Gesserit, or Guild’s own ordinary reserve-shipment rate response when the shipment enters a different territory from the marker. If Richese receives the extra revival, reveal from current reserves before that return. The original response and payment continue once; other interruptions remain guarded.',
|
||||
'An active public agreement does not by itself prevent a supported reveal. Existing current-turn travel and other binding commitments still retain their separate safeguards, and a reveal does not settle or cancel a payment.',
|
||||
'During supported Basic or Advanced games you can also reveal while another faction’s ordinary movement waits for a Fremen or Ixian response or a CHOAM decision. The original move and its response remain pending; a zero No-Field disappears without creating physical forces. A supported Advanced Bene Gesserit arrival at the CHOAM-occupied destination retains its declared stance.',
|
||||
@@ -4983,7 +4984,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
'A Karama response can prevent allied funding for the current battle. Reserved spice stays with the pledge, but the ally must plan with its own funds. Later battles get a fresh response and may use the remaining pledge.',
|
||||
'When sealing a plan, choose total spice support and optionally CHOAM’s share. With no explicit share, your own spice is used first and the pledge covers the shortfall. The chosen amounts remain reserved until resolution; CHOAM cannot withdraw a committed share. Unspent pledged spice returns at the end of Battle, after the closing market.',
|
||||
'When other factions support battle forces, add the eligible support from both sides, then halve the total and round down once. Payments of three and five produce four spice for CHOAM. Retain the Arrakeen Bank contribution, while excluding CHOAM’s own support and the spice it supplies for its ally. Free-supported forces and separate battle-strength spending add no support spice.',
|
||||
'Any revealed traitor prevents all CHOAM force-payment income from that battle. A sole traitor winner pays no support, including its pledged allied share. If both sides reveal traitors, both pay their support but CHOAM still gets no income. A lasgun–shield explosion without a traitor still pays support and generates income.',
|
||||
'Any revealed traitor prevents all CHOAM force-payment income from that battle. Under the provisional combined interpretation, this also applies when Harkonnen Nexus cancels the publicly revealed traitor’s battle effect. A sole traitor winner pays no support, including its pledged allied share. If both sides reveal traitors, both pay their support but CHOAM still gets no income. A lasgun–shield explosion without a traitor still pays support and generates income.',
|
||||
'After casualty and winner-card choices, a separate Karama response precedes CHOAM’s income. Cancellation sends the amount to the bank and does not refund the combatants. Complete the response before post-battle technology, capture and Face Dancer rewards continue.',
|
||||
'Pledges and unrevealed payment splits stay private to their authorized viewers. Battle guides and all four AI levels account for reserved allied funds when finding legal plans. The precise ordering with later expansion powers, wider allied-payment compositions and the alliance cancellation window remain under final audit. CHOAM starts remain previews; complete faction and combination acceptance is unfinished.',
|
||||
],
|
||||
@@ -5000,7 +5001,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
{ area: 'Player controls', status: 'Partial', detail: 'Existing funding, plan and cancellation controls retain automatic uncontested income; no extra collection confirmation.', evidence: ['components/choam-battle-funding.tsx', 'components/game-table.tsx'] },
|
||||
{ area: 'AI', status: 'Partial', detail: 'Existing minimal policies use shared resolution and payment rules; strategy/calibration remain deferred.', evidence: ['game/bots.ts', 'tests/choam-combat.test.ts'] },
|
||||
{ area: 'Documentation', status: 'Partial', detail: 'Adopted total-rounding source and unchanged native eligible support are explicit.', evidence: ['docs/CHOAM_SUPPORT_INCOME.md'] },
|
||||
{ area: 'Verification', status: 'Partial', detail: 'Focused quote/payment regressions cover odd support sums and existing exclusions; full modes, wider compositions and deployed acceptance remain.', evidence: ['tests/battle-resolution-quote.test.ts', 'tests/choam-combat.test.ts'] },
|
||||
{ area: 'Verification', status: 'Partial', detail: 'Focused quote/payment regressions cover odd support sums and exclusions; native Harkonnen Nexus cancellation and no-reveal controls retain actual battle payments. Full modes, wider compositions and deployed acceptance remain.', evidence: ['tests/battle-resolution-quote.test.ts', 'tests/choam-combat.test.ts', 'tests/choam-nexus-traitor-income-quote.test.ts', 'tests/choam-nexus-canceled-income-runtime.test.ts'] },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,14 +1,49 @@
|
||||
import type { Game } from './engine';
|
||||
import { selectedPhaseModuleRoster } from './faction-module-profile';
|
||||
import { validateFremenRevivalGrant } from './fremen-revival-grant';
|
||||
import { richeseRevealForeignMovementPending } from './richese-reveal-foreign-movement';
|
||||
import { eliteRevivalRemaining, paidForceRevivalCost, revivalPrevented } from './revival';
|
||||
import { quoteRevivalResume, RevivalResumeError } from './revival-resume';
|
||||
import { STRONGHOLD_CARDS } from './stronghold-cards';
|
||||
import { TECH_TOKENS } from './tech-tokens';
|
||||
|
||||
const factions = new Set([
|
||||
'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen',
|
||||
'richese', 'choam', 'ixians', 'tleilaxu', 'ecaz', 'moritani',
|
||||
]);
|
||||
|
||||
/** Selected original phase modules do not spend reserves or add an arrival
|
||||
* when a marker already on the board is voluntarily materialized. Keep their
|
||||
* actual current custody intact rather than accepting a fabricated module. */
|
||||
function phaseModulesSupported(g: Game): boolean {
|
||||
if (!g.techTokens && !g.strongholdCards) return true;
|
||||
if (typeof g.advanced !== 'boolean' || !selectedPhaseModuleRoster(g) ||
|
||||
(g.techTokens && g.players.length < 3) || (g.strongholdCards && !g.advanced)) return false;
|
||||
const owner = (id: unknown) => id === null ||
|
||||
typeof id === 'string' && g.players.some(player => player.id === id);
|
||||
if (g.techTokens) {
|
||||
const tokens = g.techTokens;
|
||||
if (typeof tokens !== 'object' || Array.isArray(tokens) ||
|
||||
Object.keys(tokens).length !== TECH_TOKENS.length ||
|
||||
TECH_TOKENS.some(({id}) => {
|
||||
const token = tokens[id];
|
||||
return !token || typeof token !== 'object' || Array.isArray(token) ||
|
||||
!owner(token.owner) || !Number.isSafeInteger(token.spice) || token.spice < 0 ||
|
||||
(token.triggeredTurn !== undefined && (!Number.isSafeInteger(token.triggeredTurn) ||
|
||||
token.triggeredTurn < 1 || token.triggeredTurn > g.turn));
|
||||
})) return false;
|
||||
}
|
||||
if (g.strongholdCards) {
|
||||
const cards = g.strongholdCards;
|
||||
if (typeof cards !== 'object' || Array.isArray(cards) ||
|
||||
!Number.isSafeInteger(cards.claimedTurn) || cards.claimedTurn < 0 || cards.claimedTurn > g.turn ||
|
||||
!cards.owners || typeof cards.owners !== 'object' || Array.isArray(cards.owners) ||
|
||||
Object.keys(cards.owners).length !== STRONGHOLD_CARDS.length ||
|
||||
STRONGHOLD_CARDS.some(({id}) => !owner(cards.owners[id]))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** A deliberately bounded admission for an existing before-Battle parent.
|
||||
* This does not authorize a seat, marker or event, and does not mutate the
|
||||
* game. The normal No-Field action and view own those checks. */
|
||||
@@ -21,12 +56,13 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
||||
!Array.isArray(g.players) || !g.players.every(player => factions.has(player.faction)) ||
|
||||
g.players.some(player => (player.faction === 'ixians' || player.faction === 'tleilaxu') && !g.expansions.includes('ix')) ||
|
||||
g.players.some(player => (player.faction === 'ecaz' || player.faction === 'moritani') && !g.expansions.includes('ecaz')) ||
|
||||
g.coalitionState || g.coalitionPreview || g.techTokens || g.strongholdCards || g.leaderSkills ||
|
||||
g.coalitionState || g.coalitionPreview || g.leaderSkills ||
|
||||
g.homeworlds || g.nexusCards || g.discoveryEnabled || g.discoveries || g.discoveryStash ||
|
||||
g.greatMaker || g.ecazTreachery || g.truthtrance ||
|
||||
g.biddingEnd || g.battle || g.stormResolution || g.spiceResolution || g.spiceSequence ||
|
||||
g.victoryContinuation || g.currentAuctionSale || g.richeseAllyOffer ||
|
||||
g.bureaucratPayments?.pending) return false;
|
||||
if (!phaseModulesSupported(g)) return false;
|
||||
|
||||
// A mixed Truthtrance answer can create a private residual only for some
|
||||
// hidden facts. Fence non-fact questions uniformly before examining those
|
||||
|
||||
Reference in new issue
Block a user