Files
Dune/components/leader-skill-battle-guide.tsx

28 lines
3.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { GameView } from '@/game/engine';
import { usesSurvivingSkilledLeader } from '@/game/leader-skill-combat';
import { leaderSkillStrongholdCount } from '@/game/leader-skill-battle-board';
/** Guidance uses only the viewer's selected disc and public board occupation. */
export function LeaderSkillBattleGuide({ game, leader }: { game: GameView; leader: string }) {
const battle = game.battle;
if (!battle || ![battle.attacker, battle.defender].includes(game.me)) return null;
const assignments = game.leaderSkills?.assignments.filter((a) => a.controller === game.me) ?? [];
const opponent = game.players.find((p) => p.id === (battle.attacker === game.me ? battle.defender : battle.attacker))!;
const mentat = usesSurvivingSkilledLeader(assignments, 'mentat', leader, true);
const bureaucrat = usesSurvivingSkilledLeader(assignments, 'bureaucrat', leader, true);
const sandmaster = usesSurvivingSkilledLeader(assignments, 'sandmaster', leader, true);
const rihani = usesSurvivingSkilledLeader(assignments, 'rihani-decipherer', leader, true);
const smuggler = usesSurvivingSkilledLeader(assignments, 'smuggler', leader, true);
if (!mentat && !bureaucrat && !sandmaster && !rihani && !smuggler) return null;
return <div className="notice" aria-label="Leader Skill battle effect">
{mentat && <p>Mentat adds 2 to this leader’s battle strength if the leader survives.</p>}
{bureaucrat && <p>Bureaucrat subtracts {leaderSkillStrongholdCount(game, opponent)} from your opponent’s battle total if your leader survives. Count each occupied stronghold once, including contested strongholds. Advisors do not count.</p>}
{sandmaster && <p>If this Sandmaster survives and wins, add 3 spice to an existing pile in the territory. One pile resolves automatically; with several, provisionally choose its sector. No existing spice means no addition.</p>}
{rihani && <p>If this Rihani Decipherer survives and wins, you may draw two Traitors and exchange an unused old card for one of them. A native Rihani also privately inspects two deck cards first.</p>}
{smuggler && <p>{game.battle!.smugglerCollectionEnabled
? 'Smuggler records the territory’s positive piles when both plans reveal. Provisional strength policy: the cap includes the copied or printed disc value, declared leader bonuses and Kwisatz. A surviving leader collects even if you lose or have no forces left, unless an actual zero-strength weapon effect resolves. A partial collection across several piles asks you for sector amounts; single-pile and all/none collections stay automatic. Pending spice cannot fund this plan. This modifier policy is not a publisher ruling; other combined modules remain under review.'
: 'This saved battle predates automatic Smuggler collection. Its original battle behavior is preserved; new battles use the current collection flow.'}</p>}
{(mentat || bureaucrat) && <p className="fine">These score effects resolve automatically. They do not change the leader’s printed value or spice bounty.</p>}
</div>;
}