Allow Advanced Auditor inspection choice
Verify and publish checkpoint container / container (push) Successful in 11m25s
Verify and publish checkpoint container / container (push) Successful in 11m25s
This commit is contained in:
1 parent
0681529e8e
commit
7e6e8c2d12
9 files changed
+292
-31
No files matched your search
+18
-7
@@ -2346,6 +2346,8 @@ export type Game = {
|
||||
survived: boolean;
|
||||
usedCards: string[];
|
||||
stage: 'offer' | 'response' | 'payment';
|
||||
/** Chosen maximum; older in-flight audits omit this and inspect the maximum. */
|
||||
count?: number;
|
||||
} | null;
|
||||
auditorInsight?: {
|
||||
event: string;
|
||||
@@ -35521,10 +35523,9 @@ function finishBattle(g: Game) {
|
||||
function currentAuditCount(g: Game) {
|
||||
const pending = g.pendingAuditor;
|
||||
return pending
|
||||
? auditCount(
|
||||
getPlayer(g, pending.opponent).hand,
|
||||
pending.usedCards,
|
||||
pending.survived,
|
||||
? Math.min(
|
||||
pending.count ?? (pending.survived ? 2 : 1),
|
||||
auditCount(getPlayer(g, pending.opponent).hand, pending.usedCards, pending.survived),
|
||||
)
|
||||
: 0;
|
||||
}
|
||||
@@ -35554,6 +35555,7 @@ function finishAuditor(
|
||||
pending.usedCards,
|
||||
pending.survived,
|
||||
random,
|
||||
count,
|
||||
);
|
||||
g.auditorInsight = {
|
||||
event: pending.event,
|
||||
@@ -35617,6 +35619,9 @@ function auditorIntegrity(g: Game) {
|
||||
g.players.some((p) => p.id === pending.opponent) &&
|
||||
typeof pending.survived === 'boolean' &&
|
||||
['offer', 'response', 'payment'].includes(pending.stage) &&
|
||||
(pending.count === undefined ||
|
||||
(pending.stage !== 'offer' && Number.isInteger(pending.count) &&
|
||||
pending.count >= 1 && pending.count <= (pending.survived ? 2 : 1))) &&
|
||||
Array.isArray(pending.usedCards) &&
|
||||
pending.usedCards.every((id) => typeof id === 'string') &&
|
||||
new Set(pending.usedCards).size === pending.usedCards.length,
|
||||
@@ -43808,11 +43813,17 @@ function applyActionInner(
|
||||
requireRule(
|
||||
typeof action.audit === 'boolean' &&
|
||||
action.pay === undefined &&
|
||||
action.count === undefined,
|
||||
'Choose whether to use the Auditor.',
|
||||
(action.audit
|
||||
? currentAuditCount(g) > 0 &&
|
||||
(action.count === undefined ||
|
||||
(typeof action.count === 'number' && Number.isInteger(action.count) &&
|
||||
action.count >= 1 && action.count <= currentAuditCount(g)))
|
||||
: action.count === undefined),
|
||||
'Choose a valid number of cards to audit or decline.',
|
||||
);
|
||||
if (!action.audit) finishAuditor(g, 'decline');
|
||||
else {
|
||||
pending.count = typeof action.count === 'number' ? action.count : currentAuditCount(g);
|
||||
pending.stage = 'response';
|
||||
g.response = {
|
||||
kind: 'choamAudit',
|
||||
@@ -43822,7 +43833,7 @@ function applyActionInner(
|
||||
};
|
||||
log(
|
||||
g,
|
||||
`${p.name} declared an Auditor inspection. Opposing Karama cancellation resolves before any inspection payment.`,
|
||||
`${p.name} declared an Auditor inspection of up to ${pending.count} card${pending.count === 1 ? '' : 's'}. Opposing Karama cancellation resolves before any inspection payment.`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user