Support Emperor gifts in Nexus Richese cache sales
Verify and publish checkpoint container / container (push) Successful in 11m37s
Verify and publish checkpoint container / container (push) Successful in 11m37s
This commit is contained in:
1 parent
eaaab566e2
commit
021a8c3e7f
11 files changed
+276
-20
No files matched your search
+31
-12
@@ -2129,6 +2129,8 @@ export type Game = {
|
||||
giftAmount?: number;
|
||||
source?: 'richese';
|
||||
quote?: Extract<RicheseSettlementQuote,{kind:'sold'}>;
|
||||
/** A previously allowed Richese Nexus diversion sends this sale to the bank. */
|
||||
bank?: true;
|
||||
} | null;
|
||||
richeseGiftBlocked?: { turn: number; phase: number; cards: string[] };
|
||||
richeseAllyOffer?: RicheseAllyOffer | null;
|
||||
@@ -13550,7 +13552,7 @@ export function initializeRicheseBetrayalGameForAudit(state: Game): Game {
|
||||
richeseBetrayalModeSupported(state) &&
|
||||
state.nexusCards?.cards === null && state.nexusCards.phase === null,
|
||||
'Richese Betrayal needs a fresh CHOAM/Richese lobby, the CHOAM deck and only Nexus Cards.');
|
||||
const g = initializeSetupGameForAudit(state, false, true, false, false, false, false, true);
|
||||
const g = initializeSetupGameForAudit(state, false, true, false, false, false, false, true, false, false, false, false);
|
||||
g.richeseBetrayalPreview = true;
|
||||
g.richeseBetrayal = {sequence:0,current:null,completed:[]};
|
||||
g.pendingRicheseBetrayal = null;
|
||||
@@ -13991,7 +13993,7 @@ export function initializeEcazTreacheryGameForAudit(state: Game): Game {
|
||||
if (moritaniAssassinateModeSupported(initialized)) initializeMoritaniAssassinateState(initialized);
|
||||
return initialized;
|
||||
}
|
||||
function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = false, ix = false, discovery = false, leaderSkills = false, choam = false, factions = false, ecazTreachery = false, strongholdFactions = false, semuta = false): Game {
|
||||
function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = false, ix = false, discovery = false, leaderSkills = false, choam = false, factions = false, ecazTreachery = false, strongholdFactions = false, semuta = false, nativeNexusReactions = true): Game {
|
||||
nexusCardsIntegrity(state);
|
||||
homeworldRule(() => homeworldGameIntegrity(state));
|
||||
homeworldBattleLossIntegrity(state);
|
||||
@@ -14066,7 +14068,7 @@ function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = f
|
||||
g.spiceBankerIncomePreview = true;
|
||||
g.spiceBankerIncome = bankerIncomeRule(() => createBankerIncomeState(bankerIncomeContext(g)));
|
||||
}
|
||||
if (nexusCoreProfile(g)) {
|
||||
if (nativeNexusReactions && nexusCoreProfile(g)) {
|
||||
requireRule(g.nexusIxianReplacementPreview === undefined &&
|
||||
g.nexusIxianReplacementHistory === undefined && g.nexusIxianReplacementCursor === undefined &&
|
||||
!g.pendingNexusIxianReplacement && !g.pendingNexusIxianSpecialPurchase &&
|
||||
@@ -15821,7 +15823,17 @@ function richeseBetrayalIntegrity(g: Game): void {
|
||||
completed.round === g.richeseBidding?.event &&
|
||||
!(completed.stage === 'used' && completed.invoice.kind === 'purchase'),
|
||||
'The completed Richese reaction lost its original source.');
|
||||
if (waiting) {
|
||||
const gift = g.pendingEmperorAuctionGift;
|
||||
if (gift?.source === 'richese') {
|
||||
requireRule(!sale && !waiting && (completed.invoice.kind === 'sale' || completed.stage === 'passed') &&
|
||||
gift.recipient === completed.invoice.buyer && gift.quote &&
|
||||
g.richeseAuction?.owner === completed.invoice.target &&
|
||||
gift.quote.amount === completed.invoice.price && gift.quote.ownPayment === completed.invoice.ownPayment &&
|
||||
gift.quote.allyPayment === completed.invoice.allyPayment &&
|
||||
JSON.stringify(gift.quote.card) === JSON.stringify(completed.invoice.card) &&
|
||||
(gift.bank === true) === (completed.stage === 'used'),
|
||||
'The completed Richese reaction lost its original gift and payment continuation.');
|
||||
} else if (waiting) {
|
||||
requireRule(!sale && waiting.round === completed.round && waiting.lot.event === completed.lot &&
|
||||
waiting.winner === completed.invoice.buyer && waiting.lot.owner === completed.invoice.target &&
|
||||
waiting.lot.source === completed.invoice.source && waiting.quote.amount === completed.invoice.price &&
|
||||
@@ -15962,6 +15974,7 @@ function decideRicheseBetrayal(g: Game, p: Player, action: Action): void {
|
||||
finishRicheseLot(g);
|
||||
} else {
|
||||
if (use) log(g,`${p.name} spent Richese Nexus Betrayal: the ${receipt.invoice.price}-spice Richese sale payment goes to the Spice Bank instead.`);
|
||||
if (beginEmperorRicheseAuctionGift(g,frame.quote,use)) return;
|
||||
settleRicheseSoldLot(g,frame.quote,use);
|
||||
}
|
||||
}
|
||||
@@ -18963,20 +18976,22 @@ function emperorAuctionGiftParked(g: Game) {
|
||||
function emperorAuctionGiftSignature(g: Game): string {
|
||||
if (g.pendingEmperorAuctionGift?.source === 'richese')
|
||||
return JSON.stringify(['richese',g.turn,g.phase,g.active,g.richeseAuction,g.richeseBidding,
|
||||
g.richeseFunding,g.aid,g.pendingEmperorAuctionGift.quote]);
|
||||
g.richeseFunding,g.aid,g.pendingEmperorAuctionGift.quote,
|
||||
...(g.pendingEmperorAuctionGift.bank ? [true] : [])]);
|
||||
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'}>): boolean {
|
||||
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' ||
|
||||
g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds || g.nexusCards ||
|
||||
g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds ||
|
||||
g.discoveryEnabled || g.sandtrout || 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 ||
|
||||
g.currentAuctionSale || g.auction || g.ixAuction) return false;
|
||||
const emperor = byFaction(g,'emperor'), buyer = g.players.find(player => player.id === quote.winner);
|
||||
if (!emperor || !buyer || emperor.id === buyer.id || emperor.ally !== buyer.id || buyer.ally !== emperor.id) return false;
|
||||
g.pendingEmperorAuctionGift = {event:crypto.randomUUID(), owner:emperor.id, recipient:buyer.id,
|
||||
turn:g.turn, source:'richese', quote:structuredClone(quote), signature:''};
|
||||
turn:g.turn, source:'richese', quote:structuredClone(quote), ...(bank ? {bank:true as const} : {}), signature:''};
|
||||
g.pendingEmperorAuctionGift.signature = emperorAuctionGiftSignature(g);
|
||||
return true;
|
||||
}
|
||||
@@ -19016,9 +19031,13 @@ function emperorAuctionGiftIntegrity(g: Game) {
|
||||
typeof pending.event === 'string' && !!pending.event && owner?.faction === 'emperor' && recipient &&
|
||||
owner.ally === recipient.id && recipient.ally === owner.id &&
|
||||
(pending.source === 'richese'
|
||||
? !decision && !g.auction && g.richeseAuction?.source === 'cache' && !!pending.quote &&
|
||||
pending.quote.winner === recipient.id && JSON.stringify(pending.quote) === JSON.stringify(richeseSettlementQuote(g))
|
||||
: pending.source === undefined && pending.quote === undefined &&
|
||||
? (pending.bank === undefined || pending.bank === true) && !decision && !g.auction && g.richeseAuction?.source === 'cache' && !!pending.quote &&
|
||||
pending.quote.winner === recipient.id && JSON.stringify(pending.quote) === JSON.stringify(richeseSettlementQuote(g)) &&
|
||||
(!pending.bank || !!g.richeseBetrayalPreview && !!g.richeseBetrayal?.completed.some(receipt =>
|
||||
receipt.stage === 'used' && receipt.invoice.kind === 'sale' && receipt.lot === g.richeseAuction!.event &&
|
||||
receipt.round === g.richeseBidding?.event && receipt.invoice.buyer === recipient.id &&
|
||||
receipt.invoice.target === g.richeseAuction!.owner && receipt.invoice.price === pending.quote!.amount))
|
||||
: pending.source === undefined && pending.quote === undefined && pending.bank === undefined &&
|
||||
decision?.kind === 'auctionPayment' && decision.player === recipient.id && g.auction?.bidder === recipient.id) &&
|
||||
pending.signature === emperorAuctionGiftSignature(g),
|
||||
'The Emperor auction gift lost its original payment opportunity.');
|
||||
@@ -44693,7 +44712,7 @@ function applyActionInner(
|
||||
g.pendingEmperorAuctionGift = null;
|
||||
if (pending.source === 'richese') {
|
||||
requireRule(pending.quote, 'The Richese auction gift lost its committed sale.');
|
||||
settleRicheseSoldLot(g,pending.quote,false);
|
||||
settleRicheseSoldLot(g,pending.quote,pending.bank === true);
|
||||
return g;
|
||||
}
|
||||
if (!g.advanced && g.nexusCards && !beginNexusEmperorPayment(g))
|
||||
|
||||
@@ -86,7 +86,7 @@ export const FACTION_RULES: Record<
|
||||
'Start with all twenty forces in reserve and ten spice. One force revival is free each turn.',
|
||||
'Receive payments for other players’ auction purchases. Your own purchases pay the bank; a Karama purchase pays no spice. A cancellation sends one auction payment to the bank.',
|
||||
'Give spice directly to your ally. After the response window it is immediately spendable, unlike a deferred bribe between non-allies.',
|
||||
'In supported Basic ordinary auctions, including Nexus games, and Richese cache sales, you may give your mutual ally spice after they win and before their original payment. Continue preserves the bid and pledged split; a canceled gift transfers nothing.',
|
||||
'In supported Basic ordinary auctions and Richese cache sales, including Nexus games, you may give your mutual ally spice after they win and before their original payment. Continue preserves the bid and pledged split; a canceled gift transfers nothing.',
|
||||
'In supported Moritani games, including Basic games with other selected faction decks, you may also give spice while your ally is choosing whether to pay Extortion. The original choice resumes after the gift’s Karama response.',
|
||||
'In supported Basic Ix-deck games with classic factions, Ixians or Tleilaxu, you may give an ally spice during the Amal phase opening, even after you have passed. The original opening resumes after the gift response.',
|
||||
'During Revival, pay two spice per extra allied force, up to three extra forces per turn. These are separate from the ally’s normal three-force allowance and may be purchased before or after ordinary revivals.',
|
||||
|
||||
@@ -429,7 +429,9 @@ export function quoteEmperorNexusSellerPurchase(
|
||||
!text(input.round) || typeof input.bank !== 'boolean' ||
|
||||
!plain(input.lot) || !plain(input.quote) ||
|
||||
Object.keys(input.lot).sort().join(',') !==
|
||||
'acted,active,bid,bidder,cardId,eligible,event,method,order,outcome,owner,passed,sealed,source,tieOrder' ||
|
||||
['acted','active','bid','bidder','cardId','eligible','event','method','order','outcome','owner','passed','sealed','source','tieOrder',
|
||||
...(Object.hasOwn(input.lot, 'clockVersion') ? ['clockVersion'] : [])].sort().join(',') ||
|
||||
(Object.hasOwn(input.lot, 'clockVersion') && input.lot.clockVersion !== 1) ||
|
||||
Object.keys(input.quote).sort().join(',') !== 'allyPayment,amount,card,kind,ownPayment,winner' ||
|
||||
input.quote.kind !== 'sold' ||
|
||||
g.status !== 'playing' || g.phase !== 3 || !whole(g.turn) || g.turn < 1 ||
|
||||
|
||||
Reference in new issue
Block a user