Allow Emperor gifts during Moritani extortion
Verify and publish checkpoint container / container (push) Successful in 11m51s
Verify and publish checkpoint container / container (push) Successful in 11m51s
This commit is contained in:
1 parent
6cec4ed78b
commit
538247e777
8 files changed
+307
-4
No files matched your search
@@ -3,8 +3,8 @@
|
||||
import { useId, useState } from 'react';
|
||||
import type { Action, GameView } from '@/game/engine';
|
||||
|
||||
/** The engine projects this opportunity only to the Emperor at a supported
|
||||
* Guild timing decision. Its maximum already accounts for committed spice. */
|
||||
/** The engine projects these opportunities only to the Emperor. Their
|
||||
* maximum already accounts for committed spice. */
|
||||
export function EmperorTimingGift({ game, act, busy }: {
|
||||
game: GameView;
|
||||
act: (action: Action) => void;
|
||||
@@ -12,7 +12,8 @@ export function EmperorTimingGift({ game, act, busy }: {
|
||||
}) {
|
||||
const id = useId();
|
||||
const [raw, setRaw] = useState('1');
|
||||
const offer = game.emperorGuildTimingGift;
|
||||
const extortion = game.emperorExtortionGift;
|
||||
const offer = extortion ?? game.emperorGuildTimingGift;
|
||||
if (!offer) return null;
|
||||
const amount = /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN;
|
||||
const canShare = !busy && Number.isSafeInteger(amount) && amount >= 1 && amount <= offer.maximum;
|
||||
@@ -20,7 +21,9 @@ export function EmperorTimingGift({ game, act, busy }: {
|
||||
|
||||
return <section className="notice min-w-0 space-y-3 break-words" aria-label="Emperor spice gift">
|
||||
<h3>Share spice with {recipient}</h3>
|
||||
<p className="fine">The Guild timing decision resumes after the Karama response to your gift.</p>
|
||||
<p className="fine">{extortion
|
||||
? 'The Moritani Extortion decision resumes after the Karama response to your gift.'
|
||||
: 'The Guild timing decision resumes after the Karama response to your gift.'}</p>
|
||||
<label htmlFor={`${id}-amount`}>Spice to share</label>
|
||||
<input id={`${id}-amount`} type="number" inputMode="numeric" min={1} max={offer.maximum}
|
||||
step={1} value={raw} disabled={busy} onChange={event => setRaw(event.target.value)} />
|
||||
|
||||
Reference in new issue
Block a user