Support Advanced expansion auction gifts
Verify and publish checkpoint container / container (push) Successful in 11m23s

This commit is contained in:
Quintine committed 2026-11-16 18:28:19 +11:00
1 parent 51c48e371b
commit 28700389dc
14 files changed
+840 -15

No files matched your search

+1 -1
View File
@@ -4391,7 +4391,7 @@ export function botActions(g: GameView): Action[] {
return (me?.bot || me?.autopilot) && g.status === 'playing' &&
!g.roomControl?.paused && !g.roomControl?.closed && !g.automaticContinuationPending &&
g.emperorAuctionGift
? [{type: 'emperorAuctionGiftContinue', event: g.emperorAuctionGift.event}] : [];
? [g.pledgePromiseGuide?.action ?? {type: 'emperorAuctionGiftContinue', event: g.emperorAuctionGift.event}] : [];
}
if (g.victoryContinuation)
return g.status === 'playing' && !g.roomControl?.paused && !g.roomControl?.closed && !g.automaticContinuationPending
+50 -9
View File
@@ -10248,6 +10248,8 @@ function semutaOfferSupported(
continuation.kind === 'battleCleanup' && continuation.source === 'winner' ||
continuation.kind === 'nullentropyDiscard' || continuation.kind === 'distransDiscard' ||
continuation.kind === 'residualPoisonDiscard' || continuation.kind === 'choamSaleDiscard' ||
continuation.kind === 'karamaEmperorShareDiscard' &&
emperorAuctionGiftResumeMatches(g, continuation.use.response, continuation.resume.decision) ||
((continuation.kind === 'choamKulonDiscard' || continuation.kind === 'choamLaLaLaDiscard' ||
continuation.kind === 'choamBalisetDiscard' || continuation.kind === 'choamGamontDiscard' ||
continuation.kind === 'choamJubbaDiscard') && continuation.nexusEvent === undefined) ||
@@ -17136,10 +17138,12 @@ function reconcilePledgeCommitments(g: Game, voluntary?: {actor: string; action:
}));
}
function projectedPledgeGuide(g: Game, player: Player): {action: Action} | null {
if (!pledgeQuestionWindow(g) || g.truthtrance || !livePledgePromises(g.pledgePromises ?? [], player.id, g.turn, g.phase)
const auctionGift = g.pendingEmperorAuctionGift?.owner === player.id && !g.response && !g.pendingKarama && !g.pendingKull;
if ((!pledgeQuestionWindow(g) && !auctionGift) || g.truthtrance || !livePledgePromises(g.pledgePromises ?? [], player.id, g.turn, g.phase)
.some(row => row.answer)) return null;
const action = pledgeCompletion(g, player);
return action ? {action} : null;
return action ? {action:auctionGift
? {...action, emperorAuctionGiftEvent:g.pendingEmperorAuctionGift!.event} : action} : null;
}
function alliancePromiseRule<T>(calculate: () => T): T {
try { return calculate(); }
@@ -19237,9 +19241,9 @@ function emperorAuctionGiftSignature(g: Game): string {
return JSON.stringify([g.turn, g.phase, g.active, g.decision ?? emperorAuctionGiftParked(g)?.decision, g.order, g.auction, g.aid]);
}
function beginEmperorRicheseAuctionGift(g: Game, quote: Extract<RicheseSettlementQuote,{kind:'sold'}>, bank = false): boolean {
if (g.advanced || g.status !== 'playing' || g.phase !== 3 || g.richeseAuction?.source !== 'cache' ||
if (g.status !== 'playing' || g.phase !== 3 || g.richeseAuction?.source !== 'cache' ||
g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds ||
g.discoveryEnabled || g.coalitionState || g.ecazTreachery ||
(g.advanced && g.nexusCards) || g.discoveryEnabled || g.coalitionState || g.ecazTreachery ||
g.pendingEmperorAuctionGift || g.response || g.decision || g.phaseOpening || g.truthtrance ||
g.pendingKarama || g.pendingTreacheryDiscard || g.pendingRicheseGift || g.pendingNullentropy ||
g.pendingRicheseBetrayal || g.pendingNexusEmperorSellerPurchase ||
@@ -19255,10 +19259,10 @@ function beginEmperorRicheseAuctionGift(g: Game, quote: Extract<RicheseSettlemen
* Only auctionNext creates it: a restored payment never reopens the offer. */
function beginEmperorAuctionGift(g: Game) {
if (g.status !== 'playing' || g.phase !== 3 ||
(g.advanced ? g.expansions.length !== 0 || g.players.some(seat => !['atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen'].includes(seat.faction))
: g.expansions.length > 0 && !selectedPhaseModuleRoster(g)) ||
(g.expansions.length > 0 ? !selectedPhaseModuleRoster(g) :
g.advanced && g.players.some(seat => !['atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen'].includes(seat.faction))) ||
g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds || (g.advanced && g.nexusCards) ||
g.discoveryEnabled || (g.advanced && g.sandtrout) || g.coalitionState || g.pendingEmperorAuctionGift ||
g.discoveryEnabled || g.coalitionState || g.pendingEmperorAuctionGift ||
g.response || g.phaseOpening || g.truthtrance || g.pendingKarama ||
g.pendingTreacheryDiscard || g.pendingRicheseGift || g.pendingNullentropy ||
g.currentAuctionSale || g.richeseAuction || g.ixAuction ||
@@ -19317,7 +19321,23 @@ function emperorAuctionGiftMaximum(g: Game, p: Player): number {
liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [], p.id, g.turn).some(row => row.answer) ||
liveTurnActionPromises(g.turnActionPromises ?? [], p.id, g.turn).length ||
livePhaseBidPromises(g.phaseBidPromises ?? [], p.id, g.turn).some(row => row.answer)) return 0;
return Math.max(0, uncommittedSpice(g, p));
const maximum = Math.max(0, uncommittedSpice(g, p));
if (!livePledgePromises(g.pledgePromises ?? [], p.id, g.turn, g.phase).some(row => row.answer)) return maximum;
// The owner can fulfill the native update within this opportunity, before
// the sale consumes its locked aid or the Bidding phase can end.
const trial = structuredClone(g);
const canSpend = (amount: number) => {
const sample = structuredClone(trial), player = getPlayer(sample, p.id);
player.spice -= amount;
return !!pledgeCompletion(sample, player);
};
if (!canSpend(0)) return 0;
let low = 0, high = maximum;
while (low < high) {
const mid = low + Math.ceil((high - low) / 2);
if (canSpend(mid)) low = mid; else high = mid - 1;
}
return low;
}
function settleAuction(g: Game, free = false, automatic = false, emperorNexus = false) {
const a = g.auction!;
@@ -21087,7 +21107,10 @@ function spendKarama(g: Game, p: Player, card: Card, use: KaramaUse, kullOffered
stageTreacheryDiscard(g, 'karama:kullCounter', [{card:used, discardedBy:p.id, publicFace:true}], continuation);
return;
}
const semutaRoleCost = semutaCardProducerEnabled(g) && semutaKaramaRoleCost(g, p.id, card);
const advancedAuctionGiftCost = g.semutaAdvancedOrdinaryPreview === true && bareAdvancedClassicSemutaProfile(g) &&
use.kind === 'cancel' && use.response.kind === 'emperorGift' &&
emperorAuctionGiftResumeMatches(g, use.response, g.decision);
const semutaRoleCost = (semutaCardProducerEnabled(g) || advancedAuctionGiftCost) && semutaKaramaRoleCost(g, p.id, card);
const guildShipmentDiscard = semutaRoleCost &&
use.kind === 'cancel' && semutaGuildShipmentKaramaResponse(g, use.response);
const bgConversionCancelDiscard = semutaRoleCost &&
@@ -43886,6 +43909,10 @@ export function applyAction(state: Game, id: string, action: Action): Game {
* automatic deal payment; it is never supplied by a client action. */
function applyActionWithInitiator(state: Game, id: string, action: Action, initiator: string,
options?: {insolventDealPayment?: boolean;publicDealSettlement?:string}): Game {
if (action?.emperorAuctionGiftEvent !== undefined)
requireRule(action.type === 'pledgeAid' && state.pendingEmperorAuctionGift?.owner === id &&
state.pendingEmperorAuctionGift.event === action.emperorAuctionGiftEvent,
'This auction funding guide is no longer current.');
emperorPhaseOpeningGiftIntegrity(state);
emperorExtortionGiftIntegrity(state);
emperorAuctionGiftIntegrity(state);
@@ -45179,9 +45206,23 @@ function applyActionInner(
const pending = g.pendingEmperorAuctionGift;
if (t === 'advanceBots') return g;
requireRule(id === pending.owner, 'Wait for the Emperor to finish the allied gift opportunity.');
if (t === 'pledgeAid') {
requireRule((Object.keys(action).sort().join(',') === 'amount,type' ||
Object.keys(action).sort().join(',') === 'amount,emperorAuctionGiftEvent,type' &&
action.emperorAuctionGiftEvent === pending.event) &&
livePledgePromises(g.pledgePromises ?? [], id, g.turn, g.phase).some(row => row.answer),
'Only your current Truthtrance funding update is available during this opportunity.');
pledgeAid(g, p, action.amount);
g.pledgePromises = pledgeRule(() => recordPromisedPledge(
g.pledgePromises!, p.id, g.turn, g.phase, {ally:p.ally!, amount:action.amount as number}));
pending.signature = emperorAuctionGiftSignature(g);
return g;
}
if (t === 'emperorAuctionGiftContinue') {
requireRule(Object.keys(action).sort().join(',') === 'event,type' && action.event === pending.event,
'This Emperor auction opportunity is no longer current.');
requireRule(!livePledgePromises(g.pledgePromises ?? [], id, g.turn, g.phase).some(row => row.answer),
'Set your promised ally funding before this purchase can close Bidding.');
g.pendingEmperorAuctionGift = null;
if (pending.source === 'richese') {
requireRule(pending.quote, 'The Richese auction gift lost its committed sale.');
+1
View File
@@ -298,6 +298,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'The recipient keeps paid spice separately until the next Mentat opening. A payment after the current opening waits for next turn’s opening. Your incoming bribes are shown separately from your spendable supply; they cannot fund bids, shipments or another bribe yet.',
'A waiting Sandtrout does not prevent the supported Basic bribe interruption windows.',
'During supported Basic phase openings, auction payments, Richese cache sales and Extortion decisions, a waiting Sandtrout does not prevent the Emperor gifting spice to an ally formed after the Sandtrout draw.',
'In supported Advanced selected-deck auctions, the Emperor may gift spice before an allied ordinary purchase or Richese cache sale. The original split remains: direct gifts are the buyer’s spice, while the Emperor’s pledged share goes to the bank. A promised funding update can be completed before continuing.',
'In supported classic Advanced games, the Emperor may share spice before a pending Guild shipment-rate response continues. Allowing or canceling the gift returns to the same rate decision and shipment.',
'You may pay out of turn when no decision or response is pending, including during Mentat after opening collection. In supported Basic games with classic or selected native expansion factions, direct bribes can also interrupt a normal auction-payment decision, Atreides auction inspection, Fremen allied-revival grant, ordinary Fremen or Ixian movement response, or CHOAM movement decision. Supported Basic Ix and Moritani games also allow payments during the Amal opening or an Extortion choice. The original parent and its passes remain pending. You cannot bribe yourself or your ally, or while Inflation shows Double. Emperor gifts to allies use their own power controls.',
'Your payment limit excludes reserved spending and preserves binding Truthtrance answers. If an alliance, pending decision or available supply changes, recheck the recipient and amount. A rejected payment does not change the game.',