Support Truthtrance No-Field shipment promises
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
9ab9b9a613
commit
7fccd62814
16 files changed
+658
-32
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
parseShipmentExpression,
|
||||
ShipmentClaimError,
|
||||
shipmentExpressionOf,
|
||||
shipmentClaimHasNoField,
|
||||
type ShipmentExpression,
|
||||
} from '@/game/shipment-promises';
|
||||
import { shipmentExpressionInputError } from '@/game/shipment-expression-input';
|
||||
@@ -23,7 +24,8 @@ export function TruthShipmentQuestion({ game, question, busy, act, onChange }: {
|
||||
const ownsQuestion = () => !!game.me && game.players.some(player => player.id === game.me) &&
|
||||
game.truthtrance?.stage === 'ask' && game.truthtrance.queue[0]?.player === game.me;
|
||||
const hasTarget = () => question.target !== game.me && game.players.some(player => player.id === question.target);
|
||||
const supported = () => hasTarget() && game.truthShipmentTargets.includes(question.target);
|
||||
const supported = () => hasTarget() && game.truthShipmentTargets.includes(question.target) &&
|
||||
(!shipmentClaimHasNoField(question) || game.players.some(player => player.id === question.target && player.faction === 'richese'));
|
||||
const inputError = () => {
|
||||
try {
|
||||
parseShipmentExpression(shipmentExpressionOf(question), { allowConstants: false });
|
||||
@@ -37,8 +39,9 @@ export function TruthShipmentQuestion({ game, question, busy, act, onChange }: {
|
||||
const error = inputError();
|
||||
return <>
|
||||
{hasTarget() ? <ShipmentExpressionFields value={shipmentExpressionOf(question)}
|
||||
disabled={busy || !ownsQuestion() || !supported()} onChange={next => {
|
||||
if (!busy && ownsQuestion() && supported() && !shipmentExpressionInputError(next)) onChange(next);
|
||||
allowNoField={game.players.some(player => player.id === question.target && player.faction === 'richese')}
|
||||
disabled={busy || !ownsQuestion() || !game.truthShipmentTargets.includes(question.target)} onChange={next => {
|
||||
if (!busy && ownsQuestion() && hasTarget() && game.truthShipmentTargets.includes(question.target) && !shipmentExpressionInputError(next)) onChange(next);
|
||||
}} /> : <p className="notice">Choose another seated player for this question.</p>}
|
||||
{!supported() && <p className="notice">Choose an eligible respondent with an unused shipment this turn and finish pending decisions.</p>}
|
||||
<blockquote data-testid="truth-shipment-preview">
|
||||
|
||||
Reference in new issue
Block a user