Allow Richese reveal during Emperor revival
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
cfccfe5acb
commit
a10e019b01
9 files changed
+260
-16
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { Game } from './engine';
|
||||
import { validateFremenRevivalGrant } from './fremen-revival-grant';
|
||||
import { richeseRevealForeignMovementPending } from './richese-reveal-foreign-movement';
|
||||
import { eliteRevivalRemaining, paidForceRevivalCost, revivalPrevented } from './revival';
|
||||
|
||||
const factions = new Set([
|
||||
'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen',
|
||||
@@ -78,8 +79,8 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
||||
if (foreignMovement) return true;
|
||||
if (g.response) {
|
||||
// Only independent, un-nested native responses with a stable original
|
||||
// source are admitted. In particular, shipment and revival transactions
|
||||
// still need their own continuation proofs.
|
||||
// source are admitted. Other shipment and revival transactions still
|
||||
// need their own continuation proofs.
|
||||
const response = g.response;
|
||||
if (g.decision || g.phaseOpening || g.choamMarket ||
|
||||
!Array.isArray(response.passed) || new Set(response.passed).size !== response.passed.length ||
|
||||
@@ -100,6 +101,20 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
||||
!!recipient && recipient.id !== owner.id && owner.ally === recipient.id && recipient.ally === owner.id &&
|
||||
Number.isSafeInteger(response.amount) && response.amount! > 0 && response.amount! <= owner.spice && response.elite === 0;
|
||||
}
|
||||
if (response.kind === 'emperorRevival') {
|
||||
const recipient = g.players.find(player => player.id === response.recipient);
|
||||
const amount = response.amount, elite = response.elite;
|
||||
return keys === 'amount,elite,kind,owner,passed,recipient' && g.phase === 4 && owner.faction === 'emperor' &&
|
||||
!!recipient && recipient.id !== owner.id &&
|
||||
owner.ally === recipient.id && recipient.ally === owner.id &&
|
||||
Number.isSafeInteger(amount) && amount! > 0 && amount! <= recipient.tanks &&
|
||||
Number.isSafeInteger(elite) && elite! >= 0 && elite! <= amount! &&
|
||||
elite! <= (recipient.elites?.tanks ?? 0) && amount! - elite! <= recipient.tanks - (recipient.elites?.tanks ?? 0) &&
|
||||
elite! <= eliteRevivalRemaining(recipient, g.advanced) &&
|
||||
Number.isSafeInteger(g.emperorExtra[recipient.id] ?? 0) && (g.emperorExtra[recipient.id] ?? 0) >= 0 &&
|
||||
(g.emperorExtra[recipient.id] ?? 0) + amount! <= 3 &&
|
||||
!revivalPrevented(g, recipient.id) && owner.spice >= paidForceRevivalCost(recipient, amount!, elite!);
|
||||
}
|
||||
if (response.kind === 'revivalIncome')
|
||||
return keys === 'amount,kind,owner,passed,recipient' && owner.faction === 'tleilaxu' &&
|
||||
g.players.some(player => player.id === response.recipient) &&
|
||||
|
||||
Reference in new issue
Block a user