Check Advanced victory after Mentat actions
Verify and publish checkpoint container / container (push) Successful in 10m42s

This commit is contained in:
Quintine committed 2026-10-29 09:15:34 +11:00
1 parent c608d6fea6
commit 64706cc7e0
12 files changed
+339 -27

No files matched your search

+18 -5
View File
@@ -1497,6 +1497,8 @@ export type Game = {
/** Agreed addition to the ordinary stronghold win targets. Older games omit it. */
victoryExtraStrongholds?: number;
victoryContinuation?: VictoryContinuation | null;
/** Fresh Advanced non-CHOAM Mentat phases check victory after their opportunities. */
mentatVictoryAfterActions?: number;
charityPromises?: CharityPromise[];
revivalOrder?: RevivalOrder;
charityOrder?: CharityOrder;
@@ -13862,7 +13864,7 @@ function finishMoritaniPlacement(g: Game) {
return;
}
requireRule(!obligation, 'Finish the pending Extortion payments first.');
if (!byFaction(g, 'choam')) victory(g);
if (!byFaction(g, 'choam') && g.mentatVictoryAfterActions !== g.turn) victory(g);
}
function finishSetup(g: Game) {
const tleilaxu = byFaction(g, 'tleilaxu');
@@ -30338,6 +30340,10 @@ function advancePhase(g: Game) {
g.decision = { kind: 'choamMentat', player: choam.id };
return;
}
if (g.phase === 8 && g.mentatVictoryAfterActions === g.turn) {
victory(g, undefined, 'advance');
if (g.status !== 'playing' || g.victoryContinuation) return;
}
const ecaz = byFaction(g, 'ecaz');
if (g.phase === 4 && ecaz && g.ecazPlacementTurn !== g.turn) {
g.ecazAmbassadors ??= createAmbassadors(random);
@@ -30388,7 +30394,10 @@ function completePhase(g: Game) {
}
if (g.phase === 8)
requireRule(!g.moritaniExtortion, 'Settle Extortion before ending the turn.');
if (g.phase === 8) settleStrongholdOwnership(g);
if (g.phase === 8) {
settleStrongholdOwnership(g);
delete g.mentatVictoryAfterActions;
}
g.phase++;
if (g.phase === 9) {
if (g.dukeVidal) g.dukeVidal = expireDuke(g.dukeVidal, g.turn);
@@ -30556,6 +30565,7 @@ function beginPhase(g: Game) {
collect(g);
}
if (g.phase === 8) {
if (g.advanced && !byFaction(g, 'choam')) g.mentatVictoryAfterActions = g.turn;
collectBankerIncome(g);
drawHarkonnenNexusBetrayalReplacement(g);
replaceMoritaniAssassinationTraitors(g);
@@ -37585,9 +37595,12 @@ function currentPlacementCancellationQuote(g: Game, response: ResponseWindow) {
),
);
} else if (receipt.kind === 'moritaniPlacement') {
// Mentat opening income is already settled. CHOAM retains its own later
// market/Mentat choice; otherwise this receipt reaches victory now.
if (!byFaction(g, 'choam')) finalVictory = currentVictoryQuote(g);
// Fresh Advanced Mentat phases and CHOAM retain their later victory check.
// Older unstamped phases keep their original opening-time check.
if (!byFaction(g, 'choam')) {
const quote = currentVictoryQuote(g);
if (g.mentatVictoryAfterActions !== g.turn) finalVictory = quote;
}
} else if (!byFaction(g, 'choam')) {
const resources = currentPhaseResources(g);
if (!g.expansions.includes('ix')) {