Show public live combat forces and scope player hovercards to identity

This commit is contained in:
coyotte508 2026-11-04 21:30:32 +00:00
commit 9b4338828e
36 changed files with 959 additions and 76 deletions

View file

@ -246,7 +246,13 @@ pub(crate) trait AbilityInitializerSetup: Sized {
+ Sync
+ Send,
) -> Self {
self.add_simple_persistent_event_listener(
let preview = listener.clone();
self.add_transient_event_listener(
|event| &mut event.combat_strength_preview,
priority,
move |strength, combat, game, p| preview(game, combat, strength, combat.role(p.index)),
)
.add_simple_persistent_event_listener(
|event| &mut event.combat_round_start,
priority,
move |game, p, s| {

View file

@ -52,19 +52,13 @@ pub(crate) fn use_great_warlord() -> Ability {
}
},
)
.add_simple_persistent_event_listener(
|event| &mut event.combat_round_start,
9,
|_game, p, r| {
if r.combat.modifiers.contains(&CombatModifier::GreatWarlord)
&& r.combat.attacker() == p.index
{
r.attacker_strength.extra_combat_value += 2;
r.attacker_strength
.roll_log
.push("Player gets +2 combat value for Great Warlord".to_string());
}
},
)
.add_combat_strength_listener(9, |_game, combat, strength, role| {
if combat.modifiers.contains(&CombatModifier::GreatWarlord) && role.is_attacker() {
strength.extra_combat_value += 2;
strength
.roll_log
.push("Player gets +2 combat value for Great Warlord".to_string());
}
})
.build()
}

View file

@ -50,26 +50,36 @@ fn great_wall() -> WonderInfo {
ResourcePile::new(3, 2, 7, 0, 0, 0, 5),
Advance::Siegecraft,
)
.add_transient_event_listener(
|event| &mut event.combat_opponent_strength_preview,
8,
|s, c, game, p| great_wall_strength(game, c, p.index, s),
)
.add_simple_persistent_event_listener(
|event| &mut event.combat_round_start,
8,
move |game, p, s| {
let c = &s.combat;
if c.first_round()
&& c.role(p.index) == CombatRole::Defender
&& c.defender_city(game)
.is_some_and(|c| c.mood_state == MoodState::Happy)
{
s.attacker_strength.extra_combat_value -= 2;
s.attacker_strength
.roll_log
.push("Great Wall gives -2 combat value in the first round".to_string());
}
},
|game, p, s| great_wall_strength(game, &s.combat, p.index, &mut s.attacker_strength),
)
.build()
}
fn great_wall_strength(
game: &Game,
c: &crate::combat::Combat,
owner: usize,
s: &mut crate::combat_listeners::CombatStrength,
) {
if c.first_round()
&& c.role(owner) == CombatRole::Defender
&& c.defender_city(game)
.is_some_and(|city| city.mood_state == MoodState::Happy)
{
s.extra_combat_value -= 2;
s.roll_log
.push("Great Wall gives -2 combat value in the first round".to_string());
}
}
fn great_statue() -> WonderInfo {
WonderInfo::builder(
Wonder::GreatStatue,

View file

@ -51,6 +51,10 @@ impl PlayerEvents {
}
pub(crate) struct TransientEvents {
// Read-only projection of the same public, unconditional round-strength rules.
pub combat_strength_preview: Event<crate::combat_listeners::CombatStrength, Combat, Game>,
pub combat_opponent_strength_preview:
Event<crate::combat_listeners::CombatStrength, Combat, Game>,
pub on_influence_culture_attempt:
Event<Result<InfluenceCultureAttemptInfo, String>, City, Game>,
pub on_influence_culture_resolve: Event<Game, InfluenceCultureOutcome>,
@ -76,6 +80,8 @@ pub(crate) struct TransientEvents {
impl TransientEvents {
pub fn new() -> TransientEvents {
TransientEvents {
combat_strength_preview: Event::new("combat_strength_preview"),
combat_opponent_strength_preview: Event::new("combat_opponent_strength_preview"),
on_influence_culture_attempt: Event::new("on_influence_culture_attempt"),
on_influence_culture_resolve: Event::new("on_influence_culture_resolve"),
before_move: Event::new("before_move"),

View file

@ -25,6 +25,7 @@ use serde_json::{Value, json};
mod actions;
mod collection_potential;
mod combat_estimate;
mod combat_summary;
mod decisions;
mod effects;
mod journal;
@ -268,7 +269,7 @@ pub fn view(game: &Game, seat: Option<usize>) -> Value {
"cities": p.cities.iter().map(|c| json!({"position": c.position, "size": c.size(), "capacity": c.mood_modified_size(p), "mood": c.mood_state, "activations": c.activations,"protection":crate::content::civilizations::egypt::protection(p,c.position),"independentPort":crate::content::civilizations::phoenicia::independent_port(game,c.pieces.port),"influenceMarker":c.influence_marker})).collect::<Vec<_>>()
})).collect::<Vec<_>>();
let Some(seat) = seat else {
let mut result = json!({"logOriginNames":log_origin_names,"builtWonders":built_wonders,"cardCatalog":card_catalog,"eventCatalog":event_catalog,"activeEffects":active_effects,"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"waitingFor":waiting_for,"activePlayers":active_players,"activePlayer": active, "canPlay": false, "supportedPhase": supported_phase, "players": players, "cities": [], "advances": [], "objectiveCards": [], "wonderCards": [], "wonderCatalog":wonder_catalog, "objectiveDecision": null, "cityActions": [], "settlers": [], "stopMovement": null, "canUndo": false, "canEndTurn": false, "barbarianGuide":barbarian_guide,"pirateSpawns":pirate_spawns,"seaRoutes":sea_routes});
let mut result = json!({"logOriginNames":log_origin_names,"builtWonders":built_wonders,"cardCatalog":card_catalog,"eventCatalog":event_catalog,"activeEffects":active_effects,"combatSummary":combat_summary::describe(game),"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"waitingFor":waiting_for,"activePlayers":active_players,"activePlayer": active, "canPlay": false, "supportedPhase": supported_phase, "players": players, "cities": [], "advances": [], "objectiveCards": [], "wonderCards": [], "wonderCatalog":wonder_catalog, "objectiveDecision": null, "cityActions": [], "settlers": [], "stopMovement": null, "canUndo": false, "canEndTurn": false, "barbarianGuide":barbarian_guide,"pirateSpawns":pirate_spawns,"seaRoutes":sea_routes});
result["tradeRoutes"] = json!(trade_routes);
result["regions"] = json!(regions);
return result;
@ -458,6 +459,7 @@ pub fn view(game: &Game, seat: Option<usize>) -> Value {
.collect::<Vec<_>>()
);
result["activeEffects"] = json!(active_effects);
result["combatSummary"] = combat_summary::describe(game);
result["earlyChoices"] = json!(early_offers);
result
}

View file

@ -0,0 +1,70 @@
//! Deterministic public bonuses, not a simulated roll. The registered pure
//! listeners are shared with combat resolution; no payment or tactics is executed.
use crate::advance::Advance;
use crate::combat::{Combat, CombatModifier};
use crate::combat_listeners::CombatStrength;
use crate::content::persistent_events::PersistentEventType;
use crate::game::Game;
use serde_json::{Value, json};
fn strength(game: &Game, combat: &Combat, player: usize) -> CombatStrength {
let mut result = CombatStrength::new();
// Exclude tactics-dependent bonuses (e.g. Prepared) rather than assuming
// that an unchosen or hidden card means no card will be played.
result.tactics_card = Some(0);
game.player(player)
.trigger_event(|e| &e.combat_strength_preview, &mut result, combat, game);
game.player(combat.opponent(player)).trigger_event(
|e| &e.combat_opponent_strength_preview,
&mut result,
combat,
game,
);
result
}
pub(super) fn describe(game: &Game) -> Value {
let combat = game
.events
.iter()
.rev()
.find_map(|event| match &event.event_type {
PersistentEventType::CombatEnd(_) | PersistentEventType::CombatRoundEnd(_) => {
Some(None)
}
PersistentEventType::CombatStart(c) => Some(Some(c)),
PersistentEventType::CombatRoundStart(r) => Some(Some(&r.combat)),
_ => None,
})
.flatten();
let Some(c) = combat else {
return Value::Null;
};
let side = |player, modifier| {
let mut s = strength(game, c, player);
let mut inactive = Vec::new();
if c.is_land_battle(game)
&& game.player(player).can_use_advance(Advance::SteelWeapons)
&& !c.modifiers.contains(&modifier)
{
let mut activated = c.clone();
activated.modifiers.push(modifier);
let bonus =
strength(game, &activated, player).extra_combat_value - s.extra_combat_value;
inactive.push(format!(
"Steel Weapons not activated: +{bonus} value if activated"
));
}
if crate::content::civilizations::persia::caps_opponent_bonus(game, c, player) {
s.extra_combat_value = s.extra_combat_value.min(2);
s.roll_log
.push("Round 1: total bonus capped at +2, including dice-symbol bonuses".into());
}
json!({"dice": c.fighting_units(game, player).len() + usize::from(s.extra_dies),
"extraDice":s.extra_dies,"valueBonus":s.extra_combat_value,
"hitCancels":s.hit_cancels,"effects":s.roll_log,"inactive":inactive})
};
json!({"round":c.stats.round,
"attacker":side(c.attacker(), CombatModifier::SteelWeaponsAttacker),
"defender":side(c.defender(), CombatModifier::SteelWeaponsDefender)})
}

View file

@ -920,3 +920,18 @@ layout with numeric action costs and action icons. Research payment allocation
omits redundant explanatory text and totals while retaining explicit confirmation;
other payment pickers are unchanged. Regression coverage includes private-hand
filtering and English/French desktop/mobile research flows.
# Viewer 0.1.200 / engine 0.4.134
Player hovercards now open only over the player's name/avatar, not the surrounding
civilization tile. Live combat decisions share a compact journal-style force table:
only engaged attacker IDs count, alongside surviving defenders, dice and public
combat-value effects. Fortress round-one dice/protection and activated versus
conditional Steel Weapons use the engine's existing rules. Unresolved choices,
tactics and dice-symbol effects are excluded explicitly in the tooltip. Duplicate
totals and the generic tactics instruction are removed.
The read-only public projection shares pure combat listeners without executing
payments, tactics, rolls or mutations. Existing battle resolution and saved history
are unchanged. New UI strings are translated in all 17 locales. Publish the matching
viewer and engine together.

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.199",
"version": "0.1.200",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.199",
"version": "0.1.200",
"dependencies": {
"@boardgamers/protocol": "0.9.0",
"lucide-svelte": "^0.577.0",

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.199",
"version": "0.1.200",
"private": true,
"type": "module",
"scripts": {

View file

@ -0,0 +1,156 @@
// Offline regression against the fresh production viewer; no BGS moves are sent.
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import { readFileSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import { chromium } from 'playwright';
const engine = createRequire(import.meta.url)('../.engine/server.js');
function battle() {
const g = JSON.parse(
readFileSync(
new URL('../../server/tests/test_games/combat/direct_capture_city_fortress.json', import.meta.url),
'utf8',
),
);
g.players[0].advances = ['Farming', 'Mining', 'Tactics', 'SteelWeapons'];
g.players[1].advances = ['Farming', 'Mining', 'Tactics'];
g.players[0].units = [0, 1, 2, 3].map((id) => ({ id, position: 'C2', unit_type: 'Infantry' }));
g.players[1].units = [0, 1].map((id) => ({ id, position: 'C1', unit_type: 'Infantry' }));
g.players[1].cities = [{ position: 'C1', mood_state: 'Happy', city_pieces: { fortress: 1 } }];
g.events = [
{
event_type: {
CombatRoundStart: {
phase: 'Default',
combat: {
attackers: [0, 1, 2],
retreat: 'CanRetreat',
modifiers: [],
stats: {
round: 1,
battleground: 'CityWithFortress',
attacker: { player: 0, position: 'C2', present: { infantry: 3 } },
defender: { player: 1, position: 'C1', present: { infantry: 2 } },
},
},
attacker_strength: {},
defender_strength: {},
},
},
players_used: [0],
player: 1,
last_priority_used: 0,
handler: {
priority: 0,
request: {
SelectHandCards: { choices: [], needed: { start: 0, end: 1 }, description: 'Play Tactics Card' },
},
origin: { Advance: 'Tactics' },
},
},
];
return g;
}
const npcs = JSON.parse(await engine.init(2, [], {}, 'combat-forces-smoke', {})).players.slice(2);
const browser = await chromium.launch({
headless: true,
args: ['--use-gl=angle', '--use-angle=swiftshader'],
});
try {
for (const locale of ['en', 'fr'])
for (const [width, height] of [
[1400, 900],
[390, 740],
]) {
const page = await browser.newPage({ viewport: { width, height } });
page.setDefaultTimeout(30000);
const errors = [];
page.on('pageerror', (e) => errors.push(e.message));
await page.route('**/*', async (route) => {
const url = new URL(route.request().url());
if (url.hostname !== 'clash.test') return route.abort();
if (url.pathname === '/')
return route.fulfill({
contentType: 'text/html',
body: '<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><div id="app"></div><script src="/viewer.js"></script>',
});
const path = decodeURIComponent(url.pathname.slice(1));
assert(!path.includes('..'));
const types = {
js: 'text/javascript',
json: 'application/json',
wasm: 'application/wasm',
woff2: 'font/woff2',
svg: 'image/svg+xml',
};
try {
return route.fulfill({
contentType: types[path.split('.').at(-1)] ?? 'application/octet-stream',
body: await readFile(new URL('../dist/' + path, import.meta.url)),
});
} catch {
return route.abort();
}
});
const game = battle();
for (const npc of npcs)
if (!game.players.some((p) => p.civilization === npc.civilization))
game.players.push({ ...npc, id: game.players.length });
await page.goto('http://clash.test/');
await page.evaluate(
({ state, locale }) => {
window.host = clash3d.launch('#app');
window.sent = [];
window.hovered = [];
host.on('move', (action) => sent.push(action));
host.on('player:hovered', (data) => hovered.push(data));
host.emit('player', { index: 1 });
host.emit('avatars', ['data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>']);
host.emit('theme', { dark: true });
host.emit('preferences', { sound: false, locale });
host.emit('state', state);
},
{ state: engine.stripSecret(JSON.stringify(game), 1), locale },
);
const table = page.locator('.combat-forces');
await table.waitFor();
const rows = table.locator('tbody tr');
assert.deepEqual(await rows.nth(0).locator('td b').allTextContents(), ['3', '2']);
assert.deepEqual(await rows.nth(1).locator('td b').allTextContents(), ['3', '3']);
assert.match(await rows.nth(3).innerText(), locale === 'en' ? /not activated/ : /non activées/);
assert.equal(await page.getByText('Play one battle effect or skip.', { exact: true }).count(), 0);
game.events[0].event_type.CombatRoundStart.combat.modifiers.push('SteelWeaponsAttacker');
await page.evaluate((state) => host.emit('state', state), engine.stripSecret(JSON.stringify(game), 1));
await page.waitForFunction(
() => document.querySelector('.combat-forces tbody tr:nth-child(3) td')?.textContent?.trim() === '+2',
);
assert.deepEqual(await rows.nth(1).locator('td b').allTextContents(), ['3', '3']);
const card = page.locator('.player-card').first();
if (width >= 1100) {
await card.locator('.player-info strong').hover();
assert.equal(await page.evaluate(() => hovered.filter(Boolean).length), 0);
await card.locator('.player-score').hover();
assert.equal(await page.evaluate(() => hovered.filter(Boolean).length), 0);
await card.locator('.player-name').hover();
assert.equal(await page.evaluate(() => hovered.at(-1)?.index), 0);
await card.locator('.player-score').hover();
assert.equal(await page.evaluate(() => hovered.at(-1)), null);
await card.locator('.player-avatar').hover();
assert.equal(await page.evaluate(() => hovered.at(-1)?.index), 0);
} else {
// The mobile decision panel hides the player strip; no hovercard is opened.
assert.equal(await card.isVisible(), false);
assert.equal(await page.evaluate(() => hovered.filter(Boolean).length), 0);
}
assert.deepEqual(await page.evaluate(() => sent), []);
assert.deepEqual(errors, []);
const bounds = await table.boundingBox();
assert(bounds.x >= 0 && bounds.x + bounds.width <= width + 1);
await page.close();
console.log(
`${locale} ${width}px: engaged units, fortress, conditional/active Steel Weapons, identity-only hover passed`,
);
}
} finally {
await browser.close();
}

View file

@ -964,17 +964,6 @@
.filter(Boolean)
.join('. ')}
onclick={() => controller.patch({ scorePlayer: player.index })}
onmouseenter={(e) => {
const r = e.currentTarget.getBoundingClientRect();
controller.commands.hoverPlayer(player.index, {
x: r.x,
y: r.y,
width: r.width,
height: r.height,
});
}}
onmouseleave={() => controller.commands.leavePlayer()}
onfocus={() => {}}
onblur={() => controller.commands.leavePlayer()}
>
<span class="civilization-watermark" aria-hidden="true"
@ -991,18 +980,32 @@
>{/if}</span
><span class="player-info"
><strong>{player.civilization}</strong><small
>{#if $session.avatars[player.index]}<img
class="player-avatar"
src={$session.avatars[player.index]}
alt=""
/>{/if}<span class="player-name">{player.index === $session.seat
? 'You'
: player.name}</span>{#if $session.playerBadges?.[player.index]}<img
class="supporter-badge"
src={$session.playerBadges[player.index]!.url}
alt={$session.playerBadges[player.index]!.label}
title={$session.playerBadges[player.index]!.label}
/>{/if}</small
><span
class="player-identity"
role="group"
onmouseenter={(e) => {
const r = e.currentTarget.getBoundingClientRect();
controller.commands.hoverPlayer(player.index, {
x: r.x,
y: r.y,
width: r.width,
height: r.height,
});
}}
onmouseleave={() => controller.commands.leavePlayer()}
>{#if $session.avatars[player.index]}<img
class="player-avatar"
src={$session.avatars[player.index]}
alt=""
/>{/if}<span class="player-name"
>{player.index === $session.seat ? 'You' : player.name}</span
>{#if $session.playerBadges?.[player.index]}<img
class="supporter-badge"
src={$session.playerBadges[player.index]!.url}
alt={$session.playerBadges[player.index]!.label}
title={$session.playerBadges[player.index]!.label}
/>{/if}</span
></small
><span class="player-events"><EventMarkers remaining={player.eventTokens} /></span>
{#if turnLabel || progressLabel}<span class="player-turn" class:round-inactive={!turnLabel}
>{#if turnLabel || status === 'current'}<ArrowRight

View file

@ -0,0 +1,103 @@
<script lang="ts">
import { combatForces } from './combat-forces';
import type { Game, View } from './types';
import UnitIcon from './UnitIcon.svelte';
let { game, view }: { game: Game | null; view: View | null } = $props();
const forces = $derived(combatForces(game));
const summary = $derived(view?.combatSummary?.round === forces?.round ? view?.combatSummary : null);
const sides = $derived([
{ label: 'Attacker', force: forces?.attacker, bonus: summary?.attacker },
{ label: 'Defender', force: forces?.defender, bonus: summary?.defender },
]);
</script>
{#if forces}
<section class="combat-forces" aria-label="Current combat forces">
<div class="force-heading">Battle · Round {forces.round}</div>
<table
class="combat-table"
aria-label="Public combat bonuses before tactics"
title="Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices"
>
<thead
><tr
><td></td>{#each sides as side}<th scope="col">{side.label}</th>{/each}</tr
></thead
>
<tbody>
<tr
><th scope="row">Units</th>{#each sides as side}<td
><div class="combat-units">
{#if side.force}
{#each side.force.units as unit}
<span title={unit.label} aria-label={`${unit.count} ${unit.label}`}
><UnitIcon type={unit.type} size={14} /><b>{unit.count}</b></span
>
{:else}None{/each}
{:else}—{/if}
</div></td
>{/each}</tr
>
{#if summary}
<tr
><th scope="row">Dice</th>{#each sides as side}<td
><b>{side.bonus?.dice}</b>{#if side.bonus?.extraDice}<span class="detail"
>Includes +{side.bonus.extraDice} bonus</span
>{/if}</td
>{/each}</tr
>
<tr
><th scope="row">Value bonus</th>{#each sides as side}<td
>{(side.bonus?.valueBonus ?? 0) > 0 ? '+' : ''}{side.bonus?.valueBonus}</td
>{/each}</tr
>
{#if sides.some((s) => s.bonus?.effects.length || s.bonus?.inactive.length)}
<tr
><th scope="row">Effects</th>{#each sides as side}<td>
{#each side.bonus?.effects ?? [] as effect}<span class="detail"
>{effect
.replace('fortress cancelled one hit', 'Fortress: cancels 1 hit (round 1)')
.replace('fortress added one extra die', 'Fortress: +1 die (round 1)')}</span
>{/each}
{#each side.bonus?.inactive ?? [] as effect}<span class="detail inactive">{effect}</span
>{/each}
{#if !side.bonus?.effects.length && !side.bonus?.inactive.length}—{/if}
</td>{/each}</tr
>
{/if}
{/if}
</tbody>
</table>
</section>
{/if}
<style>
.combat-forces {
border: 1px solid var(--line);
border-radius: 8px;
padding: 0.65rem;
margin: 0.6rem 0;
}
.force-heading {
color: var(--muted);
font-size: 11px;
}
.combat-table {
table-layout: fixed;
width: 100%;
margin: 0.35rem 0;
}
.combat-table th:first-child {
width: 24%;
}
.detail {
display: block;
margin-top: 0.2rem;
font-size: 11px;
overflow-wrap: anywhere;
}
.inactive {
color: var(--muted);
font-style: italic;
}
</style>

View file

@ -5,6 +5,7 @@
import GreatPersonAcquisition from './GreatPersonAcquisition.svelte';
import RazeActions from './RazeActions.svelte';
import CombatEstimate from './CombatEstimate.svelte';
import CombatForces from './CombatForces.svelte';
import { printedCardName } from './card-names';
import { onDestroy } from 'svelte';
import { untrack } from 'svelte';
@ -53,7 +54,7 @@
const description = $derived(
razeChoice ? 'Select a highlighted city on the map.' : combatBenefit ??
(decision.tacticsSelection && decision.name === 'Tactics'
? 'Play one battle effect or skip.'
? ''
: decision.name === 'Place Settler'
? 'Free Settler after losing a city.'
: decision.description),
@ -280,6 +281,7 @@
</div>
{/if}
</header>
{#if !$session.playback}<CombatForces game={$session.game} view={$session.view} />{/if}
{#if cardOffer}
<GreatPersonEffect card={cardOffer} />
{/if}

View file

@ -8,12 +8,20 @@ export interface ActiveCombat {
/** Combat may sit below another pending ability on the event stack. */
export function activeCombat(game: Pick<Game, 'events'>): ActiveCombat | null {
return activeCombatState(game)?.stats ?? null;
}
/** Only the currently visible event stack; never history or an unredacted snapshot. */
export function activeCombatState(
game: Pick<Game, 'events'>,
): { stats: ActiveCombat; attackers?: number[] } | null {
for (const { event_type: event } of [...(game.events ?? [])].reverse()) {
if (typeof event !== 'object' || event === null) continue;
if ('CombatEnd' in event) return null;
const combat = (event.CombatStart ??
(event.CombatRoundStart as { combat?: unknown })?.combat ??
(event.CombatRoundEnd as { combat?: unknown })?.combat) as { stats?: ActiveCombat } | undefined;
(event.CombatRoundEnd as { combat?: unknown })?.combat) as
{ stats?: ActiveCombat; attackers?: number[] } | undefined;
const stats = combat?.stats;
if (
stats &&
@ -21,7 +29,7 @@ export function activeCombat(game: Pick<Game, 'events'>): ActiveCombat | null {
(side) => side && /^[A-Z]+\d+$/.test(side.position) && Number.isInteger(side.player),
)
)
return stats;
return { stats, attackers: combat?.attackers };
}
return null;
}
@ -29,7 +37,12 @@ export function activeCombat(game: Pick<Game, 'events'>): ActiveCombat | null {
/** Public advances include borrowed abilities, just as the engine's combat calculation does. */
export function steelWeaponsBenefit(game: Game | null, view: View | null, player?: number): string | null {
const combat = game && activeCombat(game);
if (!combat || !view || game?.map.tiles.find(([position]) => position === combat.defender.position)?.[1] === 'Water') return null;
if (
!combat ||
!view ||
game?.map.tiles.find(([position]) => position === combat.defender.position)?.[1] === 'Water'
)
return null;
const enemy =
combat.attacker.player === player
? combat.defender.player

View file

@ -0,0 +1,134 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { combatForces } from './combat-forces.ts';
import type { Game } from './types.ts';
function battle(): Game {
return {
state: null,
current_player_index: 1,
actions_left: 0,
age: 1,
round: 1,
log_index: 0,
events: [
{
event_type: {
CombatRoundStart: {
combat: {
attackers: [1, 2, 3],
stats: {
round: 1,
attacker: { player: 0, position: 'C2' },
defender: { player: 1, position: 'C1' },
},
},
},
},
},
],
players: [
{
id: 0,
civilization: 'Rome',
units: [1, 2, 3, 4].map((id) => ({
id,
position: 'C2',
unit_type: id === 3 ? 'Cavalry' : 'Infantry',
})),
},
{
id: 1,
civilization: 'Greece',
units: [
{ id: 1, position: 'C1', unit_type: 'Infantry' },
{ id: 2, position: 'C1', unit_type: 'Settler' },
],
},
],
map: { tiles: [['C1', 'Fertile']] },
} as Game;
}
test('defender tactics shows only three incoming participants, not four in source hex', () => {
const game = battle();
game.current_player_index = 1;
game.events!.push({ event_type: { Ability: { name: 'Tactics' } } });
const before = JSON.stringify(game);
const forces = combatForces(game)!;
assert.equal(forces.attacker!.count, 3);
assert.deepEqual(
forces.attacker!.units.map((u) => [u.label, u.count]),
[
['Infantry', 2],
['Cavalry', 1],
],
);
assert.equal(forces.defender!.count, 1);
assert.equal(JSON.stringify(game), before);
});
test('actual pending combat fixture resolves fighters using surviving engaged IDs', () => {
const game: Game = JSON.parse(
readFileSync(
new URL(
'../../server/tests/test_games/combat/remove_casualties_attacker.outcome.json',
import.meta.url,
),
'utf8',
),
);
const forces = combatForces(game)!;
assert.ok(forces.attacker && forces.defender);
assert.ok(forces.attacker.count > 0);
});
test('removed casualties are no longer counted and ended battles disappear', () => {
const game = battle();
const event = game.events![0].event_type as any;
event.CombatRoundStart.combat.attackers = [1, 3];
event.CombatRoundStart.combat.stats.round = 2;
game.players[0].units = game.players[0].units!.filter((u) => u.id !== 2);
assert.equal(combatForces(game)!.attacker!.count, 2);
assert.equal(combatForces(game)!.round, 2);
game.events!.push({ event_type: { CombatEnd: {} } });
assert.equal(combatForces(game), null);
});
test('sea battle counts ships, not passengers, settlers, or extra dice', () => {
const game = battle();
game.map.tiles = [['C1', 'Water']];
game.players[0].units![0].unit_type = 'Ship';
game.players[0].units![1].carrier_id = 1;
game.players[1].units![0].unit_type = 'Ship';
assert.equal(combatForces(game)!.attacker!.count, 1);
assert.equal(combatForces(game)!.defender!.count, 1);
});
test('missing visible IDs or units remain unknown rather than using source stack/history', () => {
const game = battle();
game.players[0].units = game.players[0].units!.filter((u) => u.id !== 3);
assert.equal(combatForces(game)!.attacker, null);
delete (game.events![0].event_type as any).CombatRoundStart.combat.attackers;
assert.equal(combatForces(game)!.attacker, null);
delete game.players[1].units;
assert.equal(combatForces(game)!.defender, null);
assert.equal(combatForces(null), null);
});
test('live force summary is mounted before decision options and suppressed in playback', () => {
const source = readFileSync(new URL('./DecisionPanel.svelte', import.meta.url), 'utf8');
assert.match(source, /\{#if !\$session.playback\}<CombatForces game=\{\$session.game\}/);
assert.ok(source.indexOf('<CombatForces') < source.indexOf('<TacticsOption'));
});
test('pre-roll CombatStart is supported and an empty fortress defense is zero units', () => {
const game = battle();
const combat = (game.events![0].event_type as any).CombatRoundStart.combat;
game.events = [{ event_type: { CombatStart: combat } }];
game.players[1].units = [];
game.players[1].cities = [{ position: 'C1', mood_state: 'Happy', city_pieces: { fortress: 1 } }];
assert.equal(combatForces(game)!.attacker!.count, 3);
assert.equal(combatForces(game)!.defender!.count, 0);
});

View file

@ -0,0 +1,52 @@
import { activeCombatState } from './active-combat.ts';
import type { Game, Player } from './types.ts';
type Unit = NonNullable<Player['units']>[number];
export interface CombatForce {
count: number;
units: { type: Unit['unit_type']; count: number; label: string }[];
}
function summarize(units: Unit[]): CombatForce {
const groups = new Map<string, CombatForce['units'][number]>();
for (const unit of units) {
// A generic leader label avoids consulting private card/leader catalogs.
const label = typeof unit.unit_type === 'string' ? unit.unit_type : 'Leader';
const group = groups.get(label) ?? { type: unit.unit_type, count: 0, label };
group.count++;
groups.set(label, group);
}
return { count: units.length, units: [...groups.values()] };
}
/** Current fighters, not the source stack or the original force before casualties.
* Mirrors active_attackers/active_defenders: armies on land, ships at sea.
* Missing visible participant data is unknown, never guessed from a tile stack.
*/
export function combatForces(game: Game | null) {
if (!game) return null;
const combat = activeCombatState(game);
if (!combat) return null;
const { stats } = combat;
const terrain = game.map.tiles.find(([p]) => p === stats.defender.position)?.[1];
const knownTerrain = terrain !== undefined && terrain !== 'Unexplored';
const fighter = (u: Unit) =>
terrain === 'Water'
? u.unit_type === 'Ship'
: typeof u.unit_type === 'object' || ['Infantry', 'Cavalry', 'Elephant'].includes(u.unit_type);
const attackers = game.players.find((p) => p.id === stats.attacker.player)?.units;
const defenders = game.players.find((p) => p.id === stats.defender.player)?.units;
const ids = combat.attackers;
const selected = ids?.map((id) => attackers?.find((u) => u.id === id));
return {
round: stats.round,
attacker:
knownTerrain && selected && selected.every((u): u is Unit => !!u)
? summarize(selected.filter(fighter))
: null,
defender:
knownTerrain && defenders
? summarize(defenders.filter((u) => u.position === stats.defender.position && fighter(u)))
: null,
};
}

View file

@ -0,0 +1,147 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import { readFileSync } from 'node:fs';
const engine = createRequire(import.meta.url)(process.env.COMBAT_ENGINE ?? '../.engine/server.js');
function battle() {
const g = JSON.parse(
readFileSync(
new URL('../../server/tests/test_games/combat/direct_capture_city_fortress.json', import.meta.url),
'utf8',
),
);
g.players[0].advances = ['Farming', 'Mining', 'Tactics', 'SteelWeapons'];
g.players[1].advances = ['Farming', 'Mining', 'Tactics'];
g.players[0].units = [0, 1, 2, 3].map((id) => ({ id, position: 'C2', unit_type: 'Infantry' }));
g.players[1].units = [0, 1].map((id) => ({ id, position: 'C1', unit_type: 'Infantry' }));
g.players[1].cities = [{ position: 'C1', mood_state: 'Happy', city_pieces: { fortress: 1 } }];
g.events = [
{
event_type: {
CombatRoundStart: {
phase: 'Default',
combat: {
attackers: [0, 1, 2],
retreat: 'CanRetreat',
modifiers: [],
stats: {
round: 1,
battleground: 'CityWithFortress',
attacker: { player: 0, position: 'C2', present: { infantry: 3 } },
defender: { player: 1, position: 'C1', present: { infantry: 2 } },
},
},
attacker_strength: {},
defender_strength: {},
},
},
players_used: [0],
player: 1,
last_priority_used: 0,
handler: {
priority: 0,
request: {
SelectHandCards: { choices: [], needed: { start: 0, end: 1 }, description: 'Play Tactics Card' },
},
origin: { Advance: 'Tactics' },
},
},
];
return g;
}
const round = (g: any) => g.events[0].event_type.CombatRoundStart;
function summary(g: any, seat = 1) {
return JSON.parse(engine.webView(engine.stripSecret(JSON.stringify(g), seat), seat)).combatSummary;
}
test('engine public summary counts the actual three attackers and first-round fortress die/protection', () => {
const g = battle();
const before = JSON.stringify(g);
const s = summary(g);
assert.equal(s.attacker.dice, 3);
assert.equal(s.defender.dice, 3);
assert.equal(s.defender.extraDice, 1);
assert.equal(s.defender.hitCancels, 1);
assert.equal(JSON.stringify(g), before);
round(g).combat.stats.round = 2;
assert.equal(summary(g).defender.dice, 2);
assert.equal(summary(g).defender.hitCancels, 0);
});
test('unpaid Steel Weapons is conditional, paid +2/+1 is value not extra dice', () => {
const g = battle();
assert.equal(summary(g).attacker.valueBonus, 0);
assert.match(summary(g).attacker.inactive[0], /not activated: \+2/);
round(g).combat.modifiers.push('SteelWeaponsAttacker');
assert.equal(summary(g).attacker.valueBonus, 2);
assert.equal(summary(g).attacker.dice, 3);
assert.deepEqual(summary(g).attacker.inactive, []);
g.players[1].advances.push('SteelWeapons');
assert.equal(summary(g).attacker.valueBonus, 1);
assert.equal(summary(g).defender.valueBonus, 0);
assert.match(summary(g).defender.inactive[0], /not activated: \+1/);
round(g).combat.modifiers.push('SteelWeaponsDefender');
assert.equal(summary(g).defender.valueBonus, 1);
});
test('Siegecraft cancellations use the same fortress rules as resolution', () => {
const g = battle();
round(g).combat.modifiers.push('CancelFortressExtraDie');
assert.equal(summary(g).defender.dice, 2);
assert.equal(summary(g).defender.hitCancels, 1);
round(g).combat.modifiers.push('CancelFortressIgnoreHit');
assert.equal(summary(g).defender.hitCancels, 0);
});
test('hidden tactics, hands and random seeds cannot change public bonus projection', () => {
const g = battle();
const base = summary(g);
round(g).attacker_strength.tactics_card = 6;
g.players[0].action_cards = [7, 8];
g.seed = '999';
g.dice_roll_outcomes = [0, 0, 0];
assert.deepEqual(summary(g), base);
assert.deepEqual(summary(g, 0), base);
round(g).attacker_strength.tactics_card = 9;
assert.deepEqual(summary(g), base);
});
test('naval combat excludes Steel Weapons even with stale paid modifiers', () => {
const g = battle();
g.map.tiles = g.map.tiles.map(([p, t]: any) => [p, p === 'C1' ? 'Water' : t]);
for (const p of g.players.slice(0, 2)) for (const u of p.units) u.unit_type = 'Ship';
g.players[1].cities = [];
round(g).combat.modifiers.push('SteelWeaponsAttacker');
assert.equal(summary(g).attacker.valueBonus, 0);
assert.equal(summary(g).defender.extraDice, 0);
});
test('Great Wall penalty and Great Warlord value use public engine rules', () => {
const g = battle();
g.players[1].cities[0].city_pieces.wonders = ['GreatWall'];
assert.equal(summary(g).attacker.valueBonus, -2);
assert.equal(summary(g).defender.valueBonus, 0);
round(g).combat.modifiers.push('GreatWarlord');
assert.equal(summary(g).attacker.valueBonus, 0);
assert.match(summary(g).attacker.effects.join(' '), /Great Warlord/);
round(g).combat.stats.round = 2;
assert.equal(summary(g).attacker.valueBonus, 2);
});
test('empty fortress has one die, not a phantom unit; ended rounds stop projecting', () => {
const g = battle();
g.players[1].units = [];
assert.equal(summary(g).defender.dice, 1);
g.events = [];
assert.equal(summary(g), null);
});
test('repeated cached seat and spectator projections do not mutate public state or subsequent views', () => {
const g = battle();
const raw = JSON.stringify(g);
const publicRaw = engine.stripSecret(raw, 1);
const first = engine.webView(publicRaw, 1);
for (let i = 0; i < 4; i++) {
const spectator = engine.stripSecret(raw);
assert.deepEqual(JSON.parse(engine.webView(spectator)).combatSummary, summary(g));
summary(g, 0);
assert.equal(engine.webView(publicRaw, 1), first);
assert.equal(engine.stripSecret(raw, 1), publicRaw);
}
assert.equal(JSON.stringify(g), raw);
});

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Brug et kort eller en evne nedenfor i stedet for normal forskning. Dets egne omkostninger og effekter gælder stadig.",
"No research resource cost": "Ingen ressourceomkostning for forskning",
"Required for {p0}": "Påkrævet til {p0}",
"Wonder in your hand": "Vidunder på din hånd"
"Wonder in your hand": "Vidunder på din hånd",
"Current combat forces": "Aktuelle kampstyrker",
"Public combat bonuses before tactics": "Offentlige kampbonusser før taktikker",
"Value bonus": "Kampværdibonus",
"Fortress: cancels 1 hit (round 1)": "Fæstning: annullerer 1 træffer (runde 1)",
"Fortress: +1 die (round 1)": "Fæstning: +1 terning (runde 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Kun offentlige bonusser · uden taktikker, terningsymboleffekter og uafklarede valg",
"Steel Weapons not activated: +{p0} value if activated": "Stålvåben ikke aktiveret: +{p0} kampværdi ved aktivering",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Runde 1: samlet bonus begrænset til +2, inklusive terningsymbolbonusser",
"Battle · Round": "Kamp · Runde"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Nutze eine der folgenden Karten oder Fähigkeiten statt der normalen Forschung. Ihre eigenen Kosten und Effekte gelten weiterhin.",
"No research resource cost": "Keine Ressourcenkosten für die Forschung",
"Required for {p0}": "Erforderlich für {p0}",
"Wonder in your hand": "Wunder auf deiner Hand"
"Wonder in your hand": "Wunder auf deiner Hand",
"Current combat forces": "Aktuelle Kampftruppen",
"Public combat bonuses before tactics": "Öffentliche Kampfboni vor Taktiken",
"Value bonus": "Kampfwertbonus",
"Fortress: cancels 1 hit (round 1)": "Festung: verhindert 1 Treffer (Runde 1)",
"Fortress: +1 die (round 1)": "Festung: +1 Würfel (Runde 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Nur öffentliche Boni · ohne Taktiken, Würfelsymboleffekte und offene Entscheidungen",
"Steel Weapons not activated: +{p0} value if activated": "Stahlwaffen nicht aktiviert: +{p0} Kampfwert bei Aktivierung",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Runde 1: Gesamtbonus auf +2 begrenzt, einschließlich Würfelsymbolboni",
"Battle · Round": "Kampf · Runde"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Χρησιμοποιήστε μία από τις παρακάτω κάρτες ή ικανότητες αντί για κανονική έρευνα. Το κόστος και οι επιδράσεις της εξακολουθούν να ισχύουν.",
"No research resource cost": "Έρευνα χωρίς κόστος πόρων",
"Required for {p0}": "Απαιτείται για {p0}",
"Wonder in your hand": "Θαύμα στο χέρι σας"
"Wonder in your hand": "Θαύμα στο χέρι σας",
"Current combat forces": "Τρέχουσες δυνάμεις μάχης",
"Public combat bonuses before tactics": "Δημόσια μπόνους μάχης πριν από τις τακτικές",
"Value bonus": "Μπόνους αξίας",
"Fortress: cancels 1 hit (round 1)": "Οχυρό: ακυρώνει 1 πλήγμα (γύρος 1)",
"Fortress: +1 die (round 1)": "Οχυρό: +1 ζάρι (γύρος 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Μόνο δημόσια μπόνους · εξαιρούνται τακτικές, επιδράσεις συμβόλων ζαριών και εκκρεμείς επιλογές",
"Steel Weapons not activated: +{p0} value if activated": "Χαλύβδινα όπλα ανενεργά: +{p0} αξία αν ενεργοποιηθούν",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Γύρος 1: συνολικό μπόνους έως +2, μαζί με τα μπόνους συμβόλων ζαριών",
"Battle · Round": "Μάχη · Γύρος"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Use a card or ability below instead of normal research. Its own costs and effects still apply.",
"No research resource cost": "No research resource cost",
"Required for {p0}": "Required for {p0}",
"Wonder in your hand": "Wonder in your hand"
"Wonder in your hand": "Wonder in your hand",
"Current combat forces": "Current combat forces",
"Public combat bonuses before tactics": "Public combat bonuses before tactics",
"Value bonus": "Value bonus",
"Fortress: cancels 1 hit (round 1)": "Fortress: cancels 1 hit (round 1)",
"Fortress: +1 die (round 1)": "Fortress: +1 die (round 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices",
"Steel Weapons not activated: +{p0} value if activated": "Steel Weapons not activated: +{p0} value if activated",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Round 1: total bonus capped at +2, including dice-symbol bonuses",
"Battle · Round": "Battle · Round"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "به‌جای پژوهش معمول، از یکی از کارت‌ها یا توانایی‌های زیر استفاده کنید. هزینه‌ها و اثرهای خود آن همچنان اعمال می‌شوند.",
"No research resource cost": "پژوهش بدون هزینهٔ منابع",
"Required for {p0}": "لازم برای {p0}",
"Wonder in your hand": "عجایب در دست شما"
"Wonder in your hand": "عجایب در دست شما",
"Current combat forces": "نیروهای فعلی نبرد",
"Public combat bonuses before tactics": "پاداش‌های عمومی نبرد پیش از تاکتیک‌ها",
"Value bonus": "پاداش ارزش",
"Fortress: cancels 1 hit (round 1)": "دژ: ۱ ضربه را خنثی می‌کند (دور ۱)",
"Fortress: +1 die (round 1)": "دژ: ۱+ تاس (دور ۱)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "فقط پاداش‌های عمومی · بدون تاکتیک‌ها، اثر نمادهای تاس و انتخاب‌های حل‌نشده",
"Steel Weapons not activated: +{p0} value if activated": "سلاح‌های فولادی فعال نیست: در صورت فعال‌سازی {p0}+ ارزش",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "دور ۱: مجموع پاداش حداکثر ۲+، شامل پاداش نمادهای تاس",
"Battle · Round": "نبرد · دور"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Vous pouvez utiliser une carte ou une capacité ci-dessous au lieu de la recherche normale. Ses coûts et ses effets s'appliquent.",
"No research resource cost": "Recherche sans coût en ressources",
"Required for {p0}": "Nécessaire pour {p0}",
"Wonder in your hand": "Merveille dans votre main"
"Wonder in your hand": "Merveille dans votre main",
"Current combat forces": "Forces actuellement engagées",
"Public combat bonuses before tactics": "Bonus de combat publics avant les tactiques",
"Value bonus": "Bonus de valeur",
"Fortress: cancels 1 hit (round 1)": "Forteresse : annule 1 touche (manche 1)",
"Fortress: +1 die (round 1)": "Forteresse : +1 dé (manche 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Bonus publics uniquement · hors tactiques, effets des symboles des dés et choix non résolus",
"Steel Weapons not activated: +{p0} value if activated": "Armes en acier non activées : +{p0} en valeur si activées",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Manche 1 : bonus total limité à +2, y compris les bonus des symboles des dés",
"Battle · Round": "Bataille · Manche"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "सामान्य शोध के बजाय नीचे दिया गया कार्ड या क्षमता इस्तेमाल करें। उसके अपने खर्च और प्रभाव फिर भी लागू होंगे।",
"No research resource cost": "शोध के लिए संसाधन खर्च नहीं",
"Required for {p0}": "{p0} के लिए आवश्यक",
"Wonder in your hand": "आपके हाथ में अजूबा"
"Wonder in your hand": "आपके हाथ में अजूबा",
"Current combat forces": "वर्तमान युद्ध बल",
"Public combat bonuses before tactics": "रणनीतियों से पहले सार्वजनिक युद्ध बोनस",
"Value bonus": "युद्ध मूल्य बोनस",
"Fortress: cancels 1 hit (round 1)": "किला: 1 प्रहार रोकता है (दौर 1)",
"Fortress: +1 die (round 1)": "किला: +1 पासा (दौर 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "केवल सार्वजनिक बोनस · रणनीतियाँ, पासों के चिह्नों के प्रभाव और लंबित विकल्प शामिल नहीं",
"Steel Weapons not activated: +{p0} value if activated": "इस्पात के हथियार सक्रिय नहीं: सक्रिय करने पर +{p0} युद्ध मूल्य",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "दौर 1: कुल बोनस अधिकतम +2, पासों के चिह्नों के बोनस सहित",
"Battle · Round": "युद्ध · दौर"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Usa una carta o un'abilità qui sotto invece della ricerca normale. I suoi costi ed effetti si applicano comunque.",
"No research resource cost": "Ricerca senza costo in risorse",
"Required for {p0}": "Richiesto per {p0}",
"Wonder in your hand": "Meraviglia nella tua mano"
"Wonder in your hand": "Meraviglia nella tua mano",
"Current combat forces": "Forze attualmente in combattimento",
"Public combat bonuses before tactics": "Bonus di combattimento pubblici prima delle tattiche",
"Value bonus": "Bonus al valore",
"Fortress: cancels 1 hit (round 1)": "Fortezza: annulla 1 colpo (round 1)",
"Fortress: +1 die (round 1)": "Fortezza: +1 dado (round 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Solo bonus pubblici · escluse tattiche, effetti dei simboli dei dadi e scelte irrisolte",
"Steel Weapons not activated: +{p0} value if activated": "Armi in acciaio non attivate: +{p0} al valore se attivate",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Round 1: bonus totale limitato a +2, inclusi i bonus dei simboli dei dadi",
"Battle · Round": "Battaglia · Round"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "일반 연구 대신 아래 카드나 능력을 사용하세요. 해당 카드나 능력의 비용과 효과는 그대로 적용됩니다.",
"No research resource cost": "연구 자원 비용 없음",
"Required for {p0}": "{p0}에 필요",
"Wonder in your hand": "손에 있는 불가사의"
"Wonder in your hand": "손에 있는 불가사의",
"Current combat forces": "현재 전투 병력",
"Public combat bonuses before tactics": "전술 적용 전 공개 전투 보너스",
"Value bonus": "전투 값 보너스",
"Fortress: cancels 1 hit (round 1)": "요새: 명중 1회 취소 (1라운드)",
"Fortress: +1 die (round 1)": "요새: 주사위 +1개 (1라운드)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "공개 보너스만 표시 · 전술, 주사위 기호 효과 및 미결정 선택 제외",
"Steel Weapons not activated: +{p0} value if activated": "강철 무기 미활성: 활성화 시 전투 값 +{p0}",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "1라운드: 주사위 기호 보너스를 포함한 총 보너스는 최대 +2",
"Battle · Round": "전투 · 라운드"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Gebruik een kaart of vaardigheid hieronder in plaats van normaal onderzoek. De eigen kosten en effecten blijven gelden.",
"No research resource cost": "Geen grondstofkosten voor onderzoek",
"Required for {p0}": "Vereist voor {p0}",
"Wonder in your hand": "Wereldwonder in je hand"
"Wonder in your hand": "Wereldwonder in je hand",
"Current combat forces": "Huidige strijdkrachten",
"Public combat bonuses before tactics": "Openbare gevechtsbonussen vóór tactieken",
"Value bonus": "Gevechtswaardebonus",
"Fortress: cancels 1 hit (round 1)": "Fort: annuleert 1 treffer (ronde 1)",
"Fortress: +1 die (round 1)": "Fort: +1 dobbelsteen (ronde 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Alleen openbare bonussen · zonder tactieken, dobbelsteensymbooleffecten en onbesliste keuzes",
"Steel Weapons not activated: +{p0} value if activated": "Stalen wapens niet geactiveerd: +{p0} gevechtswaarde bij activering",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Ronde 1: totale bonus maximaal +2, inclusief dobbelsteensymboolbonussen",
"Battle · Round": "Gevecht · Ronde"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Użyj poniższej karty lub zdolności zamiast zwykłych badań. Jej własne koszty i efekty nadal obowiązują.",
"No research resource cost": "Badania bez kosztu w zasobach",
"Required for {p0}": "Wymagane dla {p0}",
"Wonder in your hand": "Cud na twojej ręce"
"Wonder in your hand": "Cud na twojej ręce",
"Current combat forces": "Obecne siły bojowe",
"Public combat bonuses before tactics": "Publiczne premie bojowe przed taktykami",
"Value bonus": "Premia do wartości",
"Fortress: cancels 1 hit (round 1)": "Twierdza: anuluje 1 trafienie (runda 1)",
"Fortress: +1 die (round 1)": "Twierdza: +1 kość (runda 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Tylko publiczne premie · bez taktyk, efektów symboli kości i nierozstrzygniętych wyborów",
"Steel Weapons not activated: +{p0} value if activated": "Broń stalowa nieaktywna: +{p0} do wartości po aktywacji",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Runda 1: łączna premia ograniczona do +2, w tym premie symboli kości",
"Battle · Round": "Bitwa · Runda"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Use uma carta ou habilidade abaixo em vez da pesquisa normal. Seus próprios custos e efeitos continuam se aplicando.",
"No research resource cost": "Pesquisa sem custo em recursos",
"Required for {p0}": "Necessário para {p0}",
"Wonder in your hand": "Maravilha na sua mão"
"Wonder in your hand": "Maravilha na sua mão",
"Current combat forces": "Forças atuais em combate",
"Public combat bonuses before tactics": "Bônus públicos de combate antes das táticas",
"Value bonus": "Bônus de valor",
"Fortress: cancels 1 hit (round 1)": "Fortaleza: cancela 1 acerto (rodada 1)",
"Fortress: +1 die (round 1)": "Fortaleza: +1 dado (rodada 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Somente bônus públicos · exclui táticas, efeitos dos símbolos dos dados e escolhas pendentes",
"Steel Weapons not activated: +{p0} value if activated": "Armas de aço não ativadas: +{p0} de valor se ativadas",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Rodada 1: bônus total limitado a +2, incluindo bônus dos símbolos dos dados",
"Battle · Round": "Batalha · Rodada"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Folosește o carte sau o abilitate de mai jos în locul cercetării normale. Costurile și efectele proprii se aplică în continuare.",
"No research resource cost": "Cercetare fără cost în resurse",
"Required for {p0}": "Necesar pentru {p0}",
"Wonder in your hand": "Minune în mâna ta"
"Wonder in your hand": "Minune în mâna ta",
"Current combat forces": "Forțele actuale de luptă",
"Public combat bonuses before tactics": "Bonusuri publice de luptă înaintea tacticilor",
"Value bonus": "Bonus de valoare",
"Fortress: cancels 1 hit (round 1)": "Fortăreață: anulează 1 lovitură (runda 1)",
"Fortress: +1 die (round 1)": "Fortăreață: +1 zar (runda 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Doar bonusuri publice · fără tactici, efectele simbolurilor zarurilor și alegeri nerezolvate",
"Steel Weapons not activated: +{p0} value if activated": "Arme de oțel neactivate: +{p0} valoare dacă sunt activate",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Runda 1: bonus total limitat la +2, inclusiv bonusurile simbolurilor zarurilor",
"Battle · Round": "Luptă · Runda"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Используйте указанную ниже карту или способность вместо обычного исследования. Её собственные затраты и эффекты по-прежнему применяются.",
"No research resource cost": "Исследование без затрат ресурсов",
"Required for {p0}": "Требуется для {p0}",
"Wonder in your hand": "Чудо у вас на руке"
"Wonder in your hand": "Чудо у вас на руке",
"Current combat forces": "Текущие боевые силы",
"Public combat bonuses before tactics": "Открытые боевые бонусы до тактики",
"Value bonus": "Бонус к боевому значению",
"Fortress: cancels 1 hit (round 1)": "Крепость: отменяет 1 попадание (раунд 1)",
"Fortress: +1 die (round 1)": "Крепость: +1 кубик (раунд 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Только открытые бонусы · без тактики, эффектов символов кубиков и нерешённых выборов",
"Steel Weapons not activated: +{p0} value if activated": "Стальное оружие не активировано: +{p0} к значению при активации",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Раунд 1: общий бонус не более +2, включая бонусы символов кубиков",
"Battle · Round": "Битва · Раунд"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Dùng một lá bài hoặc khả năng bên dưới thay cho nghiên cứu thông thường. Chi phí và hiệu ứng riêng của nó vẫn áp dụng.",
"No research resource cost": "Nghiên cứu không tốn tài nguyên",
"Required for {p0}": "Cần cho {p0}",
"Wonder in your hand": "Kỳ quan trên tay bạn"
"Wonder in your hand": "Kỳ quan trên tay bạn",
"Current combat forces": "Lực lượng chiến đấu hiện tại",
"Public combat bonuses before tactics": "Thưởng chiến đấu công khai trước chiến thuật",
"Value bonus": "Thưởng giá trị",
"Fortress: cancels 1 hit (round 1)": "Pháo đài: hủy 1 đòn trúng (vòng 1)",
"Fortress: +1 die (round 1)": "Pháo đài: +1 xúc xắc (vòng 1)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "Chỉ thưởng công khai · không gồm chiến thuật, hiệu ứng biểu tượng xúc xắc và lựa chọn chưa giải quyết",
"Steel Weapons not activated: +{p0} value if activated": "Vũ khí thép chưa kích hoạt: +{p0} giá trị nếu kích hoạt",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "Vòng 1: tổng thưởng tối đa +2, gồm cả thưởng biểu tượng xúc xắc",
"Battle · Round": "Trận chiến · Vòng"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "可以使用下方的卡牌或能力代替普通研究。该卡牌或能力自身的费用与效果仍然适用。",
"No research resource cost": "研究无需支付资源",
"Required for {p0}": "{p0}所需",
"Wonder in your hand": "你手中的奇迹"
"Wonder in your hand": "你手中的奇迹",
"Current combat forces": "当前参战兵力",
"Public combat bonuses before tactics": "战术前的公开战斗加成",
"Value bonus": "战斗值加成",
"Fortress: cancels 1 hit (round 1)": "要塞:抵消1次命中(第1回合)",
"Fortress: +1 die (round 1)": "要塞:+1颗骰子(第1回合)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "仅公开加成 · 不含战术、骰子符号效果及未解决的选择",
"Steel Weapons not activated: +{p0} value if activated": "钢铁武器未激活:激活后战斗值+{p0}",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "第1回合:总加成上限为+2,包括骰子符号加成",
"Battle · Round": "战斗 · 回合"
}

View file

@ -5246,5 +5246,14 @@
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "可以使用下方的卡牌或能力代替一般研究。該卡牌或能力本身的費用與效果仍然適用。",
"No research resource cost": "研究無需支付資源",
"Required for {p0}": "{p0}所需",
"Wonder in your hand": "你手中的奇蹟"
"Wonder in your hand": "你手中的奇蹟",
"Current combat forces": "目前參戰兵力",
"Public combat bonuses before tactics": "戰術前的公開戰鬥加成",
"Value bonus": "戰鬥值加成",
"Fortress: cancels 1 hit (round 1)": "要塞:抵消1次命中(第1回合)",
"Fortress: +1 die (round 1)": "要塞:+1顆骰子(第1回合)",
"Public bonuses only · excludes tactics, dice-symbol effects and unresolved choices": "僅公開加成 · 不含戰術、骰子符號效果及未解決的選擇",
"Steel Weapons not activated: +{p0} value if activated": "鋼鐵武器未啟用:啟用後戰鬥值+{p0}",
"Round 1: total bonus capped at +2, including dice-symbol bonuses": "第1回合:總加成上限為+2,包括骰子符號加成",
"Battle · Round": "戰鬥 · 回合"
}

View file

@ -6324,6 +6324,14 @@ small {
.collapsible-map-guide[open] > summary { margin-bottom: 8px; }
.collapsible-map-guide > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
/* Only the identity itself triggers the platform hovercard, not row padding. */
.player-identity {
display: inline-flex;
align-items: center;
min-width: 0;
max-width: 100%;
}
/* Keep the civilization emblem while identifying the BGS player beside their name. */
.player-info .player-avatar {
width: 12px;

View file

@ -278,7 +278,16 @@ export interface ActiveEffect {
players: number[];
rules: string[];
}
export interface PublicCombatBonus {
dice: number;
extraDice: number;
valueBonus: number;
hitCancels: number;
effects: string[];
inactive: string[];
}
export interface View {
combatSummary?: { round: number; attacker: PublicCombatBonus; defender: PublicCombatBonus } | null;
earlyChoices?: { key: string; title: string; options: { label: string; description: string; response: unknown }[]; selected: unknown | null }[];
activeEffects?: ActiveEffect[];
cardCatalog?: Pick<ActionCard, 'id' | 'name' | 'description' | 'free' | 'tactics'>[];