'use client'; import { faction } from '@/game/catalog'; import { coalitionAllies } from '@/game/coalition-alliance'; import type { GameView } from '@/game/engine'; /** Alliance membership is public; a staged larger alliance has no scalar * player.ally value, so use its authoritative public membership ledger. */ export function RosterAlliance({game, playerId}: { game: Pick; playerId: string; }) { const player = game.players.find(seat => seat.id === playerId); if (!player) return null; const ids = game.coalitionState ? coalitionAllies(game.players, game.coalitionState, playerId) : player.ally ? [player.ally] : []; const names = ids.flatMap(id => { const ally = game.players.find(seat => seat.id === id); return ally ? [faction(ally.faction).name] : []; }); return names.length ?
Allied with {names.join(' and ')}
: null; }