'use client'; import { useState } from 'react'; import type { Action } from '@/game/engine'; import { homeworldCard } from '@/game/homeworld-cards'; import type { HomeworldOccupiedIncomeOffer } from '@/game/homeworld-occupied-income'; import { HomeworldFace } from './homeworld-cards'; import { Button } from './ui/button'; import { Input } from './ui/input'; export type HomeworldOccupiedIncomeProps = { offer: HomeworldOccupiedIncomeOffer | null; act: (action: Action) => void; busy: boolean; }; export function HomeworldOccupiedIncome({ offer, act, busy }: HomeworldOccupiedIncomeProps) { if (!offer) return null; return ; } function IncomeChoice({ offer, act, busy }: HomeworldOccupiedIncomeProps & { offer: HomeworldOccupiedIncomeOffer }) { const [ownAmount, setOwnAmount] = useState(offer.amount); const valid = Number.isSafeInteger(ownAmount) && ownAmount >= offer.minOwnAmount && ownAmount <= offer.maxOwnAmount; const card = homeworldCard(offer.card)!; return (

{offer.name} · occupied bank income

Collect {offer.amount} spice from the Bank. Keep all of it {offer.allyName ? `, or immediately allocate any portion to ${offer.allyName}.` : '; you have no reciprocal ally to share with.'}

This is the printed Homeworld bank award, not a percentage of payments or a bribe from your personal spice. Homeworld effects cannot be canceled by Karama.

Inspect {offer.name} source card
{offer.blocked && {offer.blocked}}
{ event.preventDefault(); if (!busy && !offer.blocked && valid) act({ type: 'decision', event: offer.event, world: offer.world, ownAmount }); }} > {offer.ally && ( <>
)} {valid ? `Bank credits: ${offer.ownerName} ${ownAmount}${offer.allyName ? ` · ${offer.allyName} ${offer.amount - ownAmount}` : ''}. Total ${offer.amount}.` : `Keep a whole number from ${offer.minOwnAmount} through ${offer.maxOwnAmount}.`}
); }