Connect provisional Basic full-hand Nullentropy Box exchange

This commit is contained in:
Quintine committed 2026-10-08 09:30:34 +11:00
1 parent 8d55b8f3f7
commit f29f14128f
9 files changed
+69 -16

No files matched your search

+6 -4
View File
@@ -37,6 +37,7 @@ export function resolveNullentropyBox(
selectedId: string,
remainingOrderIds: readonly string[],
handLimit: number,
allowFullHandExchange = false,
): NullentropyBoxResult {
if (!Number.isSafeInteger(handLimit) || handLimit < 0)
throw new RangeError('The hand limit must be a nonnegative safe integer.');
@@ -46,10 +47,11 @@ export function resolveNullentropyBox(
throw new Error(
'Use the canonical Nullentropy Box physically in your hand.',
);
if (ownerHand.length >= handLimit)
throw new Error(
'Full-hand Nullentropy Box use is unresolved; a pre-existing free hand slot is required by the current guard.',
);
if (ownerHand.length > handLimit ||
(!allowFullHandExchange && ownerHand.length === handLimit))
throw new Error(allowFullHandExchange
? 'The final exchanged hand must not exceed its hand limit.'
: 'Full-hand Nullentropy Box use is unresolved; a pre-existing free hand slot is required by the current guard.');
const selected = discard.find((card) => card.id === selectedId);
if (!selected || isAnyBox(selected))
throw new Error('Choose a discard card other than any Nullentropy Box.');