Allow Richese special purchase during CHOAM market
Verify and publish checkpoint container / container (push) Successful in 10m55s
Verify and publish checkpoint container / container (push) Successful in 10m55s
This commit is contained in:
1 parent
181f16d7d7
commit
ecd892b368
7 files changed
+461
-3
No files matched your search
+38
-3
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user