Support Advanced expansion auction gifts
Verify and publish checkpoint container / container (push) Successful in 11m23s
Verify and publish checkpoint container / container (push) Successful in 11m23s
This commit is contained in:
1 parent
51c48e371b
commit
28700389dc
14 files changed
+840
-15
No files matched your search
+50
-9
@@ -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.');
|
||||
|
||||
Reference in new issue
Block a user