Allow Richese special purchase during CHOAM market
Verify and publish checkpoint container / container (push) Successful in 10m55s

This commit is contained in:
Quintine committed 2026-11-16 15:53:01 +11:00
1 parent 181f16d7d7
commit ecd892b368
7 files changed
+461 -3

No files matched your search

+38 -3
View File
@@ -7731,6 +7731,7 @@ function specialKaramaDiscardSignature(g: Game, c: SpecialKaramaDiscardContinuat
rides: g.wormRides, nexus: g.nexusCards,
emperorPurchases: g.nexusEmperorPurchaseHistory,
auction: g.auction, sale: g.currentAuctionSale,
...(g.choamMarket ? {market: g.choamMarket} : {}),
richeseAuction: g.richeseAuction, richeseBidding: g.richeseBidding,
cache: g.richeseCache?.map(card => card.id),
deck: g.deck.map(card => card.id), revivalPrevention: g.revivalPrevention,
@@ -10446,7 +10447,9 @@ function semutaOfferSupported(
(richeseGiftDiscard || !g.pendingRicheseGift) &&
(richeseGiftDiscard || (continuation.kind === 'karamaIncomeDiscard' &&
continuation.use.response.kind === 'richesePurchaseIncome') || !g.pendingRichesePurchaseIncome) &&
(richeseGiftDiscard || saleCostDiscard || marketGholaDiscard || marketGholaIncomeDiscard || (continuation.kind === 'choamSaleDiscard'
(richeseGiftDiscard || saleCostDiscard || marketGholaDiscard || marketGholaIncomeDiscard ||
continuation.kind === 'specialKaramaDiscard' && continuation.intent.kind === 'richese' &&
richeseSpecialMarketParent(g, continuation.resume.decision) || (continuation.kind === 'choamSaleDiscard'
? !!g.choamMarket && !g.choamMarket.sale &&
!g.choamMarket.trade && !g.biddingEnd && !g.currentAuctionSale
: continuation.kind === 'kaitainDiscard'
@@ -10480,6 +10483,8 @@ function semutaCandidates(g: Game, owner: Player) {
/** A committed prevention releases only its selected Technology/gift
* reservation for Semuta's cost response. Other commitments remain live. */
function semutaSpendingBlock(g: Game, owner: Player, card: Card): string | null {
if (choamTradeCardReserved(g, owner, card))
return 'This card is reserved for the current CHOAM trade.';
const c=g.pendingTreacheryDiscard?.continuation;
const gift=g.pendingRicheseGift;
const preventedTechnology=c?.kind==='karamaAuctionAdvantageDiscard' &&
@@ -15724,6 +15729,7 @@ function richeseBetrayalSourceSignature(g: Game, frame: NonNullable<Game['pendin
active:g.active,decision:g.decision,response:g.response,phaseOpening:g.phaseOpening,
pendingKarama:g.pendingKarama,truthtrance:g.truthtrance,sale:g.currentAuctionSale,
purchaseIncome:g.pendingRichesePurchaseIncome,
...(g.choamMarket ? {market:g.choamMarket} : {}),
});
if ('normal' in frame) return JSON.stringify({
event:frame.receipt.event,normal:frame.normal,turn:g.turn,phase:g.phase,status:g.status,
@@ -42926,6 +42932,30 @@ export type SpecialKaramaIntent = {
| { kind: 'moritani'; source: MoritaniSpecialKaramaSource; keep: string[]; discard: string[] }
);
/** The original CHOAM exchange keeps both selected physical cards until its
* owner confirms or declines. An unrelated special purchase cannot spend one. */
function choamTradeCardReserved(g: Game, owner: Player, card: Card): boolean {
const market = g.choamMarket, trade = market?.trade;
return !!market && !!trade && (market.owner === owner.id && trade.offered === card.id ||
trade.ally === owner.id && trade.returned === card.id);
}
/** Validate the market parent without consuming its original choice. The
* decision can be parked temporarily by a Semuta discard continuation. */
function richeseSpecialMarketParent(g: Game, decision: Game['decision']): boolean {
const market = g.choamMarket;
if (!market || market.sale || !decision) return false;
const owner = g.players.find(player => player.id === market.owner && player.faction === 'choam');
if (!owner) return false;
if (decision.kind === 'choamMarket') return decision.player === owner.id && !market.trade;
const trade = market.trade, ally = g.players.find(player => player.id === trade?.ally);
if (!trade || !ally || owner.ally !== ally.id || ally.ally !== owner.id ||
!owner.hand.some(card => card.id === trade.offered)) return false;
if (decision.kind === 'choamTradeReply') return decision.player === ally.id && !trade.returned;
return decision.kind === 'choamTradeConfirm' && decision.player === owner.id &&
!!trade.returned && ally.hand.some(card => card.id === trade.returned);
}
/** Validates and copies a selection without spending resources, continuing play, or drawing RNG. */
export function prepareSpecialKaramaIntent(
g: Game,
@@ -42947,7 +42977,8 @@ export function prepareSpecialKaramaIntent(
'Play Amal or pass the phase opening before taking other actions.',
);
requireRule(
!g.choamMarket,
!g.choamMarket || p.faction === 'richese' && !g.response && !g.phaseOpening &&
!g.pendingKarama && !g.pendingKull && !g.pendingTreacheryDiscard && richeseSpecialMarketParent(g, g.decision),
'Finish the end-of-phase exchange before another special power.',
);
requireRule(
@@ -42970,6 +43001,8 @@ export function prepareSpecialKaramaIntent(
requireRule(card, 'Choose a Karama card in your hand.');
const activationBlock = karamaSpendingBlock(g, p, card, kullSpecialPurpose(p.faction));
requireRule(!activationBlock, activationBlock ?? 'This Karama is committed elsewhere.');
requireRule(p.faction !== 'richese' || !choamTradeCardReserved(g, p, card),
'This Karama is reserved for the current CHOAM trade.');
const base = { owner: p.id, card: card.id, turn: g.turn, phase: g.phase };
if (p.faction === 'ecaz') {
requireRule(!g.response && !g.decision && !g.battle?.preparation &&
@@ -43643,6 +43676,7 @@ function richeseSpecialKaramaView(g: Game, p: Player) {
(c) =>
canUseAsKaramaRole(g, p, c) &&
!karamaSpendingBlock(g, p, c, kullSpecialPurpose(p.faction)) &&
!choamTradeCardReserved(g, p, c) &&
!(
g.richeseAuction?.source === 'blackMarket' &&
!g.currentAuctionSale &&
@@ -45524,7 +45558,8 @@ function applyActionInner(
}
if (t === 'card' && action.mode === 'special') {
requireRule(
!g.choamMarket,
!g.choamMarket || p.faction === 'richese' && !g.response && !g.phaseOpening &&
!g.pendingKarama && !g.pendingKull && !g.pendingTreacheryDiscard && richeseSpecialMarketParent(g, g.decision),
'Finish the end-of-phase exchange before another special power.',
);
requireRule(
+1
View File
@@ -623,6 +623,7 @@ export const RULE_TOPICS: RuleTopic[] = [
steps: [
'In advanced development tables, Richese can use its special Karama once per game. Select an available Karama in your hand and one eligible card from your own cache. The activating Karama is discarded; the chosen card enters your hand secretly.',
'In a supported clean Ix phase opening, this purchase can occur without abandoning earlier passes. If the Emperor is present, the opening waits while the separate income response is resolved; its existing passes then resume. Some optional-module combinations remain guarded.',
'During a supported CHOAM market or allied trade decision, your purchase can interrupt and then resume that same decision. A Karama or Semuta already selected for the pending trade stays reserved for the exchange.',
'This is a purchase for Richese itself. Pay three of your available spice to Emperor when present, otherwise the bank. The general Emperor purchase-income rule supplies this payment destination. An ally receives no Harkonnen bonus or Ixian replacement from this direct cache acquisition.',
'With Emperor absent, an actual unallied Emperor Nexus holder may use the private joint option after proving three own uncommitted spice. Original Karama and Nexus both spend at purchase commit, one exact cache card enters your hand and native once-use/capacity/reservations remain. No bank money, reimbursement, ally bonus or fake auction is created. The separate Betrayal preview may pause before those costs. This purchase composition is visibly provisional; ordinary paid use remains available.',
'A Karama cannot cancel the special purchase itself. Emperor income has a separate response: canceling that income does not undo the purchase or restore the spent special power.',