Preserve Emperor gift opportunity before bot phase pass
Verify and publish checkpoint container / container (push) Successful in 10m48s
Verify and publish checkpoint container / container (push) Successful in 10m48s
This commit is contained in:
1 parent
021a8c3e7f
commit
0c64d320ea
10 files changed
+238
-5
No files matched your search
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import type {Action, GameView} from '@/game/engine';
|
||||
|
||||
/** This notice remains visible even when the Emperor has no spice to share. */
|
||||
export function EmperorPhaseOpeningPriority({game, act, busy}: {
|
||||
game: Pick<GameView, 'emperorPhaseOpeningPriority' | 'players'>;
|
||||
act: (action:Action) => void;
|
||||
busy: boolean;
|
||||
}) {
|
||||
const priority = game.emperorPhaseOpeningPriority;
|
||||
if (!priority) return null;
|
||||
const event = priority.event;
|
||||
const recipient = game.players.find(player => player.id === priority.recipient)?.name ?? 'their ally';
|
||||
const canContinue = !busy && priority.canContinue && !!event;
|
||||
return <section className="notice space-y-3" aria-label="Emperor phase opening opportunity" aria-live="polite">
|
||||
<h3>Emperor alliance opportunity</h3>
|
||||
<p>Before the phase begins, the Emperor may share spice with {recipient}.</p>
|
||||
{priority.canContinue
|
||||
? <button type="button" className="game-action" disabled={!canContinue}
|
||||
onClick={() => {if (canContinue && game.emperorPhaseOpeningPriority === priority && priority.canContinue && priority.event === event)
|
||||
act({type:'emperorPhaseOpeningContinue', event});}}>Continue to phase</button>
|
||||
: <p>Waiting for the Emperor to continue.</p>}
|
||||
</section>;
|
||||
}
|
||||
Reference in new issue
Block a user