Allow Advanced Emperor gifts during Guild rate responses
Verify and publish checkpoint container / container (push) Successful in 11m3s
Verify and publish checkpoint container / container (push) Successful in 11m3s
This commit is contained in:
1 parent
b3843bf18e
commit
5e7f7b45e4
14 files changed
+475
-6
No files matched your search
@@ -0,0 +1,27 @@
|
||||
'use client';
|
||||
|
||||
import type {Action, GameView} from '@/game/engine';
|
||||
|
||||
/** A public, balance-independent opportunity for the Emperor's ally gift. */
|
||||
export function EmperorGuildRatePriority({game, act, busy}: {
|
||||
game: Pick<GameView, 'emperorGuildRatePriority' | 'players'>;
|
||||
act: (action:Action) => void;
|
||||
busy: boolean;
|
||||
}) {
|
||||
const priority = game.emperorGuildRatePriority;
|
||||
if (!priority) return null;
|
||||
const event = priority.event;
|
||||
const recipient = game.players.find(player => player.id === priority.recipient)?.name ?? 'their ally';
|
||||
const canContinue = () => !busy && game.emperorGuildRatePriority === priority &&
|
||||
priority.canContinue && priority.event === event && typeof event === 'string' && event.length > 0;
|
||||
return <section className="notice space-y-3" aria-label="Emperor Guild rate opportunity" aria-live="polite">
|
||||
<h3>Emperor alliance opportunity</h3>
|
||||
<p>Before the Guild rate response continues, the Emperor may share spice with {recipient}.</p>
|
||||
{priority.canContinue
|
||||
? <button type="button" className="game-action" disabled={!canContinue()}
|
||||
onClick={() => {if (canContinue()) act({type:'emperorGuildRateContinue', event});}}>
|
||||
Continue to Guild rate
|
||||
</button>
|
||||
: <p>Waiting for the Emperor to continue.</p>}
|
||||
</section>;
|
||||
}
|
||||
Reference in new issue
Block a user