Support deferred payments with travel deals
Verify and publish checkpoint container / container (push) Successful in 11m29s
Verify and publish checkpoint container / container (push) Successful in 11m29s
This commit is contained in:
1 parent
9536c77062
commit
5e294215be
16 files changed
+603
-100
No files matched your search
@@ -69,10 +69,9 @@ export function publicDealOfferAction(targets: readonly string[], terms: string,
|
||||
const travelKeys = travel ? Object.keys(travel).filter(key => key !== 'dueTurn').sort().join(',') : '';
|
||||
const travelDeadline = travel && Object.hasOwn(travel, 'dueTurn') ? travel.dueTurn : undefined;
|
||||
if (travel && (!proposer || targets.includes(proposer) ||
|
||||
(groupTravel ? !!payment && payment.kind !== 'immediateBribe' || travelKeys !== 'actor,answer,kind,minimum,territory' ||
|
||||
(groupTravel ? travelKeys !== 'actor,answer,kind,minimum,territory' ||
|
||||
typeof travel.actor !== 'string' || !targets.includes(travel.actor) :
|
||||
travelKeys !== 'answer,kind,minimum,territory' ||
|
||||
!!payment && payment.kind !== 'immediateBribe') ||
|
||||
travelKeys !== 'answer,kind,minimum,territory') ||
|
||||
(Object.hasOwn(travel, 'dueTurn') && (!Number.isSafeInteger(travelDeadline) || (travelDeadline as number) < 1 ||
|
||||
(currentTurn !== undefined && (!Number.isSafeInteger(currentTurn) || currentTurn < 1 || (travelDeadline as number) < currentTurn)))) ||
|
||||
!['ship', 'move'].includes(travel.kind) || !TERRITORIES.some(territory => territory.id === travel.territory) ||
|
||||
@@ -226,8 +225,6 @@ export function PublicDeals({ game, act, busy }: {
|
||||
minimum:Number(travelMinimum), answer:travelAnswer,
|
||||
...(selected.length > 1 ? {actor:travelActor} : {}),
|
||||
...(travelTurn > game.turn ? {dueTurn:travelTurn} : {})} : undefined;
|
||||
const combinedPaymentValid = !includeTravel || !payment || payment.kind === 'immediateBribe' &&
|
||||
paymentPeopleAndAmountValid;
|
||||
const offer = legalSelection && paymentValid && (!includeTravel || travelDueValid)
|
||||
? publicDealOfferAction(selected, terms, payment, me?.id, game.turn, travel) : null;
|
||||
const disabled = busy || !!game.roomControl?.paused || !!game.roomControl?.closed || !!me?.autopilot;
|
||||
@@ -308,8 +305,7 @@ export function PublicDeals({ game, act, busy }: {
|
||||
{includeTravel && <fieldset>
|
||||
<legend>Travel term</legend>
|
||||
<p className="fine">This term concerns one physical action during the selected turn. The sole recipient commits to travel in a two-party deal. In a group deal, choose one recipient to commit; they accept last after all other recipients. Written terms remain player-managed.</p>
|
||||
<p className="fine">A travel term may include an immediate payment between two participants. The payment recipient collects their share at the next Mentat opening and can use it after collection. All invited parties accept before the traveler gives final consent.</p>
|
||||
{!combinedPaymentValid && <p role="alert">For travel, choose an immediate payment between two participants.</p>}
|
||||
<p className="fine">A travel term may include an immediate payment or a payment due by the end of a selected turn. Payment and travel may have different participants and turns. The payment recipient collects their share at the next Mentat opening and can use it after collection. All invited parties accept before the traveler gives final consent.</p>
|
||||
{selected.length > 1 && <label>Committed traveler
|
||||
<select value={selected.includes(travelActor) ? travelActor : ''} disabled={disabled}
|
||||
onChange={event => setTravelActor(event.target.value)}>
|
||||
@@ -317,7 +313,7 @@ export function PublicDeals({ game, act, busy }: {
|
||||
{selectedPlayers.map(player => <option key={player.id} value={player.id}>{player.name} · {faction(player.faction).name}</option>)}
|
||||
</select>
|
||||
</label>}
|
||||
<p className="fine">This initial preview supports Basic games with classic factions and no expansions or optional modules. A current-turn term needs a quiet native window and a legal completion on final acceptance. A later-turn term reserves no forces or spice now. If the game finds no legal completion when the travel turn closes, it provisionally marks that term void.</p>
|
||||
<p className="fine">Travel terms are available in Basic games with classic factions and no expansions or optional modules. A current-turn term must be possible when accepted. A later-turn term reserves no forces or spice in advance; if no legal completion is found when the travel turn closes, the term may be marked void.</p>
|
||||
<label>Travel action
|
||||
<select value={travelKind} disabled={disabled} onChange={event => setTravelKind(event.target.value === 'move' ? 'move' : 'ship')}>
|
||||
<option value="ship">Reserve shipment</option>
|
||||
|
||||
Reference in new issue
Block a user