Initial commit
This commit is contained in:
commit
8c709fb52f
771 files changed
+222983
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import type { Game, Player } from './engine';
|
||||
import { retentionReservesCard } from './moritani-retention';
|
||||
/** Only cards not already fixed into a battle may be converted into spice. */
|
||||
export function cashInCards(
|
||||
g: Pick<Game, 'battle' | 'moritaniRetention'>,
|
||||
p: Pick<Player, 'id' | 'hand'>,
|
||||
) {
|
||||
const plan = g.battle?.plans[p.id];
|
||||
const insight = g.battle?.prescience;
|
||||
return p.hand.filter(
|
||||
(c) =>
|
||||
!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),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user