Support phase-wide bidding across all auctions
Verify and publish checkpoint container / container (push) Successful in 12m14s

This commit is contained in:
Quintine committed 2026-11-16 19:17:36 +11:00
1 parent 12060f3112
commit 38f1684e03
17 files changed
+1070 -18

No files matched your search

+2
View File
@@ -53,6 +53,7 @@ import { LeaderRevivalPromises } from './leader-revival-promises';
import { GholaLeaderPromises } from './ghola-leader-promises';
import { BidPromises } from './bid-promises';
import { PhaseBidPromises } from './phase-bid-promises';
import { PhaseAnyBidPromises } from './phase-any-bid-promises';
import { HomeworldShipment } from './homeworld-shipment';
import { HomeworldRevivalDeployment } from './homeworld-revival-deployment';
import { CaladanReinforcement } from './caladan-reinforcement';
@@ -2171,6 +2172,7 @@ export function GameTable({
{g.status === 'playing' && <RevivalPromises game={g} send={act} busy={busy} />}
{g.status === 'playing' && <BidPromises game={g} send={act} busy={busy} />}
{g.status === 'playing' && <PhaseBidPromises game={g} send={act} busy={busy} />}
{g.status === 'playing' && <PhaseAnyBidPromises game={g} send={act} busy={busy} />}
{g.status === 'playing' && <EarlyRicheseBidPromises game={g} />}
{g.status === 'playing' && <MixedBidPromises game={g} send={act} busy={busy} />}
{g.status === 'playing' && <MixedRicheseBidPromises game={g} send={act} busy={busy} />}
+67
View File
@@ -0,0 +1,67 @@
'use client';
import type { Action, GameView } from '@/game/engine';
import { phaseAnyBidClaimText } from '@/game/phase-any-bid-promises';
import { Button } from './ui/button';
type Props = { game: GameView; busy: boolean; send: (action: Action) => void };
/** Use only the exact server-selected declaration for the live source and owner. */
export function PhaseAnyBidGuideButton(props: Props) {
const game = props.game, guide = game.phaseAnyBidGuide;
if (!guide) return null;
const actor = game.me, turn = game.turn, action = guide.action;
const signature = JSON.stringify(action), ordinary = game.auction, special = game.richeseAuction;
const ordinarySignature = ordinary && JSON.stringify([ordinary.bid, ordinary.bidder, ordinary.active, ordinary.remaining]);
const specialSignature = special && JSON.stringify([special.event, special.method, special.active,
special.bid, special.bidder, special.submitted, special.ownBid]);
const canAct = () => {
const current = props.game, me = current.players.find(player => player.id === actor);
if (props.busy || current !== game || current.me !== actor || current.turn !== turn ||
current.status !== 'playing' || current.phase !== 3 || current.phaseAnyBidGuide !== guide ||
guide.action !== action || JSON.stringify(action) !== signature || !me || me.autopilot ||
current.truthtrance || current.response || current.decision || current.phaseOpening ||
current.automaticContinuationPending || current.roomControl?.paused || current.roomControl?.closed ||
typeof action.phaseAnyBidPromiseEvent !== 'string' ||
!current.phaseAnyBidPromises.some(promise => promise.event === action.phaseAnyBidPromiseEvent &&
promise.player === actor && promise.turn === turn && !promise.fulfilled && !promise.released)) return false;
if (action.type === 'bid' || action.type === 'passBid')
return !!ordinary && current.auction === ordinary && ordinary.active === actor &&
JSON.stringify([ordinary.bid, ordinary.bidder, ordinary.active, ordinary.remaining]) === ordinarySignature &&
typeof action.phaseAnyBidLot === 'number' && current.bidPromiseLot?.turn === turn &&
current.bidPromiseLot.lot === action.phaseAnyBidLot;
if (action.type !== 'richeseBid' || !special || current.richeseAuction !== special ||
special.event !== action.event || special.event !== action.phaseAnyBidLotEvent ||
JSON.stringify([special.event, special.method, special.active, special.bid, special.bidder,
special.submitted, special.ownBid]) !== specialSignature) return false;
return special.method === 'silent' ? !special.submitted.includes(actor) : special.active === actor;
};
return <Button className="game-action min-h-11 whitespace-normal" data-testid="phase-any-bid-guide"
disabled={!canAct()} onClick={() => { if (canAct()) props.send(action); }}>
{typeof action.amount === 'number' && action.amount > 0
? `Bid ${action.amount} spice while honoring your phase answers`
: action.amount === 0 ? 'Submit zero spice while honoring your phase answers'
: 'Pass this lot while honoring your phase answers'}
</Button>;
}
export function PhaseAnyBidPromises(props: Props) {
const game = props.game, own = game.phaseAnyBidPromises.filter(promise => promise.player === game.me);
if (!own.length) return null;
const waiting = own.some(promise => promise.turn === game.turn && !promise.fulfilled && !promise.released);
return <section className="notice space-y-3" aria-label="Your Truthtrance any-auction bid promises" id="phase-any-bid-guidance">
<h3>Your any-auction bid promises</h3>
<ul>{own.map(promise => <li key={promise.event}>
Turn {promise.turn}: You answered {promise.answer ? 'Yes' : 'No'} to {phaseAnyBidClaimText(promise)}.
{promise.released ? ' Released: this commitment is no longer possible.'
: promise.fulfilled ? ' Fulfilled: this commitment is complete.' : ' This answer is binding through this Bidding phase.'}
</li>)}</ul>
<p>Yes requires a qualifying future bid while possible. No forbids qualifying bids through Bidding close.
Ordinary, Richese cache and Black Market auctions count. A bid can fulfill Yes even if another player wins;
its native funding and payment rules still apply.</p>
<p className="fine">Earlier bids do not count. The answer adds no funds or bidding opportunity.
Some combinations with other bidding commitments remain unavailable.</p>
{waiting && !game.phaseAnyBidGuide && <p>Your next supported opportunity may still be ahead.</p>}
{waiting && <PhaseAnyBidGuideButton {...props} />}
</section>;
}
+28 -1
View File
@@ -159,7 +159,7 @@ export function Truthtrance({
g.players.find((p) => p.id !== me.id)!.id,
);
const [kind, setKind] = useState<
'fact' | 'freeform' | 'charity' | 'battlePlan' | 'futureBattleLeader' | 'shipment' | 'mixedShipment' | 'movement' | 'traitorCall' | 'bid' | 'phaseBid' | 'richeseBid' | 'earlyRicheseBid' | 'revival' | 'bribe' | 'pledgeAid' | 'alliance' | 'leaderRevival' | 'gholaLeader' | 'revivalExpression' | 'bribeExpression' | 'movementExpression' | 'mixedMovement' | 'mixedBribe' | 'mixedRevival' | 'mixedBid' | 'mixedRicheseBid' | 'allianceExpression' | 'mixedAlliance' | 'mixedBattlePlan' | 'mixedTraitorCall' | 'travel' | 'turnActions'
'fact' | 'freeform' | 'charity' | 'battlePlan' | 'futureBattleLeader' | 'shipment' | 'mixedShipment' | 'movement' | 'traitorCall' | 'bid' | 'phaseBid' | 'phaseAnyBid' | 'richeseBid' | 'earlyRicheseBid' | 'revival' | 'bribe' | 'pledgeAid' | 'alliance' | 'leaderRevival' | 'gholaLeader' | 'revivalExpression' | 'bribeExpression' | 'movementExpression' | 'mixedMovement' | 'mixedBribe' | 'mixedRevival' | 'mixedBid' | 'mixedRicheseBid' | 'allianceExpression' | 'mixedAlliance' | 'mixedBattlePlan' | 'mixedTraitorCall' | 'travel' | 'turnActions'
>('fact');
const [revivalLeader, setRevivalLeader] = useState(g.allLeaders.find(leader =>
leader.faction === g.players.find(player => player.id === target)?.faction)?.id ?? '');
@@ -312,6 +312,7 @@ export function Truthtrance({
: kind === 'mixedRicheseBid' ? { kind, target, turn: g.turn, event: g.richeseAuction?.event ?? '', mixed: mixedBid }
: kind === 'bid' ? { kind, target, ...bidClaim }
: kind === 'phaseBid' ? { kind, target, ...phaseBidClaim }
: kind === 'phaseAnyBid' ? { kind, target, ...phaseBidClaim }
: kind === 'earlyRicheseBid' ? { kind, target, turn:g.turn, minimum:bidMinimum }
: kind === 'richeseBid' ? { kind, target, turn:g.turn, event:g.richeseAuction?.event ?? '', minimum:bidMinimum }
: kind === 'charity' ? { kind, target, turn:g.turn }
@@ -553,6 +554,13 @@ export function Truthtrance({
{button(`Answer ${answer === 'yes' ? 'Yes' : answer === 'no' ? 'No' : 'I don’t know'}`, { type: 'truthAnswer', answer })}
</div>)}
</>
) : w.question!.kind === 'phaseAnyBid' ? (
<>
<p className="notice">Yes requires one qualifying accepted bid in any supported auction before this Bidding phase closes, while possible. No forbids qualifying bids in those auctions. A bid does not promise a win; the original funding and payment rules still apply. Some combinations with other bidding commitments are not yet available.</p>
{(g.truthPhaseAnyBidAnswers ?? []).map(answer => <div key={answer}>
{button(`Answer ${answer === 'yes' ? 'Yes' : answer === 'no' ? 'No' : 'I don’t know'}`, { type: 'truthAnswer', answer })}
</div>)}
</>
) : w.question!.kind === 'bid' ? (
<>
<p className="notice">Yes requires one qualifying bid in this ordinary lot while possible. No forbids qualifying bids until it closes. A bid does not promise a win; winning still requires the original payment. Keep the funding needed by your answer.</p>
@@ -719,6 +727,7 @@ export function Truthtrance({
<option value="bid">Bind a bid in this ordinary lot</option>
<option value="charity">Bind a Charity claim this turn</option>
<option value="phaseBid">Bind an ordinary bid this Bidding phase</option>
<option value="phaseAnyBid">Bind a bid in any auction this Bidding phase</option>
<option value="earlyRicheseBid">Bind a bid in the first Richese cache auction</option>
<option value="richeseBid">Bind a bid in this Richese lot</option>
<option value="mixedRicheseBid">Combine current facts and a Richese bid</option>
@@ -907,6 +916,23 @@ export function Truthtrance({
{!g.truthPhaseBidTargets.includes(target) && <p className="notice">Choose a supported current-turn Bidding question and finish pending decisions.</p>}
<p className="notice" aria-label="Public phase bid question preview">{truthQuestionText(question, leaderName, locationName, name)}</p>
</>
) : kind === 'phaseAnyBid' ? (
<>
<fieldset className="grid gap-2" disabled={busy} aria-label="Any auction Bidding phase condition">
<legend>Bid in any auction during this turn</legend>
<p>Turn {g.turn} · Remaining Bidding phase</p>
<label htmlFor="truth-phase-any-bid-minimum">Minimum bid in spice</label>
<Input id="truth-phase-any-bid-minimum" type="number" min={1} max={Number.MAX_SAFE_INTEGER}
step={1} required disabled={busy} value={Number.isFinite(bidMinimum) ? bidMinimum : ''}
aria-describedby="truth-phase-any-bid-help" onChange={event => {
const next = event.currentTarget.valueAsNumber;
if (!busy && !phaseBidClaimInputError({turn:g.turn,minimum:next})) setBidMinimum(next);
}} />
<p className="fine" id="truth-phase-any-bid-help">One accepted qualifying bid in an ordinary, Richese cache or Black Market auction counts. Earlier bids do not count. A bid does not promise a win. Some combinations with other bidding commitments remain unavailable.</p>
</fieldset>
{!g.truthPhaseAnyBidTargets.includes(target) && <p className="notice">Choose a supported participant and finish pending decisions before asking.</p>}
<p className="notice" aria-label="Public any-auction bid question preview">{truthQuestionText(question, leaderName, locationName, name)}</p>
</>
) : kind === 'bid' ? (
<>
<BidClaimFields value={bidClaim} disabled={busy || !g.bidPromiseLot}
@@ -1058,6 +1084,7 @@ export function Truthtrance({
(kind === 'richeseBid' && (!!richeseBidMinimumError(bidMinimum) || !g.richeseAuction || !g.truthRicheseBidTargets.includes(target))) ||
(kind === 'charity' && !g.truthCharityTargets.includes(target)) ||
(kind === 'phaseBid' && (!!phaseBidClaimInputError(phaseBidClaim) || !g.truthPhaseBidTargets.includes(target))) ||
(kind === 'phaseAnyBid' && (!!phaseBidClaimInputError(phaseBidClaim) || !g.truthPhaseAnyBidTargets.includes(target))) ||
(kind === 'turnActions' && (!!turnActionsError || !g.truthTurnActionTargets.includes(target))) ||
(kind === 'travel' && (!!travelError || !g.truthTravelTargets.includes(target))) ||
(kind === 'mixedTraitorCall' && (!!mixedTraitorError || !g.truthMixedTraitorTargets.includes(target))) ||