Offer Semuta after completed CHOAM card sales
This commit is contained in:
1 parent
9bfc3ec037
commit
4c07e1bbd1
8 files changed
+333
-16
No files matched your search
+70
-5
@@ -1205,6 +1205,15 @@ export type Game = {
|
||||
resume: NonNullable<Game['pendingNullentropy']>['resume'];
|
||||
stateSignature: string;
|
||||
}
|
||||
| {
|
||||
kind: 'choamSaleDiscard';
|
||||
owner: string;
|
||||
card: string;
|
||||
witness: string | null;
|
||||
price: number;
|
||||
spiceAfter: number;
|
||||
stateSignature: string;
|
||||
}
|
||||
| {
|
||||
kind: 'thumperDiscard';
|
||||
player: string;
|
||||
@@ -4910,6 +4919,19 @@ function karamaAuctionDiscardSignature(g: Game, c: KaramaAuctionDiscardContinuat
|
||||
})),
|
||||
});
|
||||
}
|
||||
type ChoamSaleDiscardContinuation = Extract<
|
||||
NonNullable<Game['pendingTreacheryDiscard']>['continuation'],
|
||||
{ kind: 'choamSaleDiscard' }
|
||||
>;
|
||||
function choamSaleDiscardSignature(g: Game, c: ChoamSaleDiscardContinuation) {
|
||||
const owner = getPlayer(g, c.owner);
|
||||
return JSON.stringify({
|
||||
owner: c.owner, card: c.card, witness: c.witness, price: c.price,
|
||||
spiceAfter: c.spiceAfter, turn: g.turn, phase: g.phase,
|
||||
active: g.active, order: g.order, market: g.choamMarket,
|
||||
hand: owner.hand.map(card => card.id), spice: owner.spice,
|
||||
});
|
||||
}
|
||||
type ThumperDiscardContinuation = Extract<
|
||||
NonNullable<Game['pendingTreacheryDiscard']>['continuation'],
|
||||
{ kind: 'thumperDiscard' }
|
||||
@@ -5516,6 +5538,25 @@ function treacheryDiscardIntegrity(g: Game) {
|
||||
'The spent Karama no longer matches its reserved auction settlement.',
|
||||
);
|
||||
normalKaramaAuction(g, getPlayer(g, c.player), c.kind === 'karamaPaymentDiscard');
|
||||
} else if (continuation?.kind === 'choamSaleDiscard') {
|
||||
const c = continuation, entry = batch.entries[0];
|
||||
const owner = g.players.find(p => p.id === c.owner);
|
||||
requireRule(
|
||||
g.choamMarket?.owner === c.owner && !g.choamMarket.sale &&
|
||||
!g.choamMarket.trade && !g.response && !g.decision &&
|
||||
!g.pendingKarama && !g.phaseOpening &&
|
||||
owner?.faction === 'choam' &&
|
||||
batch.cause === 'choamSale' && batch.entries.length === 1 &&
|
||||
entry.publicFace && entry.discardedBy === c.owner &&
|
||||
entry.card.id === c.card &&
|
||||
(c.witness === null
|
||||
? c.price === 2 && entry.card.kind === 'worthless'
|
||||
: c.price === 3 && owner.hand.some(card =>
|
||||
card.id === c.witness && card.name === entry.card.name)) &&
|
||||
owner.spice === c.spiceAfter &&
|
||||
c.stateSignature === choamSaleDiscardSignature(g, c),
|
||||
'The sold CHOAM card no longer matches its saved income and market.',
|
||||
);
|
||||
} else if (continuation?.kind === 'thumperDiscard') {
|
||||
const c = continuation, entry = batch.entries[0];
|
||||
requireRule(
|
||||
@@ -6181,6 +6222,7 @@ function semutaOfferSupported(
|
||||
continuation.kind !== 'thumperDiscard' &&
|
||||
continuation.kind !== 'amalDiscard' &&
|
||||
continuation.kind !== 'ixAllyCard' &&
|
||||
continuation.kind !== 'choamSaleDiscard' &&
|
||||
!(continuation.kind === 'battleCleanup' && continuation.source === 'winner') &&
|
||||
continuation.kind !== 'winnerMandatoryDiscard' &&
|
||||
continuation.kind !== 'battleResolved' &&
|
||||
@@ -6247,6 +6289,7 @@ function semutaOfferSupported(
|
||||
continuation.kind === 'winnerMandatoryDiscard' ||
|
||||
continuation.kind === 'battleResolved' ||
|
||||
continuation.kind === 'ixAllyCard' ||
|
||||
continuation.kind === 'choamSaleDiscard' ||
|
||||
(continuation.kind === 'karamaCharityDiscard' ||
|
||||
continuation.kind === 'karamaInflationDiscard' ||
|
||||
continuation.kind === 'karamaBgCharityDiscard' ||
|
||||
@@ -6269,7 +6312,11 @@ function semutaOfferSupported(
|
||||
!g.pendingExchange && !g.pendingIxAlly && !g.pendingNullentropy &&
|
||||
!g.pendingAmbassador && !g.pendingTerrorEntry && !g.pendingShipment &&
|
||||
!g.pendingHomeworldShipment && !g.pendingRicheseGift &&
|
||||
!g.pendingRichesePurchaseIncome && !g.choamMarket &&
|
||||
!g.pendingRichesePurchaseIncome &&
|
||||
(continuation.kind === 'choamSaleDiscard'
|
||||
? !!g.choamMarket && !g.choamMarket.sale &&
|
||||
!g.choamMarket.trade && !g.biddingEnd && !g.currentAuctionSale
|
||||
: !g.choamMarket) &&
|
||||
!g.pendingChoamMarketGhola;
|
||||
}
|
||||
function semutaContext(g: Game, owner: Player): SemutaContext {
|
||||
@@ -6410,6 +6457,8 @@ function finishTreacheryDiscard(g: Game, claim?: { player: string; card: string
|
||||
// CHOAM's selected-count payout was already committed with its discard.
|
||||
g.pendingAmbassador = next.entry;
|
||||
finishAmbassador(g);
|
||||
} else if (next.kind === 'choamSaleDiscard') {
|
||||
resumeChoamMarket(g);
|
||||
} else if (next.kind === 'nullentropyDiscard') {
|
||||
g.response = next.resume.response;
|
||||
g.decision = next.resume.decision;
|
||||
@@ -20924,18 +20973,34 @@ function finishResponse(g: Game, canceled: boolean,bureaucratDiversion?:number)
|
||||
const saleBlock = saleCard
|
||||
? homeworldRule(() => homeworldWorthlessSaleBlock(g, owner.id, saleCard))
|
||||
: null;
|
||||
if (quoteSale(owner.hand, sale.card, sale.witness) && !saleBlock) {
|
||||
discard(g, owner, sale.card);
|
||||
const quoted = quoteSale(owner.hand, sale.card, sale.witness);
|
||||
if (quoted?.price === sale.price && !saleBlock) {
|
||||
const used = discard(g, owner, sale.card);
|
||||
owner.spice += sale.price;
|
||||
log(g, `${owner.name} received ${sale.price} spice from the card sale.`);
|
||||
} else
|
||||
delete market.sale;
|
||||
if (g.semutaPreview) {
|
||||
const continuation: ChoamSaleDiscardContinuation = {
|
||||
kind: 'choamSaleDiscard', owner: owner.id, card: used.id,
|
||||
witness: sale.witness ?? null, price: sale.price,
|
||||
spiceAfter: owner.spice, stateSignature: '',
|
||||
};
|
||||
const entries = [{ card: used, discardedBy: owner.id, publicFace: true }];
|
||||
if (semutaOfferSupported(g, continuation, entries)) {
|
||||
continuation.stateSignature = choamSaleDiscardSignature(g, continuation);
|
||||
stageTreacheryDiscard(g, 'choamSale', entries, continuation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log(
|
||||
g,
|
||||
saleBlock
|
||||
? 'Tupile is now high population, so the declared Worthless sale cannot finish. The card stays in hand and no spice is paid.'
|
||||
: 'The declared card sale is no longer possible; no spice was paid.',
|
||||
);
|
||||
delete market.sale;
|
||||
delete market.sale;
|
||||
}
|
||||
resumeChoamMarket(g);
|
||||
} else if (response.kind === 'choamInflation') {
|
||||
if (!canceled) {
|
||||
|
||||
+4
-4
@@ -1156,7 +1156,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
: definition.card.effect === 'portableSnooper'
|
||||
? 'Choose Portable Snooper as your ordinary poison defense, or use the late-defense panel after reveal before your own traitor decision. It uses ordinary winner retention and cannot stop Poison Tooth.'
|
||||
: definition.card.effect === 'semutaDrug'
|
||||
? 'In the explicit Richese development preview, every seat sees a neutral response to supported clean discards. A CHOAM & Richese game may include the Ix deck: Thumper pauses before worm/spice draw; Amal pauses after halving spice before opening resumes. Other public sources include ordinary cards, paid Box, Ornithopter, Distrans, final Truthtrance, four clean Sapho scopes, pre-leader Residual Poison, printed Karama canceling clean CHOAM Charity, Inflation or Bene Gesserit Charity, a clean printed Karama normal-auction purchase or winning-bid payment before lot settlement, and three battle batches. A private normal-auction Ixian ally replacement also pauses before drawing, without showing its face until a holder commits. Commit held Semuta with a free hand slot; for multiple eligible cards, inspect and select exactly one after commitment. Saved effects resume once. Other private discards, Karama uses, inspected/partly ready battles, nested responses, pending rewards, full-hand sequencing and public starts remain unfinished.'
|
||||
? 'In the explicit Richese development preview, every seat sees a neutral response to supported clean discards. A CHOAM & Richese game may include the Ix deck: Thumper pauses before worm/spice draw; Amal pauses after halving spice before opening resumes. Other public sources include ordinary cards, paid Box, Ornithopter, Distrans, final Truthtrance, four clean Sapho scopes, pre-leader Residual Poison, printed Karama canceling clean CHOAM Charity, Inflation or Bene Gesserit Charity, a clean printed Karama normal-auction purchase or winning-bid payment before lot settlement, a completed CHOAM card sale after its bank income, and three battle batches. A private normal-auction Ixian ally replacement also pauses before drawing, without showing its face until a holder commits. Commit held Semuta with a free hand slot; for multiple eligible cards, inspect and select exactly one after commitment. Saved effects resume once. Other private discards, Karama uses, inspected/partly ready battles, nested responses, pending rewards, full-hand sequencing and public starts remain unfinished.'
|
||||
: 'Reference component only: this Richese card’s game actions are not enabled.',
|
||||
],
|
||||
...(definition.card.effect === 'semutaDrug'
|
||||
@@ -1166,7 +1166,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
area: 'Implementation' as const,
|
||||
status: 'Partial' as const,
|
||||
detail:
|
||||
'The Richese preview interrupts clean ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama canceling clean CHOAM Charity, Inflation or Bene Gesserit Charity or settling a normal auction purchase or winning bid, Ix-deck Thumper/Amal and three battle discard stages. A private normal-auction Ixian ally replacement also pauses before its draw with a neutral, face-hidden offer. Karama’s physical cost is discarded before its neutral offer; the original response is canceled or the reserved lot settles once. Residual Poison commits one random leader death; Sapho commits its finite priority. Thumper waits before worm/spice draw; Amal restores an already-halved opening. Owner-only candidates and one physical Semuta transfer retain privacy. Other Karama uses, private discards, nested responses, pending rewards and full-hand exchange remain unfinished.',
|
||||
'The Richese preview interrupts clean ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama canceling clean CHOAM Charity, Inflation or Bene Gesserit Charity or settling a normal auction purchase or winning bid, a completed CHOAM card sale, Ix-deck Thumper/Amal and three battle discard stages. A private normal-auction Ixian ally replacement pauses before its draw with a neutral, face-hidden offer. CHOAM sale income is committed before its neutral offer and the same market resumes once. Karama’s physical cost is discarded before its neutral offer; the original response is canceled or the reserved lot settles once. Residual Poison commits one random leader death; Sapho commits its finite priority. Thumper waits before worm/spice draw; Amal restores an already-halved opening. Owner-only candidates and one physical Semuta transfer retain privacy. Other Karama uses, private discards, nested responses, pending rewards and full-hand exchange remain unfinished.',
|
||||
},
|
||||
{
|
||||
area: 'Player controls' as const,
|
||||
@@ -1184,13 +1184,13 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
area: 'Documentation' as const,
|
||||
status: 'Partial' as const,
|
||||
detail:
|
||||
'The guide distinguishes clean public ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama cancellation of CHOAM Charity, Inflation or Bene Gesserit Charity or clean normal-auction purchase or winning-bid payment, Ix-deck Thumper/Amal and three battle batches from a private normal-auction Ixian ally replacement, privacy-neutral acknowledgements, provisional free-slot policy and remaining discard sources.',
|
||||
'The guide distinguishes clean public ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama cancellation of CHOAM Charity, Inflation or Bene Gesserit Charity or clean normal-auction purchase or winning-bid payment, completed CHOAM card sales, Ix-deck Thumper/Amal and three battle batches from a private normal-auction Ixian ally replacement, privacy-neutral acknowledgements, provisional free-slot policy and remaining discard sources.',
|
||||
},
|
||||
{
|
||||
area: 'Verification' as const,
|
||||
status: 'Partial' as const,
|
||||
detail:
|
||||
'Genuine setup, custody, hidden-hand parity, saved JSON, authenticated SQLite continuation and legal AI participation cover clean ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama cancellation of CHOAM Charity, Inflation or Bene Gesserit Charity or clean normal-auction purchase or winning-bid payment, Ix-deck Thumper/Amal, a private normal-auction Ixian ally replacement and three battle discard stages. Other private producers, Karama uses, pending rewards, full games and live deployment remain unverified.',
|
||||
'Genuine setup, custody, hidden-hand parity, saved JSON, authenticated SQLite continuation and legal AI participation cover clean ordinary-card, paid Box, Ornithopter, Distrans, Truthtrance, four Sapho scopes, pre-leader Residual Poison, printed Karama cancellation of CHOAM Charity, Inflation or Bene Gesserit Charity or clean normal-auction purchase or winning-bid payment, completed CHOAM card sales, Ix-deck Thumper/Amal, a private normal-auction Ixian ally replacement and three battle discard stages. Other private producers, Karama uses, pending rewards, full games and live deployment remain unverified.',
|
||||
evidence: [
|
||||
'tests/semuta-engine.test.ts',
|
||||
'tests/semuta-recovery.test.ts',
|
||||
|
||||
Reference in new issue
Block a user