Expand Semuta and Richese Homeworld shipments
Verify and publish checkpoint container / container (push) Successful in 10m7s
Verify and publish checkpoint container / container (push) Successful in 10m7s
This commit is contained in:
1 parent
1ba942138d
commit
4d769af8c7
15 files changed
+626
-39
No files matched your search
@@ -9,6 +9,8 @@ export type RicheseHomeworldMarkerShipmentIntent = {
|
||||
player: string;
|
||||
destination: string;
|
||||
tokenId: string;
|
||||
/** Optional physical companions withdrawn from native Richese reserves. */
|
||||
forces?: HomeworldForces;
|
||||
};
|
||||
export type RicheseHomeworldMarkerTransferIntent = RicheseHomeworldMarkerShipmentIntent & {
|
||||
source: string;
|
||||
@@ -21,10 +23,9 @@ function requireMarker(condition: unknown, message: string): asserts condition {
|
||||
if (!condition) throw new HomeworldCustodyError(message);
|
||||
}
|
||||
|
||||
/** Quote one concealed Richese marker as a single shipment, not a physical
|
||||
* counter. The engine owns timing, payment, response windows and commitment.
|
||||
* Nothing in the input state is mutated, and the marker's denomination never
|
||||
* changes its invoice or causes reserve counters to move. */
|
||||
/** A fresh concealed marker counts as one for the whole shipment invoice. Any
|
||||
* physical companions are independently withdrawn from native Richese reserves;
|
||||
* the marker's denomination never enters the price or physical custody. */
|
||||
export function quoteRicheseHomeworldMarkerShipment(
|
||||
context: HomeworldShipmentContext,
|
||||
custody: HomeworldCustody,
|
||||
@@ -33,9 +34,17 @@ export function quoteRicheseHomeworldMarkerShipment(
|
||||
) {
|
||||
// This validates all physical reserve and foreign garrison custody first.
|
||||
const worlds = homeworldForceGroups(context, custody);
|
||||
requireMarker(record(intent) && Object.keys(intent).sort().join(',') === 'destination,player,tokenId' &&
|
||||
requireMarker(record(intent) &&
|
||||
(Object.keys(intent).sort().join(',') === 'destination,player,tokenId' ||
|
||||
Object.keys(intent).sort().join(',') === 'destination,forces,player,tokenId') &&
|
||||
typeof intent.player === 'string' && typeof intent.destination === 'string' && typeof intent.tokenId === 'string',
|
||||
'Choose a Richese player, one active Homeworld and one physical No-Field.');
|
||||
if ('forces' in intent) {
|
||||
requireMarker(record(intent.forces) && Object.keys(intent.forces).sort().join(',') === 'elite,normal' &&
|
||||
Number.isSafeInteger(intent.forces.normal) && Number.isSafeInteger(intent.forces.elite) &&
|
||||
intent.forces.normal >= 0 && intent.forces.elite >= 0,
|
||||
'Choose a valid physical normal and special counter group.');
|
||||
}
|
||||
requireMarker(context.players.every(seat => seat.ally === null ||
|
||||
typeof seat.ally === 'string' && seat.ally !== seat.id && context.players.some(other => other.id === seat.ally)),
|
||||
'Homeworld shipment needs valid seated alliance identities.');
|
||||
@@ -60,6 +69,16 @@ export function quoteRicheseHomeworldMarkerShipment(
|
||||
} catch (error) {
|
||||
throw new HomeworldCustodyError(error instanceof Error ? error.message : 'Invalid No-Field shipment.');
|
||||
}
|
||||
if (intent.forces && intent.forces.normal + intent.forces.elite > 0) {
|
||||
const physical = quoteHomeworldShipment(context, custody, {
|
||||
player: player.id, destination: destination.id, sources: { [source.id]: intent.forces },
|
||||
});
|
||||
const amount = 1 + physical.amount;
|
||||
return { player: player.id, tokenId: intent.tokenId, source: source.id,
|
||||
destination: destination.id, amount, elite: physical.elite,
|
||||
cost: context.purchasedGuildRate ? Math.ceil(amount / 2) : amount, noField: deployed,
|
||||
state: physical.state, players: physical.players, sources: physical.sources };
|
||||
}
|
||||
return {
|
||||
player: player.id,
|
||||
tokenId: intent.tokenId,
|
||||
|
||||
Reference in new issue
Block a user