Initial commit
This commit is contained in:
commit
8c709fb52f
771 files changed
+222983
No files matched your search
@@ -0,0 +1,30 @@
|
||||
/** A current-turn promise about the player's ordinary physical shipment from reserves. */
|
||||
export type ShipmentClaim = { territory: string; minimum: number };
|
||||
export type ShipmentPromise = ShipmentClaim & {
|
||||
turn: number;
|
||||
player: string;
|
||||
asker: string;
|
||||
answer: boolean;
|
||||
released?: boolean;
|
||||
fulfilled?: boolean;
|
||||
};
|
||||
export function matchesShipment(
|
||||
claim: ShipmentClaim,
|
||||
shipment: { territory: string; amount: number } | null,
|
||||
): boolean {
|
||||
return (
|
||||
!!shipment &&
|
||||
shipment.territory === claim.territory &&
|
||||
shipment.amount >= claim.minimum
|
||||
);
|
||||
}
|
||||
export function liveShipmentPromises(
|
||||
promises: readonly ShipmentPromise[],
|
||||
player: string,
|
||||
turn: number,
|
||||
): ShipmentPromise[] {
|
||||
return promises.filter(
|
||||
(p) =>
|
||||
p.player === player && p.turn === turn && !p.released && !p.fulfilled,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user