Use clockwise homes and printed action names; prepare viewer 233 engine 164

This commit is contained in:
coyotte508 2026-11-21 20:47:56 +00:00
commit 3789912be1
62 changed files with 830 additions and 94 deletions

View file

@ -24,7 +24,7 @@ jobs:
working-directory: web-client
- run: npx playwright install --with-deps chromium
working-directory: web-client
- run: node scripts/resource-journal-smoke.mjs && node scripts/famine-journal-smoke.mjs
- run: node scripts/resource-journal-smoke.mjs && node scripts/famine-journal-smoke.mjs && node scripts/construction-smoke.mjs && node scripts/research-card-smoke.mjs
working-directory: web-client
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:

View file

@ -0,0 +1,89 @@
# Clockwise home placement and save compatibility
New games write the top-level setup discriminator `"home_layout":"ClockwiseV1"`.
It is independent of JSON schema version, player identity, starting player, and
turn/draft order. The same field is carried by full saves and seed/history replay
input. Missing fields deserialize as `Legacy`; legacy serialization continues to
omit the field. Unknown enum values are rejected rather than guessed.
## Physical assignment
The original home definitions remain intact. ClockwiseV1 permutes whole home
blocks (anchor, rotation **and** starting-region side), not just city coordinates:
| Players | Legacy anchor order | ClockwiseV1 anchor order |
| --- | --- | --- |
| 2 | D1, D7 | D1, D7 |
| 3 | E3, A8, G8 | E3, G8, A8 |
| 4 | C1, I1, C8, I8 | C1, I1, I8, C8 |
Anchors are block positions; initial city positions can differ (e.g. D1's city
is D2). Free regions and RNG consumption are unchanged. Civilization overrides
remain attached to the same logical player and use their assigned home's
rotation. Draft completion uses the saved layout, including after reconnect.
All setup lookups (capital, placement, region IDs/owners, Alexander's starting
region exclusion, explorer and analysis regions) take the persisted layout.
The web viewer maps axial positions to `(1.5*q, sqrt(3)*(r+q/2))` with positive
second coordinate pointing down on screen in the default top-down view. Native
hex2d uses the opposite y sign, which `hex_ui::to_screen` flips back. Camera
home-down transforms are rotations, not reflections. Thus increasing player
indices in the new 3/4-player layouts make one clockwise circuit in both views.
The camera continues deriving original homes from setup history; no camera
migration or fixed seat-coordinate table is needed.
## Boundaries
- New initialization selects ClockwiseV1 explicitly in `GameSetupBuilder`.
- Loading an old full state does not rearrange any terrain, city, unit, history,
or player. Its derived home regions and orientations retain Legacy behavior.
- Replaying an old seed/history explicitly selects Legacy **before** setup;
replay never silently adopts the new builder default.
- Reload, clone, full replay, partial replay, and continued branches preserve the
selected layout; replay truncation does not switch it.
- No layout is inferred from cities, map shape, civilization, schema version, or
seed. Custom maps remain unchanged on load, including empty test maps. This
field does not make arbitrary custom scenarios reconstructible from seed-only
replay (which already assumes standard setup).
- Existing games are not migrated. Consumers exporting reduced replay envelopes
must retain `home_layout` for new games, just as they retain setup options and
seed. Deliberately deleting it requests the historical format.
## Rules source
The [official Monumental Edition rulebook](https://wizkids.com/posters/repository/wizkids/Clash-of-Cultures---Rulebook---WEB---2021-02-05-compressed.pdf)
page 4 specifies starting-region orientation/sides, civilization-specific region
replacement, and random seating for 3–4 players. **Clockwise turn order is on
page 8**, not page 4. This change aligns physical home order with the existing
logical clockwise turn cycle; it does not implement or change random account-to-
seat assignment.
## Regression coverage
`server/src/map.rs` tests complete block permutations and clockwise angles against
both hex2d/native and web projection formulas. `server/tests/home_layout_tests.rs`
covers all player counts, both layouts, full saves, full/partial replays and
branches, the frozen production Ballcourts history, custom empty maps, random /
choose / draft civilization setup, RNG/deal invariants, and home-region metadata.
`web-client/src/home-layout.test.ts` checks freshly initialized WASM games through
the viewer's actual `positionXY` and every seat's `strategyFrame` transform.
The existing `strategy-camera.test.ts` covers original-home recovery and fitting.
## Release and construction smoke regression
Release targets: viewer **0.1.233**, engine **0.4.164**. Tutorial catalog and
achievement artwork are unchanged. Advance and Construct are the printed action
names; old Research/Build replay titles remain accepted and are normalized only
for display, without editing recorded history.
The construction smoke now explicitly selects its fixture's city through the city
picker. The toolbar intentionally chooses a fresh suitable city (covered by the
controller regression), not necessarily `cities[0]`. Previously City Development
therefore selected an unactivated Happy city while expecting the repeat-activation
warning and an Angry result for the fixture's Neutral, already-activated city.
The production warning and activation rules were correct. Explicit city selection
exercises the intended scenario rather than changing those rules or suppressing
assertions. All three cases (Great Engineer, City Development, ordinary Construct)
retain their resource, activation warning, submitted move, final mood and overflow
checks at 1400, 390 and 320 pixels. The Web viewer CI workflow now runs the
complete construction and research-card smokes alongside the journal smokes.

View file

@ -69,3 +69,20 @@ Regression tests use shipped catalogs in all supported languages, current
continued engine rules (Spy, Mercenaries, wonder leader abilities), complete
optional captions and composed strategy tooltips. They supplement, rather than
replace, native-language review of wording and gameplay terminology.
## Printed action terminology
Action controls use **Advance** and **Construct**, while the browsing tree is
**Advances**. The purchase template is `Advance · {p0}` so it reads as an action
label followed by an advance name, not an awkward verb phrase. Existing **Use**,
**Choose**, and **Queue choice** controls keep their distinct meanings. The
catalogs reuse their existing action/browsing translations and preserve old keys
for recorded text; ordinary rules prose (such as research costs) is unchanged.
New public board-history titles use Advance / Construct / Construct wonder.
Playback still recognizes Research / Build / Build wonder in old recordings and
normalizes their displayed captions without rewriting saved frames or engine
action identifiers. Journal Advance and legacy Research origins group the same
advance rewards. Focused coverage lives in `journal.test.ts`, `playback.test.ts`,
`platform_log_tests.rs`, and the board-history terminology unit test. The
research-card smoke checks desktop/mobile action labels, tooltips and overflow.

View file

@ -219,7 +219,7 @@ fn remaining_blocks(game: &Game) -> Result<Vec<Block>, String> {
}
}
let mut blocks = BLOCKS.to_vec();
for position in get_map_setup(game.human_players_count()).free_positions {
for position in get_map_setup(game.human_players_count(), game.home_layout).free_positions {
if game
.map
.unexplored_blocks

View file

@ -143,13 +143,13 @@ fn title(action: &Action) -> String {
_ => "Action".to_owned(),
};
match name.as_str() {
"Advance" => "Research",
"Construct" => "Build",
"Advance" => "Advance",
"Construct" => "Construct",
"EndTurn" => "End turn",
"FoundCity" => "Found city",
"IncreaseHappiness" => "Increase happiness",
"ActionCard" => "Play action card",
"WonderCard" => "Build wonder",
"WonderCard" => "Construct wonder",
"InfluenceCultureAttempt" => "Cultural influence",
"Custom" => "Civilization ability",
_ => &name,
@ -483,3 +483,30 @@ fn effects(game: &Game, from: usize) -> Vec<BoardEffect> {
})
.collect()
}
#[cfg(test)]
mod terminology_tests {
use super::*;
#[test]
fn action_titles_use_printed_names_without_renaming_action_variants() {
for (value, expected) in [
(
serde_json::json!({"Playing":{"WonderCard":"Pyramids"}}),
"Construct wonder",
),
(
serde_json::json!({"Playing":{"Advance":{"advance":"Storage","payment":{}}}}),
"Advance",
),
(
serde_json::json!({"Playing":{"Construct":{"city_position":"C2","city_piece":"Academy","payment":{},"port_position":null}}}),
"Construct",
),
] {
let action: Action = serde_json::from_value(value.clone()).unwrap();
assert_eq!(title(&action), expected);
assert_eq!(serde_json::to_value(action).unwrap(), value);
}
}
}

View file

@ -261,7 +261,7 @@ fn alexander() -> LeaderInfo {
)
.add_combat_strength_listener(100, |game, c, s, r| {
if c.is_land_battle_with_leader(r, game) {
let setup = get_map_setup(game.human_players_count());
let setup = get_map_setup(game.human_players_count(), game.home_layout);
let player = c.player(r);
let extra = setup
.free_positions

View file

@ -184,7 +184,7 @@ fn city_cost(player: &Player, origin: EventOrigin) -> PaymentOptions {
}
pub(crate) fn action_explore_request(game: &Game, player_index: usize) -> PositionRequest {
let setup = get_map_setup(game.human_players_count());
let setup = get_map_setup(game.human_players_count(), game.home_layout);
let free = &setup
.free_positions
.into_iter()

View file

@ -156,6 +156,7 @@ pub struct Game {
pub context: GameContext, // transient
pub options: GameOptions,
pub asynchronous_combat_from: Option<usize>,
pub home_layout: crate::map::HomeLayout,
pub version: u16, // JSON schema version
pub state: GameState,
pub events: Vec<PersistentEventState>,

View file

@ -39,6 +39,8 @@ pub struct GameData {
version: u16,
#[serde(default, skip_serializing_if = "Option::is_none")]
asynchronous_combat_from: Option<usize>,
#[serde(default, skip_serializing_if = "crate::map::HomeLayout::is_legacy")]
home_layout: crate::map::HomeLayout,
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
seed: String,
@ -153,6 +155,7 @@ pub fn from_data(data: GameData, cache: Cache, context: GameContext) -> Game {
options: data.options,
version: data.version,
asynchronous_combat_from: data.asynchronous_combat_from,
home_layout: data.home_layout,
state: data.state,
players: Vec::new(),
map: Map::from_data(data.map),
@ -214,6 +217,7 @@ pub fn data(game: Game) -> GameData {
options: game.options,
version: game.version,
asynchronous_combat_from: game.asynchronous_combat_from,
home_layout: game.home_layout,
state: game.state,
events: game.events,
action_plan: game.action_plan,
@ -261,6 +265,7 @@ pub fn cloned_data(game: &Game) -> GameData {
options: game.options.clone(),
version: game.version,
asynchronous_combat_from: game.asynchronous_combat_from,
home_layout: game.home_layout,
state: game.state.clone(),
events: game.events.clone(),
action_plan: game.action_plan.clone(),

View file

@ -15,7 +15,7 @@ use crate::log::{
ActionLogAge, ActionLogRound, SetupTurnType, TurnType, add_start_turn_action_if_needed,
add_turn_log,
};
use crate::map::{Map, MapSetup, get_map_setup};
use crate::map::{HomeLayout, Map, MapSetup, get_map_setup};
use crate::objective_card::gain_objective_card_from_pile;
use crate::player::{Player, gain_unit};
use crate::resource_pile::ResourcePile;
@ -44,6 +44,7 @@ pub struct GameSetup {
random_map: bool,
options: GameOptions,
assigned_civilizations: Vec<String>,
home_layout: HomeLayout,
}
#[must_use]
@ -53,6 +54,7 @@ pub struct GameSetupBuilder {
random_map: bool,
options: GameOptions,
assigned_civilizations: Vec<String>,
home_layout: HomeLayout,
}
impl GameSetupBuilder {
@ -63,9 +65,16 @@ impl GameSetupBuilder {
random_map: true,
options: GameOptions::default(),
assigned_civilizations: Vec::new(),
home_layout: HomeLayout::ClockwiseV1,
}
}
/// Explicit compatibility override for replaying historical setups.
pub fn home_layout(mut self, layout: HomeLayout) -> Self {
self.home_layout = layout;
self
}
pub fn seed(mut self, seed: String) -> Self {
self.seed = seed;
self
@ -93,6 +102,7 @@ impl GameSetupBuilder {
random_map: self.random_map,
options: self.options,
assigned_civilizations: self.assigned_civilizations,
home_layout: self.home_layout,
}
}
}
@ -153,7 +163,7 @@ pub fn setup_game_with_cache(setup: &GameSetup, cache: Cache) -> Game {
players.push(Player::new(cache.get_civilization(PIRATES), players.len()));
let (map_setup, map) = if setup.random_map && civilization_draft.is_none() {
let setup = get_map_setup(setup.player_amount);
let setup = get_map_setup(setup.player_amount, setup.home_layout);
let map = Map::random_map(&mut rng, &setup);
(Some(setup), map)
} else {
@ -186,6 +196,7 @@ pub fn setup_game_with_cache(setup: &GameSetup, cache: Cache) -> Game {
.shuffled(&mut rng);
let all = &cache.get_abilities().clone();
let mut game = Game {
home_layout: setup.home_layout,
action_plan: None,
early_choices: vec![],
early_choice_update: false,
@ -308,8 +319,11 @@ fn execute_setup_round(player_amount: usize, game: &mut Game, map_setup: Option<
}
pub(crate) fn place_home_tiles(game: &mut Game, player: &EventPlayer) {
let h = &get_map_setup(game.players.iter().filter(|p| p.is_human()).count()).home_positions
[player.index];
let h = &get_map_setup(
game.players.iter().filter(|p| p.is_human()).count(),
game.home_layout,
)
.home_positions[player.index];
let home = player
.get(game)
.civilization
@ -463,7 +477,9 @@ fn finish_civilization_draft(game: &mut Game) {
p.civilization = civilization;
}
let player_amount = draft.ready.len();
let map_setup = draft.random_map.then(|| get_map_setup(player_amount));
let map_setup = draft
.random_map
.then(|| get_map_setup(player_amount, game.home_layout));
if let Some(setup) = &map_setup {
game.map = Map::random_map(&mut game.rng, setup);
}

View file

@ -502,8 +502,24 @@ impl MapSetup {
}
}
/// Home assignment format, independent of turn order and schema migrations.
/// Missing persisted values must always retain the pre-clockwise assignment.
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum HomeLayout {
#[default]
Legacy,
ClockwiseV1,
}
impl HomeLayout {
#[must_use]
pub fn is_legacy(&self) -> bool {
*self == Self::Legacy
}
}
#[must_use]
pub(crate) fn get_map_setup(player_count: usize) -> MapSetup {
pub(crate) fn get_map_setup(player_count: usize, layout: HomeLayout) -> MapSetup {
let setup = vec![
// 2 players
MapSetup::new(
@ -570,14 +586,22 @@ pub(crate) fn get_map_setup(player_count: usize) -> MapSetup {
],
),
];
setup
let mut setup = setup
.into_iter()
.find(|s| s.home_positions.len() == player_count)
.expect("No setup for this player count")
.expect("No setup for this player count");
if layout == HomeLayout::ClockwiseV1 {
match player_count {
3 => setup.home_positions.swap(1, 2),
4 => setup.home_positions.swap(2, 3),
_ => {}
}
}
setup
}
pub(crate) fn capital_city_position(game: &Game, player: &Player) -> Position {
let setup = get_map_setup(human_players_including_dropped(game));
let setup = get_map_setup(human_players_including_dropped(game), game.home_layout);
let h = &setup.home_positions[player.index];
h.block.tiles(&h.position, h.position.rotation)[0].0
}
@ -604,7 +628,7 @@ pub(crate) fn block_has_player_city(game: &Game, p: &BlockPosition, player: usiz
/// Panics if the position is not found in the map setup.
#[must_use]
pub fn block_for_position(game: &Game, position: Position) -> (u8, BlockPosition) {
let setup = get_map_setup(human_players_including_dropped(game));
let setup = get_map_setup(human_players_including_dropped(game), game.home_layout);
let home = setup.home_positions.len();
for (i, p) in setup.free_positions.iter().enumerate() {
if block_tiles(p).contains(&position) {
@ -659,3 +683,73 @@ mod revealed_distance_tests {
assert_eq!(map.revealed_distance(a, Position::new(10, 10)), None);
}
}
#[cfg(test)]
mod home_layout_tests {
use super::*;
#[test]
fn clockwise_homes_follow_screen_angles_and_keep_complete_blocks() {
for count in 2..=4 {
let old = get_map_setup(count, HomeLayout::Legacy);
let new = get_map_setup(count, HomeLayout::ClockwiseV1);
let legacy_anchors: &[&str] = match count {
2 => &["D1", "D7"],
3 => &["E3", "A8", "G8"],
_ => &["C1", "I1", "C8", "I8"],
};
assert_eq!(
old.home_positions
.iter()
.map(|h| h.position.top_tile.to_string())
.collect::<Vec<_>>(),
legacy_anchors,
);
let permutation: &[usize] = match count {
2 => &[0, 1],
3 => &[0, 2, 1],
_ => &[0, 1, 3, 2],
};
assert_eq!(new.free_positions, old.free_positions);
for (home, &index) in new.home_positions.iter().zip(permutation) {
assert_eq!(home.position, old.home_positions[index].position);
assert_eq!(home.block, old.home_positions[index].block);
}
// Native hex_ui::center flips hex2d's y; the web positionXY uses
// x=1.5*q, screen-y=sqrt(3)*(r+q/2). Verify both independently.
let points: Vec<_> = new
.home_positions
.iter()
.map(|h| {
let p = h.block.tiles(&h.position, h.position.rotation)[0].0;
let (x, y) = p.coordinate().to_pixel(hex2d::Spacing::FlatTop(1.0_f64));
let web = (
1.5 * f64::from(p.q),
3.0_f64.sqrt() * (f64::from(p.r) + f64::from(p.q) / 2.0),
);
assert!((x - web.0).abs() < 1e-9);
assert!((-y - web.1).abs() < 1e-9);
web
})
.collect();
if count > 2 {
let center = points.iter().fold((0.0, 0.0), |(x, y), p| {
(x + p.0 / count as f64, y + p.1 / count as f64)
});
let angles: Vec<_> = points
.iter()
.map(|p| (p.1 - center.1).atan2(p.0 - center.0))
.collect();
let turns: f64 = (0..count)
.map(|i| {
(angles[(i + 1) % count] - angles[i]).rem_euclid(std::f64::consts::TAU)
})
.sum();
assert!(
(turns - std::f64::consts::TAU).abs() < 1e-9,
"one clockwise circuit"
);
}
}
}
}

View file

@ -155,7 +155,7 @@ fn fallback(game: &Game, entry: &ActionLogAction) -> String {
match &entry.action {
Action::Playing(action) => match action {
PlayingAction::EndTurn => "Ended turn".into(),
PlayingAction::Advance(_) => "Research".into(),
PlayingAction::Advance(_) => "Advance".into(),
PlayingAction::FoundCity { .. } => "Found a city".into(),
PlayingAction::Construct(_) => "Construct a building".into(),
PlayingAction::Collect(_) => "Collect resources".into(),

View file

@ -14,6 +14,8 @@ pub struct ReplayGameData {
seed: String,
#[serde(default)]
asynchronous_combat_from: Option<usize>,
#[serde(default, skip_serializing_if = "crate::map::HomeLayout::is_legacy")]
home_layout: crate::map::HomeLayout,
log: Vec<ActionLogAge>,
log_index: usize,
// Look-only information boundaries are intentionally absent from the log.
@ -91,6 +93,7 @@ pub fn replay(data: ReplayGameData, to: Option<usize>) -> Result<Game, String> {
return Err("Invalid replay player indices".to_string());
}
let mut builder = GameSetupBuilder::new(player_amount)
.home_layout(data.home_layout)
.seed(data.seed)
.options(data.options.clone());
if data.options.civilization == CivSetupOption::Random {

View file

@ -159,7 +159,10 @@ pub fn view(game: &Game, seat: Option<usize>) -> Value {
None
}
});
let setup = crate::map::get_map_setup(game.players.iter().filter(|p| p.is_human()).count());
let setup = crate::map::get_map_setup(
game.players.iter().filter(|p| p.is_human()).count(),
game.home_layout,
);
let regions: Vec<Value> = setup
.home_positions
.iter()

View file

@ -0,0 +1,166 @@
use serde_json::Value;
use server::{
action::{Action, try_execute_action},
cache::Cache,
game::{CivSetupOption, Game, GameContext, GameOptions},
game_data::GameData,
game_setup::{GameSetupBuilder, setup_game},
map::HomeLayout,
playing_actions::PlayingAction,
};
fn saved(game: &Game) -> Value {
serde_json::to_value(game.cloned_data()).unwrap()
}
fn reload(value: Value) -> Game {
let data: GameData = serde_json::from_value(value).unwrap();
let cache = Cache::new(&data.options);
Game::from_data(data, cache, GameContext::Play)
}
fn replay(value: Value, to: Option<usize>) -> Game {
server::replay::replay(serde_json::from_value(value).unwrap(), to).unwrap()
}
fn homes(game: &Game) -> Vec<String> {
game.players
.iter()
.filter(|p| p.is_human())
.map(|p| p.cities[0].position.to_string())
.collect()
}
fn regions(game: &Game) -> Value {
server::web_view::view(game, None)["regions"].clone()
}
fn setup(count: usize, layout: HomeLayout, civilization: CivSetupOption) -> Game {
setup_game(
&GameSetupBuilder::new(count)
.seed("clockwise-layout".into())
.home_layout(layout)
.options(GameOptions {
civilization,
..GameOptions::default()
})
.build(),
)
}
#[test]
fn new_and_legacy_layout_survive_save_replay_and_playable_branch() {
for count in 2..=4 {
for layout in [HomeLayout::Legacy, HomeLayout::ClockwiseV1] {
let mut game = setup(count, layout, CivSetupOption::Random);
let expected_homes = homes(&game);
let expected_regions = regions(&game);
let initial_length = server::game_api::log_length(&game);
let player = game.active_player();
game =
try_execute_action(game, Action::Playing(PlayingAction::EndTurn), player).unwrap();
let data = saved(&game);
if layout == HomeLayout::Legacy {
assert!(
data.get("home_layout").is_none(),
"legacy format remains absent"
);
} else {
assert_eq!(data["home_layout"], "ClockwiseV1");
}
for restored in [
reload(data.clone()),
replay(data.clone(), None),
replay(data, Some(initial_length)),
] {
assert_eq!(restored.home_layout, layout);
assert_eq!(homes(&restored), expected_homes);
assert_eq!(regions(&restored), expected_regions);
let player = restored.active_player();
let branch =
try_execute_action(restored, Action::Playing(PlayingAction::EndTurn), player)
.unwrap();
let again = replay(saved(&branch), None);
assert_eq!(again.home_layout, layout);
assert_eq!(homes(&again), expected_homes);
}
}
}
}
#[test]
fn old_production_history_without_layout_replays_unchanged() {
let fixture: Value =
serde_json::from_str(include_str!("fixtures/legacy_ballcourts_history.json")).unwrap();
assert!(fixture.get("home_layout").is_none());
let game = replay(fixture, None);
assert_eq!(game.home_layout, HomeLayout::Legacy);
assert_eq!(homes(&game), ["D2", "D7"]);
let again = reload(saved(&game));
assert_eq!(homes(&again), homes(&game));
assert_eq!(regions(&again), regions(&game));
}
#[test]
fn default_new_game_is_clockwise_and_custom_map_reload_is_not_inferred() {
let game = setup_game(&GameSetupBuilder::new(4).seed("custom".into()).build());
assert_eq!(game.home_layout, HomeLayout::ClockwiseV1);
let custom = setup_game(&GameSetupBuilder::new(4).skip_random_map().build());
assert!(custom.map.tiles.is_empty());
let mut data = saved(&custom);
data.as_object_mut().unwrap().remove("home_layout");
let old_custom = reload(data);
assert_eq!(old_custom.home_layout, HomeLayout::Legacy);
assert!(old_custom.map.tiles.is_empty());
assert_eq!(regions(&old_custom), serde_json::json!([]));
}
#[test]
fn draft_and_choose_keep_civilization_deal_rng_turns_and_home_metadata() {
for count in 2..=4 {
for option in [
CivSetupOption::Random,
CivSetupOption::ChooseCivilization,
CivSetupOption::DraftThree,
] {
let mut old = setup(count, HomeLayout::Legacy, option.clone());
let mut new = setup(count, HomeLayout::ClockwiseV1, option.clone());
assert_eq!(old.starting_player_index, new.starting_player_index);
assert_eq!(old.current_player_index, new.current_player_index);
assert_eq!(old.rng.seed, new.rng.seed);
if option == CivSetupOption::DraftThree {
assert!(new.map.tiles.is_empty());
let offers = old.civilization_draft.as_ref().unwrap().offers.clone();
assert_eq!(offers, new.civilization_draft.as_ref().unwrap().offers);
// Reload while still drafting: final setup must use the saved layout.
new = reload(saved(&new));
for (player, offer) in offers.iter().enumerate() {
let action = Action::ChooseCivilization(offer[0].clone());
old = try_execute_action(old, action.clone(), player).unwrap();
new = try_execute_action(new, action, player).unwrap();
}
} else if option == CivSetupOption::ChooseCivilization {
let choices = ["Rome", "Greece", "Egypt", "China"];
for _ in 0..count {
let player = old.active_player();
let action = Action::ChooseCivilization(choices[player].into());
old = try_execute_action(old, action.clone(), player).unwrap();
new = try_execute_action(new, action, player).unwrap();
}
}
assert_eq!(old.rng.seed, new.rng.seed);
assert_eq!(old.current_player_index, new.current_player_index);
for player in 0..count {
assert_eq!(
old.player(player).civilization.name,
new.player(player).civilization.name
);
let home = new.player(player).cities[0].position;
let region = regions(&new)[player].clone();
assert_eq!(region["homePlayer"], player);
assert!(
region["tiles"]
.as_array()
.unwrap()
.contains(&serde_json::json!(home))
);
}
assert_eq!(homes(&replay(saved(&new), None)), homes(&new));
}
}
}

View file

@ -158,3 +158,17 @@ fn resource_summary_names_the_actor_and_other_recipients() {
)
);
}
#[test]
fn advance_action_fallback_uses_printed_action_name_without_changing_replay_data() {
let mut game = common::JsonTest::new("advances").load_game("collect_free_economy");
let start = log_length(&game);
let action = serde_json::json!({"Playing":{"Advance":{"advance":"Storage","payment":{}}}});
append(&mut game, serde_json::json!({"player":0,"action":action}));
let entries = platform_log_slice(&game, &options(start, None));
assert_eq!(
entries[0].text,
format!("{}: Advance", game.players[0].civilization.name)
);
assert_eq!(serde_json::to_value(entries[0].action).unwrap(), action);
}

View file

@ -4,6 +4,7 @@
},
"version": 2,
"asynchronous_combat_from": 0,
"home_layout": "ClockwiseV1",
"state": "ChooseCivilization",
"players": [
{

View file

@ -1709,3 +1709,34 @@ Publish viewer only, retaining engine 0.4.163, achievement catalog revision 8 (4
entries), artwork revision 4 and all 60 named assets. The Web viewer CI runs both
the resource-echo and Famine offline built-viewer regressions on desktop/mobile,
in addition to the complete frontend suite and WASM regressions.
# Viewer 0.1.233 / engine 0.4.164 — clockwise homes and printed action names
New games persist ClockwiseV1 home assignment; absent layout fields retain Legacy
on load and seed/history replay. Whole home blocks change physical assignment for
three/four players without changing logical turns, deals or RNG consumption.
Existing games are not rearranged or migrated. See
[home-layout compatibility](../../docs/home-layout-compatibility.md).
Action controls and new history captions use Advance / Construct, with legacy
Research / Build captions still recognized. All 17 locale catalogs retain old
keys and add the current labels. The construction smoke explicitly selects its
already-activated fixture city instead of relying on the toolbar's fresh-city
preference; all warning, final-mood and layout assertions remain enabled. CI now
runs the full construction and research-card smokes. The availability smoke also
explicitly enables the opt-in filter rather than assuming it is the default,
and selects the fixture's settler group independently of unit-view ordering;
compatible units are selected on group changes, as the controller tests require.
The mobile minimize/restore fixture supplies the Settler's actual 2-food cost
before editing recruitment; its preceding collection deliberately remains
unsubmitted. It targets named map controls instead of overlapping canvas pixels
or DOM-order labels, and checks the current Happiness map tray rather than the
obsolete modal tab. None of these smoke fixes bypasses disabled controls or changes rules.
Require green main-commit Check and Web viewer CI before BGS publication. Download
and byte-verify all 39 viewer files and the actual engine package, then exercise
home placement, legacy replay and desktop/mobile construction/advance controls.
Preserve catalog revision 8 (46 definitions), artwork revision 4, all 60 named
asset bytes, gallery, preferences/settings and Standard options. The faction
artwork manifest's lockfile integrity hash changes only for the viewer version
bump; no artwork is republished. No production moves, history edits or rewinds.

View file

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

View file

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

View file

@ -13,7 +13,7 @@
"web-client/src/civilization-emblems.ts": "01b0cbf3fa77a8466532ccd73d63c1a3ddc9bbc79fc06ce7224b425322a9c9f0",
"web-client/src/civilization-flags.ts": "cd176076bfe05b3059093b80c88596b7ae46b77898695c6c7406cbe1a3a0f78b",
"server/src/content/civilizations.rs": "73602f3db506f3dc2dbc6de43d01179440fd3bb034c997ff209336faaef2a332",
"web-client/package-lock.json": "ed2e0095ae00090b1f60cf1d362678ec7a93202b570cb17e543cf2a1e380ee1c",
"web-client/package-lock.json": "38bdad294151ea0429b09c241e112014a445b77918914886e5a431d268739df5",
"web-client/node_modules/lucide-svelte/dist/Icon.svelte": "f7b49ab842c143fa680fa8bd9a54a9efdc48c2e2d49fa574bd5ccf8f6cfca5be",
"web-client/node_modules/lucide-svelte/dist/defaultAttributes.js": "5b8981c6e3434ae6538716af9e0403554e7708c4087f18d060950a7bef00d96a",
"web-client/node_modules/lucide-svelte/LICENSE": "668dcc52803480e0a026b31140a4cae668772663cd764e5991d252eef03f98db"

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/clash-server",
"version": "0.4.163",
"version": "0.4.164",
"description": "Clash of Cultures: Monumental edition engine for Boardgamers Space",
"license": "MIT",
"type": "commonjs",

View file

@ -56,7 +56,8 @@ try {
await page.goto('http://clash.test/');
await page.evaluate((seat) => {
window.host = clash3d.launch('#app');
window.prefs = { sound: false, unitBadges: true };
// Exercise the opt-in filter; the production default is to show all.
window.prefs = { sound: false, unitBadges: true, availableOnly: true };
host.on('update:preference', ({ name, value }) => {
prefs = { ...prefs, [name]: value };
host.emit('preferences', prefs);
@ -68,7 +69,7 @@ try {
}, seat);
await emit();
const filter = page.getByRole('checkbox', { name: 'Available only', exact: true });
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
const researchFilter = page.getByRole('combobox', { name: 'Filter advances', exact: true });
await researchFilter.waitFor();
assert.equal(await researchFilter.inputValue(), 'available');
@ -185,8 +186,18 @@ try {
await page.getByRole('button', { name: 'Close city management', exact: true }).click();
await page.getByRole('button', { name: 'Move units and found cities', exact: true }).click();
const movement = page.getByRole('region', { name: 'Unit movement', exact: true });
await movement.getByRole('button', { name: 'Show next group of units', exact: true }).click();
assert.equal(await movement.locator('.unit-choice[aria-pressed=true]').count(), 0);
// Unit views need not retain the fixture array order. Explicitly browse to
// its settler group before checking forest founding, rather than assuming
// one Next group click always lands there.
const settlerChoice = movement.locator('.unit-choice[aria-label^="Settler"]');
if (!(await settlerChoice.count()))
await movement.getByRole('button', { name: 'Show next group of units', exact: true }).click();
await settlerChoice.waitFor();
assert.equal(
await movement.locator('.unit-choice[aria-pressed=true]').count(),
state.players[seat].units.filter((unit) => unit.position === forest).length,
'switching groups selects the compatible units without submitting a move',
);
const found = page.getByRole('button', { name: 'Found city here', exact: false });
await found.waitFor();
assert(await found.isDisabled());
@ -217,7 +228,7 @@ try {
await page.getByRole('button', { name: 'Close city management', exact: true }).click();
assert.deepEqual(errors, []);
console.log(
`${width}px: default filters, Show all, retained selections, empty states and forest founding with/without an action verified.`,
`${width}px: opt-in filters, Show all, retained selections, empty states and forest founding with/without an action verified.`,
);
await page.close();
}

View file

@ -88,6 +88,12 @@ try {
{ state: engine.stripSecret(JSON.stringify(state), 0), dark },
);
await page.getByRole('button', { name: 'Manage cities', exact: true }).click();
// The toolbar deliberately prefers a fresh city. Select the fixture's
// already-activated city explicitly so this exercises repeat activation.
const cityPosition = initial.players[0].cities[0].position;
await page.getByRole('navigation', { name: 'Choose city', exact: true })
.getByRole('button', { name: new RegExp(`^${cityPosition}\\b`) }).click();
await page.getByRole('heading', { name: `City ${cityPosition}`, exact: true }).waitFor();
await page
.locator('.building-option')
.filter({ has: page.getByText('Fortress', { exact: true }) })
@ -104,7 +110,7 @@ try {
assert.ok(await page.locator('.city-dialog').evaluate((el) => el.scrollWidth <= el.clientWidth + 1));
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
await page.screenshot({ path: `/tmp/clash-build-${name}-${width}.png` });
await page.getByRole('button', { name: 'Build Fortress', exact: true }).click();
await page.getByRole('button', { name: 'Construct Fortress', exact: true }).click();
await page.waitForFunction(() => !document.querySelector('.city-confirm'));
assert.equal(sent, 1);
assert.equal(state.players[0].cities[0].city_pieces.fortress, 0);

View file

@ -70,7 +70,7 @@ test('extracts current continued engine rules and omits test/technical noise', (
'You may move any number of Barbarian armies 1 space each, which may start combat.',
'A: When drawing a wonder: Take {p0} from anywhere in the game',
]) assert.ok(Object.keys(inventory).some((key) => key.startsWith(prefix)), prefix);
for (const key of ['Build {p0} at {p1}', 'Free with {p0} · once per turn', 'city size {p0}, Fortress', 'Recruit {p0} units & action card']) assert.ok(inventory[key], key);
for (const key of ['Construct {p0} at {p1}', 'Free with {p0} · once per turn', 'city size {p0}, Fortress', 'Recruit {p0} units & action card']) assert.ok(inventory[key], key);
for (const key of ['action-panel floating-panel early-choices', 'current={p0}, available={p1}, conversions={p2}, exact={p3}, skip={p4}', 'crate::timing::deserialize_counters', 'button[data-panel-close]', 'Build {p0}{p1}', 'validated Calendar event']) assert.equal(inventory[key], undefined, key);
assert.ok(Object.values(inventory).flat().every((file) => !/\.test\.ts|_tests\.rs/.test(file)));
// Check mode must not write even if output flags are accidentally supplied.

View file

@ -26,6 +26,9 @@ try {
let state = await fixture('advances/collect_free_economy'),
seat = 0,
sent = [];
// This smoke keeps collection unsubmitted, then edits a recruit form. The
// collection fixture has only 1 food; a Settler legitimately costs 2.
state.players[seat].resources.food = 2;
const page = await browser.newPage({ viewport: { width, height } }),
errors = [];
page.on('pageerror', (e) => errors.push(e.message));
@ -68,7 +71,9 @@ try {
const restore = page.locator('.restore-mobile-panel');
await page.getByRole('button', { name: 'Collect resources', exact: true }).click();
const collect = page.locator('.board-collection');
await page.locator('.collect-map-label').first().click();
// Select the city's own resource control explicitly: neighboring 3D labels
// can overlap at 320px, so DOM order is not a reliable click target.
await page.getByRole('button', { name: 'Collect at C2: 1 wood', exact: true }).click();
const selected = await page.locator('.collect-map-label.selected').count();
const total = await page.locator('.collect-submit > .resource-amount').innerText();
await minimize(collect).click();
@ -101,7 +106,9 @@ try {
await minimize(city).click();
assert.equal(await page.locator('dialog:modal').count(), 0);
assert.equal(await city.count(), 1);
await canvas.click({ position: { x: board.width * 0.5, y: board.height * 0.4 } });
// Inspect a real map target. A fixed canvas pixel can be covered by a city
// label; use that control rather than forcing a click through the overlay.
await page.getByRole('button', { name: 'Select Greece city C1 · Angry', exact: true }).click();
assert.equal(await city.count(), 1, 'Board inspection must not cancel the hidden city form');
await restore.click();
assert(await city.evaluate((el) => el.matches(':modal')));
@ -109,12 +116,15 @@ try {
assert.equal(await city.locator('.city-content').evaluate((el) => el.scrollTop), scroll);
await page.screenshot({ path: `/tmp/clash-restored-city-${width}.png` });
await city.getByRole('button', { name: 'Happiness', exact: true }).click();
// Happiness is now a map-selection tray, not a tab in the city modal.
const happiness = page.getByRole('region', { name: 'Increase happiness', exact: true });
await happiness.waitFor();
assert(
await city.evaluate((el) => el.scrollWidth <= el.clientWidth + 1),
await happiness.evaluate((el) => el.scrollWidth <= el.clientWidth + 1),
'Happiness header fits with minimize',
);
await city.getByRole('button', { name: 'Close city management', exact: true }).click();
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await happiness.getByRole('button', { name: 'Close happiness controls', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
const research = page.locator('dialog.research-dialog');
await research.getByRole('textbox', { name: 'Search research', exact: true }).fill('Fishing');
await minimize(research).click();

View file

@ -39,7 +39,7 @@ try {
host.emit('preferences', { sound: false });
host.emit('state', state);
}, { state: stripped, seat });
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
await page.locator('#research-Storage .research-pick').click();
const picker = page.getByRole('group', { name: 'Research payment', exact: true });
await picker.waitFor();

View file

@ -142,7 +142,7 @@ try {
(state) => host.emit('state', state),
engine.stripSecret(JSON.stringify(state), 0),
);
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
await page.locator('#research-Arts .research-pick').click();
const payment = page.getByRole('group', { name: 'Research payment', exact: true });
await payment.getByLabel('Ideas amount for Research payment', { exact: true }).selectOption('2');

View file

@ -58,7 +58,7 @@ try {
// The research browser requires a selected civilization. This changes only
// the local viewing seat; the payload remains spectator-stripped (no hand).
await page.evaluate(()=>host.emit('player',{index:0}));
await page.getByRole('button',{name:'Research tree',exact:true}).click();
await page.getByRole('button',{name:'Advances',exact:true}).click();
await page.locator('.research-tree').waitFor();
await page.waitForTimeout(500);
await page.screenshot({path:path.join(out,`research-${suffix}.png`)});

View file

@ -31,7 +31,13 @@ try {
});
await page.goto('http://clash.test');
await page.evaluate(state=>{window.host=clash3d.launch('#app');window.sent=[];host.on('move',a=>sent.push(a));host.emit('player',{index:0});host.emit('theme',{dark:true});host.emit('preferences',{sound:false});host.emit('state',state)},engine.stripSecret(JSON.stringify(state),0));
await page.getByRole('button',{name:'Research tree',exact:true}).click();
const advanceToolbar = page.getByRole('button',{name:'Advances',exact:true});
assert.equal((await advanceToolbar.textContent()).trim(), 'Advance');
assert.equal(await advanceToolbar.getAttribute('title'), 'Advances');
assert.equal(await page.getByRole('button', {name: 'Manage cities', exact: true}).getAttribute('title'), 'Construct, recruit and improve happiness');
await advanceToolbar.click();
await page.getByRole('heading', {name: /^Advances/, level: 2}).waitFor();
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
const hint=page.getByRole('button',{name:'Use Tech Synergy · 2 advances · normal resource costs'}).first();
await hint.waitFor();
await hint.scrollIntoViewIfNeeded();
@ -49,10 +55,13 @@ try {
host.on('move',a=>sent.push(a)); host.emit('player',{index:0});
host.emit('theme',{dark:true}); host.emit('preferences',{sound:false}); host.emit('state',state);
},engine.stripSecret(JSON.stringify(rome),0));
await page.getByRole('button',{name:'Research tree',exact:true}).click();
await page.getByRole('button',{name:'Advances',exact:true}).click();
await page.locator('#research-Sanitation .research-pick').click();
const free = page.getByRole('button',{name:/Research Sanitation · free action/});
const free = page.getByRole('button',{name:/Advance · Sanitation · free action/});
assert.equal(await free.isEnabled(),true);
assert.ok(await free.evaluate(el => el.scrollWidth <= el.clientWidth + 1));
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
await page.screenshot({path:`/tmp/clash-advance-action-${width}.png`});
await free.click();
await page.waitForFunction(() => sent.length === 1);
assert.deepEqual(errors,[]);

View file

@ -85,7 +85,7 @@ try {
philosophy.players[0].advances = ['Writing', 'Philosophy'];
state = ser(philosophy);
await page.evaluate((state) => host.emit('state', state), engine.stripSecret(state, 0));
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
const science = page.locator('#research-Math');
await science.scrollIntoViewIfNeeded();
assert.match(await science.locator('.research-effects').innerText(), /Philosophy/);

View file

@ -103,7 +103,7 @@ try {
assert.equal(sent, 1);
for (const [resource, spent] of Object.entries(compact(quote.payment)))
assert.equal(state.players[seat].resources[resource] ?? 0, resourcesBefore[resource] - spent);
await page.getByRole('button', { name: 'Research tree', exact: true }).click();
await page.getByRole('button', { name: 'Advances', exact: true }).click();
await page.getByRole('combobox', { name: 'Filter advances', exact: true }).selectOption('all');
const protection = page.locator('#research-Totalitarianism');
await protection.scrollIntoViewIfNeeded();

View file

@ -51,7 +51,7 @@ try {
await page.waitForSelector(`[data-clash-locale="${locale}"]`);
}
const open = async (id) => {
await page.getByRole('button', { name: t('Research tree'), exact: true }).click();
await page.getByRole('button', { name: t('Advances'), exact: true }).click();
await page.locator(`#research-${id} .research-pick`).click();
};
const sent = () => page.evaluate(() => window.sent.map((a) => JSON.parse(a)));
@ -157,7 +157,7 @@ try {
assert.equal(await page.locator('.research-alternatives, .research-card-hint').count(), 0);
game.players[0].action_cards = [122]; game.actions_left = 0;
await mount(game);
await page.getByRole('button', { name: t('Research tree'), exact: true }).click();
await page.getByRole('button', { name: t('Advances'), exact: true }).click();
assert.equal(await page.locator('.research-card-hint').count(), 0);
assert.deepEqual(errors, []);
await page.close();

View file

@ -1333,12 +1333,12 @@
class:active={$session.mode === 'research'}
class:inspect-only={!researchAvailable}
class:early-available={!!earlyAdvance}
title={earlyAdvance ? (earlyAdvance.selected ? 'Free advance saved · Click to edit' : 'Choose your free advance ahead of your turn') : researchAvailable ? 'Research tree' : 'View research · Browse advances and costs'}
title={earlyAdvance ? (earlyAdvance.selected ? 'Free advance saved · Click to edit' : 'Choose your free advance ahead of your turn') : 'Advances'}
data-tutorial="research"
aria-label="Research tree"
aria-label="Advances"
disabled={$session.seat === undefined}
onclick={openResearch}
><GraduationCap size={21} /><span>Research</span>{#if earlyAdvance}<EarlyChoiceBadge saved={earlyAdvance.selected != null} />{:else if !researchAvailable}<Eye
><GraduationCap size={21} /><span>Advance</span>{#if earlyAdvance}<EarlyChoiceBadge saved={earlyAdvance.selected != null} />{:else if !researchAvailable}<Eye
class="action-inspect"
size={10}
aria-hidden="true"
@ -1350,7 +1350,7 @@
class:early-available={!!earlyCities.length}
aria-label="Manage cities"
title={earlyCities.length ? 'Choose city razing ahead of your turn' : cityActionsAvailable
? 'Build, recruit and improve happiness'
? 'Construct, recruit and improve happiness'
: 'View cities · Browse buildings, units and costs'}
disabled={!city && !earlyCities.length}
onclick={() => {
@ -1531,7 +1531,7 @@
<section class="action-panel floating-panel" aria-label="Choose port location">
<button class="icon-button close-action" aria-label="Cancel port placement"
onclick={() => controller.patch({mode:'city'})}><X size={18} /></button>
<h2>Build Port · {$session.portPlacement.city}</h2>
<h2>Construct Port · {$session.portPlacement.city}</h2>
<p>Choose a highlighted sea space on the map.</p>
<ResourceAmount pile={$session.portPlacement.payment} />
</section>

View file

@ -400,7 +400,7 @@
onclick={() => submitBuild(choice.action)}
>{typeof choice.action === 'object' && 'Response' in choice.action
? (choice.position ? `Continue to payment at ${choice.position}` : 'Continue to payment')
: (choice.position ? `Build ${selected.name} at ${choice.position}` : `Build ${selected.name}`)}</button
: (choice.position ? `Construct ${selected.name} at ${choice.position}` : `Construct ${selected.name}`)}</button
>{/each}{/if}
</div>
</footer>{/if}

View file

@ -271,7 +271,7 @@
<header class="research-header" class:event-ready={eventImminent}>
<div>
<h2 id="research-title">
{choice ? (choice.endOfAge ? 'Free advance' : choice.name) : 'Research'}
{choice ? (choice.endOfAge ? 'Free advance' : choice.name) : 'Advances'}
{#if reference && player}<span>· {player.civilization}</span>{/if}
{#if player}<EventMarkers remaining={player.eventTokens} />{/if}
</h2>
@ -322,7 +322,7 @@
onclick={() => selectCategory(group)}><Icon size={15} />{group}</button
>{/each}
</nav>
<div class="research-tree" class:civilization-only={category === 'Civilization'} aria-label="Research tree">
<div class="research-tree" class:civilization-only={category === 'Civilization'} aria-label="Advances">
{#if player && visibleCivilizationAdvances.length}
<CivilizationAdvances
civilization={player.civilization}
@ -630,7 +630,7 @@
disabled={!!selectedAqueduct.reason || $session.pending}
title={selectedAqueduct.reason ? actionReason(selectedAqueduct.reason) : undefined}
onclick={() => controller.submit(selectedAqueduct!.action)}
>Research Sanitation · free action
>Advance · Sanitation · free action
<span>2 <Wheat size={14} /> / <Lightbulb size={14} /> / <Coins size={14} /> · any mix</span>
</button>
<small>Aqueduct: pay the normal research cost, or spend 1 action with no resources.</small>
@ -665,7 +665,7 @@
? 'Confirming…'
: selected.owned
? 'Researched'
: early ? 'Queue choice' : `${borrowing ? 'Use' : choice?.advanceMode === 'paid' ? 'Choose' : 'Research'} ${selected.name}`}
: early ? 'Queue choice' : borrowing ? `Use ${selected.name}` : choice?.advanceMode === 'paid' ? `Choose ${selected.name}` : `Advance · ${selected.name}`}
{#if !selected.owned && !early}<span
>{#if eventImminent}<ScrollText size={13} aria-hidden="true" />{/if}{#if borrowing}Until end
of turn{:else if freeResearch}Free{:else if choice}{selected.costAmount === 0

View file

@ -107,7 +107,7 @@
aria-describedby={cityMountainStop ? 'city-mountain-stop' : undefined}
onclick={() => controller.openNomadCity(position)}><Footprints size={19} />Move city</button
>{/if}
<button onclick={() => controller.openCities(position, 'build')}><Hammer size={19} />Build</button>
<button onclick={() => controller.openCities(position, 'build')}><Hammer size={19} />Construct</button>
<button onclick={() => controller.openCities(position, 'recruit')}><Users size={19} />Recruit</button>
<button onclick={() => controller.openCities(position, 'happiness')}
><Smile size={19} />Happiness</button

View file

@ -0,0 +1,31 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import { positionXY } from './model.ts';
import { strategyHome, strategyFrame } from './strategy-camera.ts';
import type { Game } from './types.ts';
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
test('new engine homes make one clockwise circuit in every viewer seat projection', async () => {
for (const count of [2, 3, 4]) {
const game: Game & { home_layout: string } = JSON.parse(
await engine.init(count, [], {}, 'clockwise-viewer', {}),
);
assert.equal(game.home_layout, 'ClockwiseV1');
const homes = game.players.slice(0, count).map((p) => strategyHome(game, p.id)!);
if (count === 2) assert.deepEqual(homes, ['D2', 'D7']);
for (let seat = 0; seat < count; seat++) {
const frame = strategyFrame(game.map.tiles.map(([p]) => p), homes[seat], 1);
const sin = Math.sin(frame.angle), cos = Math.cos(frame.angle);
const points = homes.map((p) => {
const [x, y] = positionXY(p);
return [x * cos - y * sin, x * sin + y * cos];
});
const center = points.reduce(([x, y], p) => [x + p[0] / count, y + p[1] / count], [0, 0]);
const angles = points.map(([x, y]) => Math.atan2(y - center[1], x - center[0]));
const tau = 2 * Math.PI;
const circuit = angles.reduce((sum, angle, i) => sum + ((angles[(i + 1) % count] - angle + tau) % tau), 0);
assert.ok(Math.abs(circuit - tau) < 1e-9, `${count} players viewed from seat ${seat}`);
}
}
});

View file

@ -191,7 +191,7 @@ test('journal combines research and its card draw without revealing hidden card
);
assert.equal(entries.length, 1);
assert.equal(entries[0].civilization, 'Vikings');
assert.equal(entries[0].title, 'Research');
assert.equal(entries[0].title, 'Advance');
assert.deepEqual(
entries[0].tokens.map((t) => [t.icon, t.value]),
[
@ -414,3 +414,15 @@ test('old prose-only recruitment discount offers are not reported as uses', () =
assert(rows[0].tokens.some(t => t.icon === 'food' && t.value === '−1'));
assert(!rows[0].text.includes('mood'));
});
test('legacy research log origins and current advance origins group the same card draw', () => {
for (const origin of ['Advance', 'Research']) {
const entries = journal(game([{
action: { Playing: { Advance: { advance: 'Engineering' } } },
log: [`Leif: ${origin}: Pay 1 action, Pay 2 food, Gain Engineering and take an event token (2 left)`, 'Leif: Engineering: Draw a wonder card'],
items: [{ player: 0, HandCard: { to: { Hand: 0 } }, origin: { Advance: 'Engineering' } }],
}]));
assert.equal(entries.length, 1);
assert.equal(entries[0].title, 'Advance');
}
});

View file

@ -358,13 +358,13 @@ export function journal(
entry &&
(entry.title.toLowerCase() === origin?.toLowerCase() ||
entry.title.split(' · ')[0].toLowerCase() === origin?.toLowerCase() ||
(entry.title === 'Research' &&
(origin === 'Advance' ||
(['Advance', 'Research'].includes(entry.title) &&
(['Advance', 'Research'].includes(origin ?? '') ||
entry.tokens.some((token) => token.icon === 'research' && token.label === origin))));
if (!player || !entry || entry.player !== player.id || !sameSource) {
const title =
origin === 'Advance'
? 'Research'
origin === 'Advance' || origin === 'Research'
? 'Advance'
: origin === 'End Turn'
? 'End turn'
: origin === 'Found City'
@ -418,7 +418,7 @@ export function journal(
// Payment and results can interleave with bonuses. Consolidate only
// within this action and actor; preserve separate events and combat.
if (!action.combat_stats && !entries.some(entry => entry.event)) {
const primaryTitles = new Set(['Recruit', 'Construct', 'Research', 'Found city', 'Increase Happiness', 'Move']);
const primaryTitles = new Set(['Recruit', 'Construct', 'Advance', 'Research', 'Found city', 'Increase Happiness', 'Move']);
for (const primary of [...entries]) {
if (!primaryTitles.has(primary.title) || !entries.includes(primary)) continue;
for (const duplicate of [...entries]) {

View file

@ -161,8 +161,8 @@ test('real catalogs translate current rules and optional caption variants in eve
rules.push(rustTemplate(rule.value).replace(/\s+/g, ' ').trim());
}
const examples: [string, string[]][] = [
['Build {p0}', ['Temple']],
['Build {p0} at {p1}', ['Temple', 'C2']],
['Construct {p0}', ['Temple']],
['Construct {p0} at {p1}', ['Temple', 'C2']],
['Continue to payment at {p0}', ['C2']],
['Free with {p0}', ['Engineering']],
['Free with {p0} · once per turn', ['Engineering']],

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Bycenter ved {p0} permanent ødelagt; bygrænse reduceret til {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} ved {p1} permanent ødelagt; samlet grænse for disse brikker reduceret til {p2}",
"Razed {p0} because no city centers were available": "{p0} nedbrændt, fordi ingen bycentre var tilgængelige",
"Obelisk total piece limit reduced to {p0}": "Samlet grænse for obelisker reduceret til {p0}"
"Obelisk total piece limit reduced to {p0}": "Samlet grænse for obelisker reduceret til {p0}",
"Advance · {p0}": "Fremskridt · {p0}",
"Advance · Sanitation · free action": "Fremskridt · Sanitet · gratis handling",
"Construct {p0}": "Byg {p0}",
"Construct {p0} at {p1}": "Byg {p0} ved {p1}",
"Construct / recruit": "Byg / rekruttér",
"Construct Port ·": "Byg Havn ·",
"Construct Port · {p0}": "Byg Havn · {p0}",
"Construct wonder": "Byg vidunder",
"Construct, recruit and improve happiness": "Byg, rekruttér og øg lykken",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Hver civilisation har sine egne fremskridt. Rom får Akvædukt, når den forsker i Ingeniørkunst. Åbn Fremskridt, og forsk i Ingeniørkunst; Akvædukt låses automatisk op uden et separat køb."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Stadtzentrum bei {p0} dauerhaft zerstört; Stadtlimit auf {p1} reduziert",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} bei {p1} dauerhaft zerstört; Gesamtlimit dieser Bauteile auf {p2} reduziert",
"Razed {p0} because no city centers were available": "{p0} zerstört, da keine Stadtzentren verfügbar waren",
"Obelisk total piece limit reduced to {p0}": "Gesamtlimit der Obelisken auf {p0} reduziert"
"Obelisk total piece limit reduced to {p0}": "Gesamtlimit der Obelisken auf {p0} reduziert",
"Advance · {p0}": "Fortschritt · {p0}",
"Advance · Sanitation · free action": "Fortschritt · Hygiene · freie Aktion",
"Construct {p0}": "{p0} bauen",
"Construct {p0} at {p1}": "{p0} bei {p1} bauen",
"Construct / recruit": "Bauen / rekrutieren",
"Construct Port ·": "Hafen bauen ·",
"Construct Port · {p0}": "Hafen bauen · {p0}",
"Construct wonder": "Weltwunder errichten",
"Construct, recruit and improve happiness": "Bauen, rekrutieren und Stimmung verbessern",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Jede Zivilisation hat eigene Fortschritte. Rom erhält Aquädukt, wenn es Ingenieurwesen erforscht. Öffne Fortschritte und erforsche Ingenieurwesen; Aquädukt wird automatisch freigeschaltet, ohne einen gesonderten Kauf."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Το κέντρο πόλης στο {p0} καταστράφηκε οριστικά· το όριο πόλεων μειώθηκε σε {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} στο {p1} καταστράφηκε οριστικά· το συνολικό όριο αυτών των κομματιών μειώθηκε σε {p2}",
"Razed {p0} because no city centers were available": "Η πόλη {p0} ισοπεδώθηκε επειδή δεν υπήρχαν διαθέσιμα κέντρα πόλης",
"Obelisk total piece limit reduced to {p0}": "Το συνολικό όριο οβελίσκων μειώθηκε σε {p0}"
"Obelisk total piece limit reduced to {p0}": "Το συνολικό όριο οβελίσκων μειώθηκε σε {p0}",
"Advance · {p0}": "Πρόοδος · {p0}",
"Advance · Sanitation · free action": "Πρόοδος · Υγιεινή · δωρεάν ενέργεια",
"Construct {p0}": "Κατασκευή: {p0}",
"Construct {p0} at {p1}": "Κατασκευή {p0} στο {p1}",
"Construct / recruit": "Κατασκευή / στρατολόγηση",
"Construct Port ·": "Κατασκευή Λιμανιού ·",
"Construct Port · {p0}": "Κατασκευή Λιμανιού · {p0}",
"Construct wonder": "Κατασκευή θαύματος",
"Construct, recruit and improve happiness": "Κατασκευή, στρατολόγηση και αύξηση ευτυχίας",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Κάθε πολιτισμός έχει τις δικές του προόδους. Η Ρώμη αποκτά το Υδραγωγείο όταν ερευνά τη Μηχανική. Άνοιξε τις Προόδους και ερεύνησε τη Μηχανική· το Υδραγωγείο ξεκλειδώνει αυτόματα, χωρίς ξεχωριστή αγορά."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "City center at {p0} permanently destroyed; city limit reduced to {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}",
"Razed {p0} because no city centers were available": "Razed {p0} because no city centers were available",
"Obelisk total piece limit reduced to {p0}": "Obelisk total piece limit reduced to {p0}"
"Obelisk total piece limit reduced to {p0}": "Obelisk total piece limit reduced to {p0}",
"Advance · {p0}": "Advance · {p0}",
"Advance · Sanitation · free action": "Advance · Sanitation · free action",
"Construct {p0}": "Construct {p0}",
"Construct {p0} at {p1}": "Construct {p0} at {p1}",
"Construct / recruit": "Construct / recruit",
"Construct Port ·": "Construct Port ·",
"Construct Port · {p0}": "Construct Port · {p0}",
"Construct wonder": "Construct wonder",
"Construct, recruit and improve happiness": "Construct, recruit and improve happiness",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "مرکز شهر در {p0} برای همیشه نابود شد؛ سقف شهرها به {p1} کاهش یافت",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} در {p1} برای همیشه نابود شد؛ سقف کل این نوع قطعات به {p2} کاهش یافت",
"Razed {p0} because no city centers were available": "{p0} ویران شد زیرا هیچ مرکز شهری در دسترس نبود",
"Obelisk total piece limit reduced to {p0}": "سقف کل قطعات ابلیسک به {p0} کاهش یافت"
"Obelisk total piece limit reduced to {p0}": "سقف کل قطعات ابلیسک به {p0} کاهش یافت",
"Advance · {p0}": "پیشرفت · {p0}",
"Advance · Sanitation · free action": "پیشرفت · بهداشت · اقدام رایگان",
"Construct {p0}": "ساخت {p0}",
"Construct {p0} at {p1}": "ساخت {p0} در {p1}",
"Construct / recruit": "ساخت / استخدام",
"Construct Port ·": "ساخت بندر ·",
"Construct Port · {p0}": "ساخت بندر · {p0}",
"Construct wonder": "ساخت شگفتی",
"Construct, recruit and improve happiness": "ساخت، جذب نیرو و افزایش شادی",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "هر تمدن پیشرفت‌های مخصوص خود را دارد. روم با پژوهش مهندسی، آب‌گذر را به دست می‌آورد. پیشرفت‌ها را باز کنید و مهندسی را پژوهش کنید؛ آب‌گذر خودکار و بدون خرید جداگانه باز می‌شود."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Centre-ville en {p0} détruit définitivement ; limite de villes réduite à {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} en {p1} détruit définitivement ; limite totale de ces pièces réduite à {p2}",
"Razed {p0} because no city centers were available": "{p0} rasée car aucun centre-ville n’était disponible",
"Obelisk total piece limit reduced to {p0}": "Limite totale des obélisques réduite à {p0}"
"Obelisk total piece limit reduced to {p0}": "Limite totale des obélisques réduite à {p0}",
"Advance · {p0}": "Avancée · {p0}",
"Advance · Sanitation · free action": "Avancée · Assainissement · action gratuite",
"Construct {p0}": "Construire {p0}",
"Construct {p0} at {p1}": "Construire {p0} à {p1}",
"Construct / recruit": "Construire / recruter",
"Construct Port ·": "Construire un Port ·",
"Construct Port · {p0}": "Construire un Port · {p0}",
"Construct wonder": "Construire une merveille",
"Construct, recruit and improve happiness": "Construire, recruter et améliorer le bonheur",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Chaque civilisation possède ses propres avancées. Rome obtient Aqueduc en recherchant Ingénierie. Ouvrez Progrès et recherchez Ingénierie ; Aqueduc se débloque automatiquement, sans achat séparé."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "{p0} पर शहर केंद्र स्थायी रूप से नष्ट; शहरों की सीमा घटकर {p1} हुई",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p1} पर {p0} स्थायी रूप से नष्ट; इस प्रकार के टुकड़ों की कुल सीमा घटकर {p2} हुई",
"Razed {p0} because no city centers were available": "कोई शहर केंद्र उपलब्ध न होने के कारण {p0} ध्वस्त किया गया",
"Obelisk total piece limit reduced to {p0}": "ओबिलिस्क टुकड़ों की कुल सीमा घटकर {p0} हुई"
"Obelisk total piece limit reduced to {p0}": "ओबिलिस्क टुकड़ों की कुल सीमा घटकर {p0} हुई",
"Advance · {p0}": "उन्नति · {p0}",
"Advance · Sanitation · free action": "उन्नति · स्वच्छता · मुफ़्त कार्रवाई",
"Construct {p0}": "{p0} बनाएँ",
"Construct {p0} at {p1}": "{p1} पर {p0} बनाएँ",
"Construct / recruit": "निर्माण / भर्ती",
"Construct Port ·": "बंदरगाह बनाएँ ·",
"Construct Port · {p0}": "बंदरगाह बनाएँ · {p0}",
"Construct wonder": "अजूबा बनाएँ",
"Construct, recruit and improve happiness": "निर्माण करें, भर्ती करें और खुशहाली बढ़ाएँ",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "हर सभ्यता की अपनी उन्नतियाँ होती हैं। रोम अभियांत्रिकी पर शोध करने पर जलसेतु पाता है। उन्नतियाँ खोलें और अभियांत्रिकी पर शोध करें; जलसेतु अलग खरीद के बिना अपने-आप खुल जाता है।"
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Centro città in {p0} distrutto permanentemente; limite di città ridotto a {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} in {p1} distrutto permanentemente; limite totale di questi pezzi ridotto a {p2}",
"Razed {p0} because no city centers were available": "{p0} rasa al suolo perché non erano disponibili centri città",
"Obelisk total piece limit reduced to {p0}": "Limite totale degli obelischi ridotto a {p0}"
"Obelisk total piece limit reduced to {p0}": "Limite totale degli obelischi ridotto a {p0}",
"Advance · {p0}": "Progresso · {p0}",
"Advance · Sanitation · free action": "Progresso · Igiene · azione gratuita",
"Construct {p0}": "Costruisci {p0}",
"Construct {p0} at {p1}": "Costruisci {p0} a {p1}",
"Construct / recruit": "Costruisci / recluta",
"Construct Port ·": "Costruisci Porto ·",
"Construct Port · {p0}": "Costruisci Porto · {p0}",
"Construct wonder": "Costruisci una meraviglia",
"Construct, recruit and improve happiness": "Costruisci, recluta e aumenta la felicità",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Ogni civiltà ha i propri progressi. Roma ottiene Acquedotto quando ricerca Ingegneria. Apri Progressi e ricerca Ingegneria; Acquedotto si sblocca automaticamente, senza un acquisto separato."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "{p0}의 도시 중심부가 영구 파괴됨; 도시 한도가 {p1}(으)로 감소",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p1}의 {p0} 영구 파괴됨; 해당 부품의 총 한도가 {p2}(으)로 감소",
"Razed {p0} because no city centers were available": "사용 가능한 도시 중심부가 없어 {p0} 파괴",
"Obelisk total piece limit reduced to {p0}": "오벨리스크 부품 총 한도가 {p0}(으)로 감소"
"Obelisk total piece limit reduced to {p0}": "오벨리스크 부품 총 한도가 {p0}(으)로 감소",
"Advance · {p0}": "발전 · {p0}",
"Advance · Sanitation · free action": "발전 · 위생 · 무료 행동",
"Construct {p0}": "{p0} 건설",
"Construct {p0} at {p1}": "{p1}에 {p0} 건설",
"Construct / recruit": "건설 / 모집",
"Construct Port ·": "항구 건설 ·",
"Construct Port · {p0}": "항구 건설 · {p0}",
"Construct wonder": "불가사의 건설",
"Construct, recruit and improve happiness": "건설·모집·행복 개선",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "문명마다 고유 발전이 있습니다. 로마는 공학을 연구하면 수로를 얻습니다. 발전을 열고 공학을 연구하세요. 수로는 따로 구매하지 않아도 자동으로 해금됩니다."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Stadscentrum bij {p0} permanent vernietigd; stadslimiet verlaagd naar {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} bij {p1} permanent vernietigd; totale limiet voor deze stukken verlaagd naar {p2}",
"Razed {p0} because no city centers were available": "{p0} verwoest omdat er geen stadscentra beschikbaar waren",
"Obelisk total piece limit reduced to {p0}": "Totale limiet voor obelisken verlaagd naar {p0}"
"Obelisk total piece limit reduced to {p0}": "Totale limiet voor obelisken verlaagd naar {p0}",
"Advance · {p0}": "Ontwikkeling · {p0}",
"Advance · Sanitation · free action": "Ontwikkeling · Sanitatie · gratis actie",
"Construct {p0}": "{p0} bouwen",
"Construct {p0} at {p1}": "{p0} bouwen op {p1}",
"Construct / recruit": "Bouwen / rekruteren",
"Construct Port ·": "Haven bouwen ·",
"Construct Port · {p0}": "Haven bouwen · {p0}",
"Construct wonder": "Wonder bouwen",
"Construct, recruit and improve happiness": "Bouwen, rekruteren en tevredenheid verhogen",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Elke beschaving heeft eigen ontwikkelingen. Rome krijgt Aquaduct wanneer het Bouwkunde onderzoekt. Open Ontwikkelingen en onderzoek Bouwkunde; Aquaduct wordt automatisch ontgrendeld, zonder aparte aankoop."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Centrum miasta na {p0} trwale zniszczone; limit miast zmniejszony do {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} na {p1} trwale zniszczone; łączny limit tych elementów zmniejszony do {p2}",
"Razed {p0} because no city centers were available": "Zburzono {p0}, ponieważ nie było dostępnych centrów miast",
"Obelisk total piece limit reduced to {p0}": "Łączny limit obelisków zmniejszony do {p0}"
"Obelisk total piece limit reduced to {p0}": "Łączny limit obelisków zmniejszony do {p0}",
"Advance · {p0}": "Postęp · {p0}",
"Advance · Sanitation · free action": "Postęp · Higiena · darmowa akcja",
"Construct {p0}": "Zbuduj {p0}",
"Construct {p0} at {p1}": "Zbuduj {p0} na {p1}",
"Construct / recruit": "Buduj / rekrutuj",
"Construct Port ·": "Zbuduj Port ·",
"Construct Port · {p0}": "Zbuduj Port · {p0}",
"Construct wonder": "Zbuduj cud",
"Construct, recruit and improve happiness": "Buduj, rekrutuj i poprawiaj nastrój",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Każda cywilizacja ma własne postępy. Rzym otrzymuje Akwedukt po zbadaniu Inżynierii. Otwórz Postępy i zbadaj Inżynierię; Akwedukt odblokowuje się automatycznie, bez osobnego zakupu."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Centro da cidade em {p0} destruído permanentemente; limite de cidades reduzido para {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} em {p1} destruído permanentemente; limite total dessas peças reduzido para {p2}",
"Razed {p0} because no city centers were available": "{p0} arrasada porque não havia centros de cidade disponíveis",
"Obelisk total piece limit reduced to {p0}": "Limite total de obeliscos reduzido para {p0}"
"Obelisk total piece limit reduced to {p0}": "Limite total de obeliscos reduzido para {p0}",
"Advance · {p0}": "Avanço · {p0}",
"Advance · Sanitation · free action": "Avanço · Saneamento · Ação gratuita",
"Construct {p0}": "Construir {p0}",
"Construct {p0} at {p1}": "Construir {p0} em {p1}",
"Construct / recruit": "Construir / recrutar",
"Construct Port ·": "Construir Porto ·",
"Construct Port · {p0}": "Construir Porto · {p0}",
"Construct wonder": "Construir Maravilha",
"Construct, recruit and improve happiness": "Construir, recrutar e melhorar felicidade",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Cada civilização tem seus próprios avanços. Roma ganha Aqueduto ao pesquisar Engenharia. Abra Avanços e pesquise Engenharia; Aqueduto desbloqueia automaticamente, sem uma compra separada."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Centrul orașului de la {p0} distrus permanent; limita de orașe redusă la {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} de la {p1} distrus permanent; limita totală a acestor piese redusă la {p2}",
"Razed {p0} because no city centers were available": "{p0} distrus deoarece nu erau disponibile centre de oraș",
"Obelisk total piece limit reduced to {p0}": "Limita totală de obeliscuri redusă la {p0}"
"Obelisk total piece limit reduced to {p0}": "Limita totală de obeliscuri redusă la {p0}",
"Advance · {p0}": "Progres · {p0}",
"Advance · Sanitation · free action": "Progres · Salubritate · acțiune gratuită",
"Construct {p0}": "Construiește {p0}",
"Construct {p0} at {p1}": "Construiește {p0} la {p1}",
"Construct / recruit": "Construiește / recrutează",
"Construct Port ·": "Construiește Port ·",
"Construct Port · {p0}": "Construiește Port · {p0}",
"Construct wonder": "Construiește o minune",
"Construct, recruit and improve happiness": "Construiește, recrutează și îmbunătățește fericirea",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Fiecare civilizație are propriile progrese. Roma primește Apeduct când cercetează Inginerie. Deschide Progrese și cercetează Inginerie; Apeduct se deblochează automat, fără o achiziție separată."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Центр города в {p0} уничтожен навсегда; предел числа городов снижен до {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} в {p1} уничтожено навсегда; общий предел этих элементов снижен до {p2}",
"Razed {p0} because no city centers were available": "Город {p0} разрушен, так как не было доступных центров городов",
"Obelisk total piece limit reduced to {p0}": "Общий предел обелисков снижен до {p0}"
"Obelisk total piece limit reduced to {p0}": "Общий предел обелисков снижен до {p0}",
"Advance · {p0}": "Достижение · {p0}",
"Advance · Sanitation · free action": "Достижение · Санитария · бесплатное действие",
"Construct {p0}": "Построить: {p0}",
"Construct {p0} at {p1}": "Построить {p0} в {p1}",
"Construct / recruit": "Строить / нанимать",
"Construct Port ·": "Построить порт ·",
"Construct Port · {p0}": "Построить порт · {p0}",
"Construct wonder": "Построить чудо",
"Construct, recruit and improve happiness": "Строительство, найм и повышение счастья",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "У каждой цивилизации свои достижения. Рим получает Акведук, когда исследует Инженерию. Откройте «Достижения» и исследуйте Инженерию; Акведук откроется автоматически, без отдельной покупки."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "Trung tâm thành phố tại {p0} bị phá hủy vĩnh viễn; giới hạn thành phố giảm còn {p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p0} tại {p1} bị phá hủy vĩnh viễn; tổng giới hạn loại quân cờ này giảm còn {p2}",
"Razed {p0} because no city centers were available": "Đã phá hủy {p0} vì không còn trung tâm thành phố khả dụng",
"Obelisk total piece limit reduced to {p0}": "Tổng giới hạn Đài Tưởng Niệm giảm còn {p0}"
"Obelisk total piece limit reduced to {p0}": "Tổng giới hạn Đài Tưởng Niệm giảm còn {p0}",
"Advance · {p0}": "Tiến bộ · {p0}",
"Advance · Sanitation · free action": "Tiến bộ · Vệ sinh · Hành động miễn phí",
"Construct {p0}": "Xây {p0}",
"Construct {p0} at {p1}": "Xây {p0} tại {p1}",
"Construct / recruit": "Xây dựng / chiêu mộ",
"Construct Port ·": "Xây Cảng ·",
"Construct Port · {p0}": "Xây Cảng · {p0}",
"Construct wonder": "Xây Kỳ quan",
"Construct, recruit and improve happiness": "Xây dựng, tuyển quân và tăng hạnh phúc",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "Mỗi nền văn minh có tiến bộ riêng. La Mã nhận Cầu dẫn nước khi nghiên cứu Kỹ thuật. Mở Các tiến bộ và nghiên cứu Kỹ thuật; Cầu dẫn nước tự mở khóa, không cần mua riêng."
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "{p0}的城市中心被永久摧毁;城市上限降至{p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p1}的{p0}被永久摧毁;此类配件总数上限降至{p2}",
"Razed {p0} because no city centers were available": "因没有可用的城市中心,夷平了{p0}",
"Obelisk total piece limit reduced to {p0}": "方尖碑配件总数上限降至{p0}"
"Obelisk total piece limit reduced to {p0}": "方尖碑配件总数上限降至{p0}",
"Advance · {p0}": "进步 · {p0}",
"Advance · Sanitation · free action": "进步 · 卫生 · 免费行动",
"Construct {p0}": "建造{p0}",
"Construct {p0} at {p1}": "在{p1}建造{p0}",
"Construct / recruit": "建造/招募",
"Construct Port ·": "建造港口 ·",
"Construct Port · {p0}": "建造港口 · {p0}",
"Construct wonder": "建造奇迹",
"Construct, recruit and improve happiness": "建造、招募并提升幸福度",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "各文明都有专属进步。罗马研究工程学时获得引水渠。打开进步并研究工程学,引水渠自动解锁,无需单独购买。"
}

View file

@ -5296,5 +5296,15 @@
"City center at {p0} permanently destroyed; city limit reduced to {p1}": "{p0}的城市中心被永久摧毀;城市上限降至{p1}",
"{p0} at {p1} permanently destroyed; total piece limit reduced to {p2}": "{p1}的{p0}被永久摧毀;此類配件總數上限降至{p2}",
"Razed {p0} because no city centers were available": "因沒有可用的城市中心,夷平了{p0}",
"Obelisk total piece limit reduced to {p0}": "方尖碑配件總數上限降至{p0}"
"Obelisk total piece limit reduced to {p0}": "方尖碑配件總數上限降至{p0}",
"Advance · {p0}": "科技 · {p0}",
"Advance · Sanitation · free action": "科技 · 衛生 · 免費行動",
"Construct {p0}": "建造{p0}",
"Construct {p0} at {p1}": "在{p1}建造{p0}",
"Construct / recruit": "建造/招募",
"Construct Port ·": "建造港口 ·",
"Construct Port · {p0}": "建造港口 · {p0}",
"Construct wonder": "建造奇觀",
"Construct, recruit and improve happiness": "建造、招募與提升幸福",
"Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.": "每個文明都有專屬科技。羅馬研究工程學時獲得水道橋。開啟科技並研究工程學;水道橋會自動解鎖,不需要另行購買。"
}

View file

@ -211,7 +211,7 @@ test('recap captions and highlights describe public recruitment and movement wit
assert.deepEqual(frameDetails(after, moved), { caption: 'Greece · Move', positions: ['A2', 'A1'] });
const unchanged = structuredClone(moved);
unchanged.title = 'Research';
assert.deepEqual(frameDetails(moved, unchanged), { caption: 'Greece · Research', positions: [] });
assert.deepEqual(frameDetails(moved, unchanged), { caption: 'Greece · Advance', positions: [] });
});
test('recap names researched advances from its public log interval, including old recordings', () => {
@ -251,10 +251,11 @@ test('recap names researched advances from its public log interval, including ol
},
],
} as Game;
assert.equal(frameDetails(before, after, history).caption, 'Greece · researched Steel Weapons');
for (const title of ['Advance', 'Research'])
assert.equal(frameDetails(before, { ...after, title }, history).caption, 'Greece · researched Steel Weapons');
assert.equal(
frameDetails(before, after, { ...history, log_index: 1 }).caption,
'Greece · Research',
'Greece · Advance',
'undone research is not presented',
);
});
@ -298,7 +299,8 @@ test('recap details name construction and collected amounts without exposing coo
],
} as Game;
const after = { ...before, cursor: 1, actor: 1, title: 'Build' };
assert.equal(frameDetails(before, after, game).caption, 'Greece · built Academy · gained 2 food, 1 wood');
for (const title of ['Construct', 'Construct wonder', 'Build', 'Build wonder'])
assert.equal(frameDetails(before, { ...after, title }, game).caption, 'Greece · built Academy · gained 2 food, 1 wood');
assert.equal(
frameDetails(before, { ...after, title: 'Collect' }, game).caption,
'Greece · collected 2 food, 1 wood',
@ -594,3 +596,14 @@ test('recap keeps a declined influence boost even when the board does not change
assert.equal(frameHasContent(game, pending, failed), true);
assert.match(frameDetails(pending, failed, game).caption, /failed against Rome’s Fortress/);
});
test('legacy and current action frame titles share display labels without mutating recordings', () => {
for (const [legacy, current] of [['Research', 'Advance'], ['Build', 'Construct'], ['Build wonder', 'Construct wonder']]) {
for (const title of [legacy, current]) {
const frame = { cursor: 1, actor: 0, title, tiles: [], players: [{ id: 0, civilization: 'Rome', cities: [], units: [] }] } as unknown as BoardFrame;
assert.equal(frameDetails(undefined, frame).caption, `Rome · ${current}`);
assert.equal(frame.title, title);
assert.equal(frameHasContent({ log: [], log_index: 0 } as unknown as Game, undefined, frame), true);
}
}
});

View file

@ -117,9 +117,16 @@ export function frameDetails(
for (const [position, terrain] of frame.tiles)
if (JSON.stringify(tiles.get(position)) !== JSON.stringify(terrain)) positions.add(position);
}
// Old recordings retain their original titles; normalize only the displayed caption.
let description = ['Explore Resolution', 'Finish ship exploration'].includes(frame.title)
? 'Explore'
: frame.title;
: frame.title === 'Research'
? 'Advance'
: frame.title === 'Build'
? 'Construct'
: frame.title === 'Build wonder'
? 'Construct wonder'
: frame.title;
let generic = [
'Resolve choice',
'Pay for action',
@ -256,7 +263,7 @@ export function frameDetails(
.join(', ')}`,
);
if (player.id !== frame.actor) continue;
if (generic || frame.title === 'Build' || frame.title === 'Build wonder') {
if (generic || ['Construct', 'Construct wonder', 'Build', 'Build wonder'].includes(frame.title)) {
const built = own.flatMap((item) => {
const structure = item.Structure;
if (
@ -332,7 +339,7 @@ export function frameDetails(
if (details.length)
description =
(generic && description === frame.title) ||
['Research', 'Build', 'Build wonder', 'Collect'].includes(frame.title)
['Advance', 'Construct', 'Construct wonder', 'Research', 'Build', 'Build wonder', 'Collect'].includes(frame.title)
? details.join(' · ')
: [description, ...details].join(' · ');
}
@ -348,7 +355,7 @@ export function frameDetails(
description =
(
{
SelectAdvance: 'Research',
SelectAdvance: 'Advance',
SelectUnits: 'Selected units',
SelectPositions: 'Selected a location',
Payment: 'Payment',

View file

@ -7,8 +7,8 @@ const cues: [SoundCue, string, string][] = [
['hover', 'Hover', 'Moving over an interactive target'],
['select', 'Select', 'Selecting a unit or option'],
['collect', 'Collect', 'Collecting resources'],
['build', 'Build / recruit', 'Constructing, founding or recruiting'],
['research', 'Research', 'Gaining an advance'],
['build', 'Construct / recruit', 'Constructing, founding or recruiting'],
['research', 'Advance', 'Gaining an advance'],
['draw', 'Draw card', 'Drawing a card'],
['move', 'Move', 'Moving units'],
['confirm', 'Confirm', 'Other confirmed actions'],

View file

@ -408,7 +408,7 @@ export const chapters: {
version: 2,
steps: [
{ id: 'advance', title: 'Unlock Rome’s Aqueduct',
text: 'Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Research and research Engineering; Aqueduct unlocks automatically, without a separate purchase.',
text: 'Each civilization has its own advances. Rome gains Aqueduct when it researches Engineering. Open Advances and research Engineering; Aqueduct unlocks automatically, without a separate purchase.',
kind: 'engineering' },
{
id: 'leader',
@ -713,7 +713,7 @@ export function createLesson(id: string, engine: TutorialEngine, initialGame: st
'Confirm',
];
if (['storage', 'math', 'engineering', 'incident'].includes(step.kind ?? ''))
return ['Research', offer?.Playing?.Advance?.advance ?? '', 'Research'];
return ['Advance', offer?.Playing?.Advance?.advance ?? '', 'Advance'];
if (['walk', 'explore', 'embark', 'sail', 'land'].includes(step.kind ?? ''))
return [
'Move',