Implement Atreides Nexus inspections with durable battle commitments
This commit is contained in:
1 parent
d2a1d63517
commit
d820c8a414
25 files changed
+3171
-182
No files matched your search
+10
-4
@@ -1,18 +1,24 @@
|
||||
import type { Game, Player } from './engine';
|
||||
import { retentionReservesCard } from './moritani-retention';
|
||||
import { committedPlanElements } from './battle-inspections';
|
||||
/** Only cards not already fixed into a battle may be converted into spice. */
|
||||
export function cashInCards(
|
||||
g: Pick<Game, 'battle' | 'moritaniRetention' | 'pendingWinnerDiscards'>,
|
||||
p: Pick<Player, 'id' | 'hand'>,
|
||||
) {
|
||||
const plan = g.battle?.plans[p.id];
|
||||
const insight = g.battle?.prescience;
|
||||
const commitments = g.battle ? committedPlanElements(g.battle, p.id) : [];
|
||||
return p.hand.filter(
|
||||
(c) =>
|
||||
!(g.pendingWinnerDiscards?.player === p.id &&
|
||||
[...g.pendingWinnerDiscards.cards, ...g.pendingWinnerDiscards.optional].includes(c.id)) &&
|
||||
!(
|
||||
g.pendingWinnerDiscards?.player === p.id &&
|
||||
[
|
||||
...g.pendingWinnerDiscards.cards,
|
||||
...g.pendingWinnerDiscards.optional,
|
||||
].includes(c.id)
|
||||
) &&
|
||||
!retentionReservesCard(g, p.id, c.id) &&
|
||||
(!plan || ![plan.weapon, plan.defense, plan.leader].includes(c.id)) &&
|
||||
(!insight || insight.player === p.id || insight.value !== c.id),
|
||||
!commitments.some((element) => element.value === c.id),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user