Allow recovered Recruits replay and more bribe windows
Verify and publish checkpoint container / container (push) Successful in 10m51s
Verify and publish checkpoint container / container (push) Successful in 10m51s
This commit is contained in:
1 parent
bd8377d87b
commit
de7fe7d64a
13 files changed
+394
-22
No files matched your search
+10
-2
@@ -1,5 +1,6 @@
|
||||
/** A global card effect expires when the authoritative turn changes. */
|
||||
export type RecruitsEffect = Readonly<{ turn: number }>;
|
||||
/** Legacy receipts omit uses and represent one physical play. */
|
||||
export type RecruitsEffect = Readonly<{ turn: number; uses?: number }>;
|
||||
export const RECRUITS_CARD_ID = 'ecaz-recruits' as const;
|
||||
export type RecruitsPlay = Readonly<{
|
||||
type: 'card';
|
||||
@@ -10,6 +11,7 @@ export type RecruitsPreview = Readonly<{
|
||||
active: boolean;
|
||||
playedTurn?: number;
|
||||
playedBy?: string;
|
||||
plays?: number;
|
||||
play: RecruitsPlay | null;
|
||||
rates: ReadonlyArray<Readonly<{ player: string; freeRate: number; limit: number }>>;
|
||||
grantRevivalBlocked: string | null;
|
||||
@@ -73,11 +75,17 @@ export function recruitsRevivalAllowance(
|
||||
throw new RangeError(`${key} must be a nonnegative integer force count.`);
|
||||
|
||||
const active = scope.recruits?.turn === scope.turn;
|
||||
const uses = active ? scope.recruits?.uses ?? 1 : 0;
|
||||
if (!Number.isSafeInteger(uses) || uses < 0 || (active && uses === 0))
|
||||
throw new RangeError('Active Recruits uses must be a positive safe integer.');
|
||||
const limit = active ? Math.max(7, facts.currentLimit) : facts.currentLimit;
|
||||
const freeRate = facts.freeBlocked
|
||||
? 0
|
||||
: Math.min(
|
||||
facts.currentFreeRate * (active ? 2 : 1),
|
||||
// Each actual replay doubles the current rate again. Cap the exponent
|
||||
// at 53: every supported input and cap is a safe nonnegative integer,
|
||||
// so a larger power can never alter the capped result.
|
||||
facts.currentFreeRate * 2 ** Math.min(uses, 53),
|
||||
facts.freeRateCap,
|
||||
limit,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user