Fix Ballcourts token conversion and score artwork; release viewer 229 engine 161

This commit is contained in:
coyotte508 2026-11-20 07:54:26 +00:00
commit 01b99b81e1
22 changed files with 1756 additions and 85 deletions

View file

@ -12,6 +12,28 @@ its existing engine hooks. The web-client tests check the generated API against
`@boardgamers/protocol` **0.11.0** types and runtime schemas; there is no separate
JavaScript scoring implementation.
## Viewer 0.1.229 / engine 0.4.161 — revision 8, 46 definitions
`score-50` and `score-60` now reference their own `achievement-score-50` and
`achievement-score-60` assets. Their SVG/PNG pictograms visibly render **50** and
**60**, using the existing 40-point panorama, palette and typography. All prior
SVGs (including 40) are unchanged. Thresholds, titles, descriptions, award order
and the 46 definitions are unchanged. There are now 43 unique achievement images
(28 non-faction plus 15 faction), or 60 named artwork assets overall.
Reproduce with `node web-client/scripts/build-achievement-assets.mjs --nonfaction`.
The tracked non-faction manifest records both new keys and the generator hash;
local SVGs, 256px PNGs and light/dark 32/48/64px contact sheets are generated under
`web-client/.engine/achievement-assets-nonfaction/` (ignored build output).
Catalog revision 8 changes only the two icon references. Non-faction artwork
manifest/receipt revision 4 adds the two images; faction artwork stays revision 2.
Upload and anonymously verify the two new named assets before activating the
matching engine catalog. Preserve all 58 existing hosted assets byte-for-byte.
The release also fixes automatic Ballcourts payment with Great Arena; see
[Ballcourts payment and historical replay](ballcourts-payment.md).
No backfill, live-game writes or history repair are performed.
## Viewer 0.1.226 / engine 0.4.159 — revision 7, 46 definitions
Removes “: Recorded as Built” from the eight individual wonder titles: Great

View file

@ -0,0 +1,37 @@
# Ballcourts and Great Arena payment
Verified against the [official Monumental Edition rulebook](https://wizkids.com/posters/repository/wizkids/Clash-of-Cultures---Rulebook---WEB---2021-02-05-compressed.pdf):
- Page 28, Great Arena: “allows you to spend [culture] as [mood] and vice versa—except when spending [culture] to Construct a [Wonder].” It further specifies that when “spending, discarding, or otherwise using the tokens, they are interchangeable.” Brackets transcribe the printed icons.
- Page 34, Maya / Ballcourts: “When you Collect Resources or Recruit Units, you may pay 1 [mood] to treat the city as 1 size larger, allowing you to Collect 1 more Resource or Recruit 1 more Unit (of course still paying its cost).” Its separate once-per-turn Spirituality discount remains unchanged. This increases capacity, not available actions or activation permissions.
## Bug and fix — viewer 0.1.229 / engine 0.4.161
Collection checked the raw mood balance in both collection validation and the web preview, then directly debited one mood during execution. All three paths bypassed the engine's general payment conversions. Recruitment already included the fee in its `PaymentOptions` and supported Great Arena correctly.
Collection keeps its original immediate payment flow: the Ballcourts fee is automatically charged with the shared `PaymentOptions::first_valid_payment` conversion helper, preferring mood as before and using culture when mood is unavailable and Great Arena allows it. There is no new payment confirmation, including when both tokens are available. Recruitment's existing explicit payment selection is unchanged. The combined cost is used by the preview and authoritative action boundary to check affordability before collection, so collected resources cannot fund either fee.
The preview subtracts the recommended action payment when predicting resulting resources/waste. The affordability check retains any modified collection action's original cost and adds the Ballcourts fee, so one token cannot fund both costs. Free Economy keeps its existing one-token payment request; execution then charges the separate Ballcourts fee exactly once from the remaining tokens. Standard city activation, capacity, terrain and per-tile validation still applies. GUI toggles depend on the existing Ballcourts/non-Angry eligibility flag, not a separate mood balance check.
Regression coverage: native `ballcourts_payment_tests`, plus WASM-backed `remaining-civilizations.test.ts` and desktop/mobile built-viewer `node web-client/scripts/ballcourts-payment-smoke.mjs` (ordinary collection and Free Economy, culture-only payment, no added decision); the existing Spirituality, Terracing, collection-capacity and controller tests remain relevant. The engine's Great Arena conversion listener and wonder-construction exception are not changed.
The regression was also run against the original three engine files: recruitment completed successfully using culture, then collection failed with `Ballcourts costs 1 mood token`. With the fix, both actions complete and deduct exactly one culture token. Native coverage also exercises Free Economy + Ballcourts: one culture is insufficient; two pay both fees while retaining Free Economy's zero action-point cost.
A narrow scan of other raw mood checks/direct resource debits did not identify another matching Ballcourts-style mood fee bypass; Calendar, Free Economy, happiness and recruitment already use payment options. No broader payment-rule changes were made.
## Historical replay verification
The earlier local prompt implementation was **not history-compatible**: it left an old immediate collection waiting for a new payment response. Replaying the frozen fixture below then failed at move 12 with `action should be a response: Playing(Collect(...))`. This was reproduced with the actual compiled prompt implementation, not inferred from code. The prompt was removed rather than introducing a history boundary or migration. The existing asynchronous-combat boundary pattern was inspected but is unnecessary when retaining this original action sequence.
`server/tests/fixtures/legacy_ballcourts_history.json` is a frozen synthetic, legal history generated entirely by production **0.4.160**, without edits to resources, advances, cities, or logs. Starting from seed `ballcourts-history`, Maya researches Arts, collects twice, ends both players' turns, researches Sports, collects with Ballcourts (automatically spending its one mood), then makes another ordinary collection. The expected JSON records production states both immediately after Ballcourts and after the following action. Full and partial replay, a new branch, undo/redo of both collections, and branch replay match production. No payment response is inserted or removed.
Production artifact source:
- Package: `@boardgamers/clash-server` version `0.4.160` (source release commit `8b3b81e7`).
- URL: <https://s3.fr-par.scw.cloud/bgs-assets/games/clash/1/engine/fadd09ac21e7b5dd/boardgamers-clash-server-0.4.160.tgz>
- Archive SHA-256: `fadd09ac21e7b5dd659950a3ab266ae5a0fb08dbe1bbec119ce429393690da20`.
- `server_bg.wasm` SHA-256: `3be580e4bf734620e2cc827f4c871b2ae6fbbb86115abe3b9574df7d44e93698`.
The explicit maintenance generator is `scripts/generate-legacy-ballcourts-history.mjs /absolute/path/to/production/package/server.js`; it checks the package version and verifies both snapshots with production replay. Normal tests only read the frozen files; they never regenerate expectations with the current engine. Run `node --experimental-strip-types --test web-client/src/ballcourts-history-engine.test.ts` after building the bridge. Set `CLASH_TEST_ENGINE=/absolute/path/to/production/package/server.js` to run the same three compatibility tests against production. Both production and the corrected local WASM pass. The original culture-only bug still fails on production, while the local culture-only collection/recruitment tests pass.
Native coverage also verifies mixed-token Free Economy payments (either original token choice), two mood, two culture, insufficient combined tokens, automatic mood preference, no double charge, and unchanged action/activation counts. The matching release is viewer 0.1.229 / engine 0.4.161.

View file

@ -0,0 +1,48 @@
// Explicit maintenance tool, never run by tests. Requires the published 0.4.160 package.
// node scripts/generate-legacy-ballcourts-history.mjs /absolute/path/to/package/server.js
import { createRequire } from 'node:module';
import { readFileSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import assert from 'node:assert/strict';
const path = resolve(process.argv[2]);
assert.equal(JSON.parse(readFileSync(resolve(dirname(path), 'package.json'))).version, '0.4.160');
const engine = createRequire(import.meta.url)(path);
let raw = await engine.init(2, [], { civilization: 'ChooseCivilization' }, 'ballcourts-history', {});
const seat = () => engine.currentPlayer(raw);
const view = () => JSON.parse(engine.webView(engine.stripSecret(raw, seat()), seat()));
const move = (action) => { raw = engine.tryMove(raw, JSON.stringify(action), seat()); };
const collect = (bonus = false) => {
const city = view().cities[0];
const selections = bonus
? city.choices.slice(0, 2).map(c => ({ position: c.position, pile: c.pile, times: 1 }))
: [{ position: city.position, pile: { food: 1 }, times: 1 }];
return JSON.parse(engine.webQuery(engine.stripSecret(raw, seat()), seat(), JSON.stringify({
kind: 'collect', city: city.position, variant: 'Collect', ballcourts: bonus, selections,
}))).action;
};
move({ ChooseCivilization: 'Maya' });
move({ ChooseCivilization: 'Rome' });
move(view().advances.find(a => a.id === 'Arts').action);
move(collect());
move(collect());
move({ Playing: 'EndTurn' });
move({ Playing: 'EndTurn' });
move(view().advances.find(a => a.id === 'Sports').action);
const before = engine.logLength(raw);
const bonus = collect(true);
move(bonus);
const paid = raw;
move(collect());
const full = raw;
const fields = ['players', 'events', 'actions_left', 'rng', 'time_increments', 'state'];
const projection = raw => Object.fromEntries(fields.map(k => [k, JSON.parse(raw)[k]]).filter(([, v]) => v !== undefined));
for (const save of [paid, full]) assert.deepEqual(projection(engine.replay(save, {})), projection(save));
const data = JSON.parse(full);
const fixture = Object.fromEntries(['seed', 'options', 'players', 'log', 'log_index', 'time_increments'].map(k => [k, data[k]]));
fixture.players = fixture.players.map(({ id, name, civilization, settings }) => ({ id, name, civilization, settings }));
const root = new URL('../server/tests/fixtures/', import.meta.url);
writeFileSync(new URL('legacy_ballcourts_history.json', root), JSON.stringify(fixture, null, 2) + '\n');
writeFileSync(new URL('legacy_ballcourts_history.expected.json', root), JSON.stringify({
before, afterPayment: engine.logLength(paid), full: engine.logLength(full), bonus,
paid: projection(paid), following: projection(full),
}, null, 2) + '\n');

View file

@ -167,12 +167,11 @@ pub fn definitions() -> Manifest {
name: name.into(),
description: description.into(),
icon: Some(Icon::Asset {
// Reuse existing category artwork; no new assets or uploads.
// Objective and advance tiers share category artwork; score tiers have exact numerals.
key: format!(
"achievement-{}",
match id {
"five-objectives" | "seven-objectives" => "three-objectives",
"score-50" | "score-60" => "score-40",
"thirty-advances" => "twenty-advances",
_ => id,
}
@ -200,7 +199,7 @@ pub fn definitions() -> Manifest {
icon: Some(Icon::Asset { key: format!("achievement-faction-{slug}") }),
}));
Manifest {
revision: 7,
revision: 8,
achievements: definitions,
}
}
@ -358,7 +357,7 @@ mod tests {
#[test]
fn manifest_and_real_end_turn_for_all_lengths() {
let manifest = definitions();
assert_eq!(manifest.revision, 7);
assert_eq!(manifest.revision, 8);
assert_eq!(manifest.achievements.len(), 46);
assert_eq!(
manifest
@ -665,7 +664,7 @@ mod tests {
FACTIONS.iter().map(|(name, _)| (*name).into()).collect()
);
let manifest = serde_json::to_value(definitions()).unwrap();
assert_eq!(manifest["revision"], 7);
assert_eq!(manifest["revision"], 8);
assert_eq!(manifest.as_object().unwrap().len(), 2);
let entries = manifest["achievements"].as_array().unwrap();
assert_eq!(entries.len(), 46);
@ -690,7 +689,6 @@ mod tests {
"achievement-{}",
match entry["id"].as_str().unwrap() {
"five-objectives" | "seven-objectives" => "three-objectives",
"score-50" | "score-60" => "score-40",
"thirty-advances" => "twenty-advances",
id => id,
}

View file

@ -112,9 +112,6 @@ pub(crate) fn get_total_collection_with_ballcourts(
{
return Err("Ballcourts requires a non-Angry city".into());
}
if ballcourts && player.resources.mood_tokens == 0 {
return Err("Ballcourts costs 1 mood token".into());
}
if origin == &EventOrigin::LeaderAbility("Tributes".into())
&& !crate::content::civilizations::aztecs::tributes_city(player, city_position)
@ -227,11 +224,23 @@ pub(crate) fn execute_collect(
c.ballcourts,
)?;
if c.ballcourts {
let origin =
EventOrigin::SpecialAdvance(crate::special_advance::SpecialAdvance::Ballcourts);
let cost = crate::payment::PaymentOptions::resources(
game.player(player_index),
origin.clone(),
ResourcePile::mood_tokens(1),
);
// Keep the historical immediate mood debit, using culture only when
// required and permitted by Great Arena. Never collect to fund this fee.
let payment = cost
.first_valid_payment(&game.player(player_index).resources)
.ok_or("Not enough mood for this action and Ballcourts")?;
crate::resource::lose_resources(
game,
player_index,
ResourcePile::mood_tokens(1),
EventOrigin::SpecialAdvance(crate::special_advance::SpecialAdvance::Ballcourts),
payment,
origin,
vec![],
crate::log::ActionLogBalance::Pay,
);
@ -485,3 +494,28 @@ pub(crate) fn collect_event_origin(
pub(crate) fn base_collect_event_origin() -> EventOrigin {
EventOrigin::Ability("Collect".to_string())
}
/// Combined cost for affordability and preview; the ordinary action payment
/// remains unchanged and Ballcourts is charged automatically at collection.
pub(crate) fn collection_payment_options(
game: &Game,
player: usize,
kind: &PlayingActionType,
ballcourts: bool,
) -> crate::payment::PaymentOptions {
let mut cost = kind.payment_options(game, player);
if ballcourts {
if cost.is_free() {
return crate::payment::PaymentOptions::resources(
game.player(player),
EventOrigin::SpecialAdvance(crate::special_advance::SpecialAdvance::Ballcourts),
ResourcePile::mood_tokens(1),
);
}
cost.default.mood_tokens += 1;
for alternative in &mut cost.alternatives {
alternative.mood_tokens += 1;
}
}
cost
}

View file

@ -210,6 +210,35 @@ impl PlayingAction {
game: &mut Game,
player_index: usize,
) -> Result<(), String> {
if let PlayingAction::Collect(c) = &self {
// Validate and reserve both fees before any ordinary action payment.
// Ballcourts itself stays automatic, preserving historical action logs.
crate::collect::get_total_collection_with_ballcourts(
game,
player_index,
&crate::collect::collect_event_origin(&c.action_type, game.player(player_index)),
c.city_position,
&c.collections,
crate::player::CostTrigger::NoModifiers,
c.ballcourts,
)?;
if !game
.player(player_index)
.get_city(c.city_position)
.can_activate()
{
return Err("City can't be activated".into());
}
let cost = crate::collect::collection_payment_options(
game,
player_index,
&c.action_type,
c.ballcourts,
);
if !game.player(player_index).can_afford(&cost) {
return Err("Not enough mood for this action and Ballcourts".into());
}
}
// log these before the payment for clarity
if let PlayingAction::ActionCard(id) = &self {
discard_action_card(

View file

@ -745,16 +745,10 @@ fn collect_variant_preview(
CostTrigger::NoModifiers,
ballcourts,
)?;
if ballcourts
&& p.resources.mood_tokens
< kind
.payment_options(game, seat)
.first_valid_payment(&p.resources)
.map_or(0, |pile| pile.mood_tokens)
+ 1
{
return Err("Not enough mood for this action and Ballcourts".into());
}
let cost = crate::collect::collection_payment_options(game, seat, &kind, ballcourts);
let payment = cost
.first_valid_payment(&p.resources)
.ok_or("Not enough mood for this action and Ballcourts")?;
let mut effects = collection
.info
.log
@ -767,7 +761,9 @@ fn collect_variant_preview(
effects.push(json!({"source":"Pottery","description":format!("Gain {pottery}")}));
total += pottery;
}
let mut after = p.resources.clone() + total.clone();
let mut after = p.resources.clone();
after -= payment;
after += total.clone();
let waste = after.apply_resource_limit(&p.resource_limit);
let mut collect = Collect::new(city, selections, kind);
collect.ballcourts = ballcourts;

View file

@ -0,0 +1,222 @@
//! Great Arena applies to Ballcourts through the ordinary payment pipeline.
use serde_json::{Value, json};
use server::{
action::{Action, try_execute_action},
cache::Cache,
game::{Game, GameContext},
game_data::GameData,
web_view,
};
fn fixture(arena: bool, mood: u8, culture: u8) -> Game {
let mut data: Value = serde_json::from_str(include_str!(
"test_games/advances/collect_free_economy.json"
))
.unwrap();
let fresh = server::game_api::init(2, "ballcourts-npcs".into(), Default::default());
let npcs = serde_json::to_value(fresh.cloned_data()).unwrap();
data["players"]
.as_array_mut()
.unwrap()
.extend(npcs["players"].as_array().unwrap().iter().skip(2).cloned());
let p = &mut data["players"][0];
p["civilization"] = json!("Maya");
p["advances"] = json!(["Farming", "Mining", "Arts", "Sports"]);
p["resources"] = json!({"food":5,"wood":5,"ore":5,"mood_tokens":mood,"culture_tokens":culture});
p["resource_limit"]["food"] = json!(7);
p["cities"][0]["mood_state"] = json!("Neutral");
if arena {
p["cities"][1]["city_pieces"]["wonders"] = json!(["Colosseum"]);
}
let data: GameData = serde_json::from_value(data).unwrap();
let cache = Cache::new(&data.options);
Game::from_data(data, cache, GameContext::Play)
}
fn params(game: &Game, recruit: bool) -> Value {
if recruit {
return json!({"kind":"recruit","city":"A1","units":{"infantry":2},"replaced":[],"ballcourts":true});
}
let view = web_view::view(game, Some(0));
let choices = view["cities"]
.as_array()
.unwrap()
.iter()
.find(|c| c["position"] == "A1")
.unwrap()["choices"]
.as_array()
.unwrap();
let first = &choices[0];
let second = choices
.iter()
.find(|c| c["position"] != first["position"])
.unwrap();
json!({"kind":"collect","city":"A1","variant":"Collect","ballcourts":true,"selections":[
{"position":first["position"],"pile":first["pile"],"times":1},
{"position":second["position"],"pile":second["pile"],"times":1}]})
}
fn play(game: Game, action: Value) -> Game {
try_execute_action(game, serde_json::from_value::<Action>(action).unwrap(), 0).unwrap()
}
#[test]
fn arena_culture_pays_exactly_once_for_collect_and_recruit() {
for recruit in [true, false] {
let game = fixture(true, 0, 3);
let query = params(&game, recruit);
let offer = web_view::query(&game, 0, query.clone()).unwrap();
let before = game.player(0).resources.clone();
let actions = game.actions_left;
let units = game.player(0).units.len();
let after = play(game, offer["action"].clone());
assert!(after.current_event_handler().is_none());
assert_eq!(after.player(0).resources.culture_tokens, 2);
assert_eq!(after.player(0).resources.mood_tokens, 0);
assert_eq!(after.actions_left, actions - 1);
assert!(after.player(0).cities[0].is_activated());
if recruit {
assert_eq!(after.player(0).units.len(), units + 2);
assert_eq!(after.player(0).resources.food, before.food - 2);
assert_eq!(after.player(0).resources.ore, before.ore - 2);
} else {
let mut expected = before;
expected.culture_tokens -= 1;
expected += serde_json::from_value(offer["total"].clone()).unwrap();
assert_eq!(after.player(0).resources, expected);
}
}
}
#[test]
fn no_arena_or_no_tokens_rejects_bonus_in_preview_and_engine() {
for recruit in [false, true] {
let valid = fixture(true, 0, 3);
let action = web_view::query(&valid, 0, params(&valid, recruit)).unwrap()["action"].clone();
for (arena, culture) in [(false, 3), (true, 0)] {
let game = fixture(arena, 0, culture);
assert!(web_view::query(&game, 0, params(&game, recruit)).is_err());
assert!(
try_execute_action(game, serde_json::from_value(action.clone()).unwrap(), 0)
.is_err()
);
}
}
}
#[test]
fn arena_collect_automatically_prefers_mood_without_a_decision() {
let game = fixture(true, 2, 3);
let offer = web_view::query(&game, 0, params(&game, false)).unwrap();
let after = play(game, offer["action"].clone());
assert!(after.current_event_handler().is_none());
assert_eq!(after.player(0).resources.mood_tokens, 1);
assert_eq!(after.player(0).resources.culture_tokens, 3);
}
#[test]
fn arena_recruit_allows_either_token_but_not_free_or_excess_capacity() {
for token in ["mood_tokens", "culture_tokens"] {
let game = fixture(true, 2, 3);
let mut query = params(&game, true);
let mut payment = json!({"food":2,"ore":2});
payment[token] = json!(1);
query["payment"] = payment;
let offer = web_view::query(&game, 0, query).unwrap();
let after = play(game, offer["action"].clone());
assert_eq!(
after.player(0).resources.mood_tokens,
if token == "mood_tokens" { 1 } else { 2 }
);
assert_eq!(
after.player(0).resources.culture_tokens,
if token == "culture_tokens" { 2 } else { 3 }
);
}
let game = fixture(true, 2, 3);
let mut query = params(&game, true);
query["payment"] = json!({"food":2,"ore":2});
assert!(web_view::query(&game, 0, query.clone()).is_err());
query.as_object_mut().unwrap().remove("payment");
query["units"]["infantry"] = json!(3);
assert!(web_view::query(&game, 0, query).is_err());
}
#[test]
fn arena_does_not_bypass_angry_cities_tile_limits_or_activation() {
for recruit in [false, true] {
let mut game = fixture(true, 2, 3);
let query = params(&game, recruit);
game.player_mut(0).cities[0].mood_state = server::city::MoodState::Angry;
assert!(web_view::query(&game, 0, query).is_err());
}
let mut game = fixture(true, 2, 3);
let query = params(&game, false);
game.player_mut(0).cities[0].angry_activation = true;
assert!(web_view::query(&game, 0, query).is_err());
let game = fixture(true, 2, 3);
let mut query = params(&game, false);
query["selections"][0]["times"] = json!(2);
assert!(web_view::query(&game, 0, query).is_err());
}
#[test]
fn free_economy_and_ballcourts_must_pay_both_fees() {
for culture in [1, 2] {
let mut data = serde_json::to_value(fixture(true, 0, culture).cloned_data()).unwrap();
data["players"][0]["advances"]
.as_array_mut()
.unwrap()
.extend([json!("Voting"), json!("FreeEconomy")]);
let data: GameData = serde_json::from_value(data).unwrap();
let cache = Cache::new(&data.options);
let game = Game::from_data(data, cache, GameContext::Play);
let mut query = params(&game, false);
query["variant"] = json!({"Special":{"Modifier":"FreeEconomyCollect"}});
let result = web_view::query(&game, 0, query);
if culture == 1 {
assert!(result.is_err());
} else {
let actions = game.actions_left;
let pending = play(game, result.unwrap()["action"].clone());
let after = play(
pending,
json!({"Response":{"Payment":[{"culture_tokens":1}]}}),
);
assert_eq!(after.player(0).resources.culture_tokens, 0);
assert_eq!(after.actions_left, actions);
assert_eq!(after.player(0).cities[0].activations, 1);
}
}
}
#[test]
fn free_economy_reserves_ballcourts_with_mixed_tokens_and_no_extra_response() {
for (mood, culture, payment) in [
(2, 0, json!({"mood_tokens":1})),
(1, 1, json!({"mood_tokens":1})),
(1, 1, json!({"culture_tokens":1})),
] {
let mut data = serde_json::to_value(fixture(true, mood, culture).cloned_data()).unwrap();
data["players"][0]["advances"]
.as_array_mut()
.unwrap()
.extend([json!("Voting"), json!("FreeEconomy")]);
let data: GameData = serde_json::from_value(data).unwrap();
let cache = Cache::new(&data.options);
let game = Game::from_data(data, cache, GameContext::Play);
let actions = game.actions_left;
let mut query = params(&game, false);
query["variant"] = json!({"Special":{"Modifier":"FreeEconomyCollect"}});
let offer = web_view::query(&game, 0, query).unwrap();
let pending = play(game, offer["action"].clone());
assert!(
pending.current_event_handler().is_some(),
"existing Free Economy payment"
);
let after = play(pending, json!({"Response":{"Payment":[payment]}}));
assert!(
after.current_event_handler().is_none(),
"no new Ballcourts response"
);
assert_eq!(after.player(0).resources.mood_tokens, 0);
assert_eq!(after.player(0).resources.culture_tokens, 0);
assert_eq!(after.actions_left, actions);
assert_eq!(after.player(0).cities[0].activations, 1);
}
}

View file

@ -0,0 +1,258 @@
{
"before": 10,
"afterPayment": 11,
"full": 12,
"bonus": {
"Playing": {
"Collect": {
"action_type": "Collect",
"ballcourts": true,
"city_position": "D2",
"collections": [
{
"pile": {
"food": 1
},
"position": "D2",
"times": 1
},
{
"pile": {
"ore": 1
},
"position": "D1",
"times": 1
}
]
}
}
},
"paid": {
"players": [
{
"id": 0,
"resources": {
"food": 1,
"ore": 1,
"culture_tokens": 1
},
"resource_limit": {
"food": 2,
"wood": 7,
"ore": 7,
"ideas": 7,
"gold": 7
},
"cities": [
{
"mood_state": "Neutral",
"activations": 1,
"position": "D2"
}
],
"units": [
{
"position": "D2",
"unit_type": "Settler",
"id": 0
}
],
"civilization": "Maya",
"available_leaders": [
"Pakal",
"SiyajKak",
"WakChanilAjaw"
],
"advances": [
"Arts",
"Farming",
"Mining",
"Sports"
],
"incident_tokens": 1,
"action_cards": [
32
],
"objective_cards": [
12
],
"next_unit_id": 1
},
{
"id": 1,
"resources": {
"food": 2
},
"resource_limit": {
"food": 2,
"wood": 7,
"ore": 7,
"ideas": 7,
"gold": 7
},
"cities": [
{
"mood_state": "Happy",
"position": "D7"
}
],
"units": [
{
"position": "D7",
"unit_type": "Settler",
"id": 0
}
],
"civilization": "Rome",
"available_leaders": [
"Augustus",
"Caesar",
"Sulla"
],
"advances": [
"Farming",
"Mining"
],
"incident_tokens": 3,
"action_cards": [
17
],
"objective_cards": [
2
],
"next_unit_id": 1
},
{
"id": 2,
"civilization": "Barbarians",
"next_unit_id": 0
},
{
"id": 3,
"civilization": "Pirates",
"next_unit_id": 0
}
],
"actions_left": 1,
"rng": "116898312205047725755485059985240998830",
"time_increments": [
2,
2
],
"state": "Playing"
},
"following": {
"players": [
{
"id": 0,
"resources": {
"food": 2,
"ore": 1,
"culture_tokens": 1
},
"resource_limit": {
"food": 2,
"wood": 7,
"ore": 7,
"ideas": 7,
"gold": 7
},
"cities": [
{
"mood_state": "Angry",
"activations": 2,
"position": "D2"
}
],
"units": [
{
"position": "D2",
"unit_type": "Settler",
"id": 0
}
],
"civilization": "Maya",
"available_leaders": [
"Pakal",
"SiyajKak",
"WakChanilAjaw"
],
"advances": [
"Arts",
"Farming",
"Mining",
"Sports"
],
"incident_tokens": 1,
"action_cards": [
32
],
"objective_cards": [
12
],
"next_unit_id": 1
},
{
"id": 1,
"resources": {
"food": 2
},
"resource_limit": {
"food": 2,
"wood": 7,
"ore": 7,
"ideas": 7,
"gold": 7
},
"cities": [
{
"mood_state": "Happy",
"position": "D7"
}
],
"units": [
{
"position": "D7",
"unit_type": "Settler",
"id": 0
}
],
"civilization": "Rome",
"available_leaders": [
"Augustus",
"Caesar",
"Sulla"
],
"advances": [
"Farming",
"Mining"
],
"incident_tokens": 3,
"action_cards": [
17
],
"objective_cards": [
2
],
"next_unit_id": 1
},
{
"id": 2,
"civilization": "Barbarians",
"next_unit_id": 0
},
{
"id": 3,
"civilization": "Pirates",
"next_unit_id": 0
}
],
"actions_left": 0,
"rng": "116898312205047725755485059985240998830",
"time_increments": [
2,
2
],
"state": "Playing"
}
}

View file

@ -0,0 +1,785 @@
{
"seed": "ballcourts-history",
"options": {
"civilization": "ChooseCivilization"
},
"players": [
{
"id": 0,
"civilization": "Maya"
},
{
"id": 1,
"civilization": "Rome"
},
{
"id": 2,
"civilization": "Barbarians"
},
{
"id": 3,
"civilization": "Pirates"
}
],
"log": [
{
"age": 0,
"rounds": [
{
"round": 0,
"turns": [
{
"turn_type": {
"Setup": {
"player": 0
}
},
"actions": [
{
"action": "StartTurn",
"player": 0,
"items": [
{
"player": 0,
"Resources": {
"resources": {
"food": 2
},
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"Advance": {
"advance": "Farming",
"incident_token": "NoChange",
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"Advance": {
"advance": "Mining",
"incident_token": "NoChange",
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"HandCard": {
"card": {
"ActionCard": 32
},
"from": "DrawPile",
"to": {
"Hand": 0
}
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"HandCard": {
"card": {
"ObjectiveCard": 12
},
"from": "DrawPile",
"to": {
"Hand": 0
}
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"Structure": {
"structure": "CityCenter",
"balance": "Gain",
"position": "D2",
"port_position": null
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"MoodChange": {
"city": "D2",
"mood": "Happy"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 0,
"Units": {
"units": {
"settlers": 1
},
"balance": "Gain",
"position": "D2"
},
"origin": {
"Ability": "Setup"
}
}
]
}
]
},
{
"turn_type": {
"Setup": {
"player": 1
}
},
"actions": [
{
"action": "StartTurn",
"player": 1,
"items": [
{
"player": 1,
"Resources": {
"resources": {
"food": 2
},
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"Advance": {
"advance": "Farming",
"incident_token": "NoChange",
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"Advance": {
"advance": "Mining",
"incident_token": "NoChange",
"balance": "Gain"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"HandCard": {
"card": {
"ActionCard": 17
},
"from": "DrawPile",
"to": {
"Hand": 1
}
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"HandCard": {
"card": {
"ObjectiveCard": 2
},
"from": "DrawPile",
"to": {
"Hand": 1
}
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"Structure": {
"structure": "CityCenter",
"balance": "Gain",
"position": "D7",
"port_position": null
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"MoodChange": {
"city": "D7",
"mood": "Happy"
},
"origin": {
"Ability": "Setup"
}
},
{
"player": 1,
"Units": {
"units": {
"settlers": 1
},
"balance": "Gain",
"position": "D7"
},
"origin": {
"Ability": "Setup"
}
}
]
},
{
"action": {
"ChooseCivilization": "Maya"
},
"player": 0
},
{
"action": {
"ChooseCivilization": "Rome"
},
"player": 1
}
]
}
]
}
]
},
{
"age": 1,
"rounds": [
{
"round": 1,
"turns": [
{
"turn_type": {
"Player": 0
},
"actions": [
{
"action": {
"Playing": {
"Advance": {
"advance": "Arts",
"payment": {
"food": 2
}
}
}
},
"player": 0,
"origin": {
"Ability": "Advance"
},
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 2
},
"balance": "Pay"
},
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Text": "unlocks Stelas",
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Resources": {
"resources": {
"culture_tokens": 1
},
"balance": "Gain"
},
"origin": {
"Advance": "Arts"
}
},
{
"player": 0,
"Advance": {
"advance": "Arts",
"incident_token": {
"Take": 2
},
"balance": "Gain"
},
"origin": {
"Ability": "Advance"
}
}
]
},
{
"action": {
"Playing": {
"Collect": {
"city_position": "D2",
"collections": [
{
"position": "D2",
"pile": {
"food": 1
},
"times": 1
}
],
"action_type": "Collect"
}
}
},
"player": 0,
"origin": {
"Ability": "Collect"
},
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 1
},
"balance": "Gain"
},
"origin": {
"Ability": "Collect"
}
}
]
},
{
"action": {
"Playing": {
"Collect": {
"city_position": "D2",
"collections": [
{
"position": "D2",
"pile": {
"food": 1
},
"times": 1
}
],
"action_type": "Collect"
}
}
},
"player": 0,
"origin": {
"Ability": "Collect"
},
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"MoodChange": {
"city": "D2",
"mood": "Neutral"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 1
},
"balance": "Gain"
},
"origin": {
"Ability": "Collect"
}
}
]
},
{
"action": {
"Playing": "EndTurn"
},
"player": 0,
"origin": {
"Ability": "End Turn"
}
}
]
},
{
"turn_type": {
"Player": 1
},
"actions": [
{
"action": {
"Playing": "EndTurn"
},
"player": 1,
"origin": {
"Ability": "End Turn"
},
"items": [
{
"player": 1,
"Action": {
"balance": "Loss",
"amount": 3
},
"origin": {
"Ability": "End Turn"
}
}
]
}
]
}
]
},
{
"round": 2,
"turns": [
{
"turn_type": {
"Player": 0
},
"actions": [
{
"action": {
"Playing": {
"Advance": {
"advance": "Sports",
"payment": {
"food": 2
}
}
}
},
"player": 0,
"origin": {
"Ability": "Advance"
},
"undo": [
{
"op": "replace",
"path": "/actions_left",
"value": 3
},
{
"op": "remove",
"path": "/players/0/advances/3"
},
{
"op": "replace",
"path": "/players/0/incident_tokens",
"value": 2
},
{
"op": "add",
"path": "/players/0/resources/food",
"value": 2
},
{
"op": "remove",
"path": "/players/0/resources/mood_tokens"
}
],
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 2
},
"balance": "Pay"
},
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Text": "unlocks Ballcourts",
"origin": {
"Ability": "Advance"
}
},
{
"player": 0,
"Resources": {
"resources": {
"mood_tokens": 1
},
"balance": "Gain"
},
"origin": {
"Advance": "Sports"
}
},
{
"player": 0,
"Advance": {
"advance": "Sports",
"incident_token": {
"Take": 1
},
"balance": "Gain"
},
"origin": {
"Ability": "Advance"
}
}
]
},
{
"action": {
"Playing": {
"Collect": {
"ballcourts": true,
"city_position": "D2",
"collections": [
{
"position": "D2",
"pile": {
"food": 1
},
"times": 1
},
{
"position": "D1",
"pile": {
"ore": 1
},
"times": 1
}
],
"action_type": "Collect"
}
}
},
"player": 0,
"origin": {
"Ability": "Collect"
},
"undo": [
{
"op": "replace",
"path": "/actions_left",
"value": 2
},
{
"op": "remove",
"path": "/players/0/cities/0/activations"
},
{
"op": "add",
"path": "/players/0/resources/mood_tokens",
"value": 1
},
{
"op": "remove",
"path": "/players/0/resources/food"
},
{
"op": "remove",
"path": "/players/0/resources/ore"
}
],
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"Resources": {
"resources": {
"mood_tokens": 1
},
"balance": "Pay"
},
"origin": {
"SpecialAdvance": "Ballcourts"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 1,
"ore": 1
},
"balance": "Gain"
},
"origin": {
"Ability": "Collect"
}
}
]
},
{
"action": {
"Playing": {
"Collect": {
"city_position": "D2",
"collections": [
{
"position": "D2",
"pile": {
"food": 1
},
"times": 1
}
],
"action_type": "Collect"
}
}
},
"player": 0,
"origin": {
"Ability": "Collect"
},
"undo": [
{
"op": "replace",
"path": "/actions_left",
"value": 1
},
{
"op": "replace",
"path": "/players/0/cities/0/activations",
"value": 1
},
{
"op": "replace",
"path": "/players/0/cities/0/mood_state",
"value": "Neutral"
},
{
"op": "replace",
"path": "/players/0/resources/food",
"value": 1
}
],
"items": [
{
"player": 0,
"Action": {
"balance": "Pay"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"MoodChange": {
"city": "D2",
"mood": "Angry"
},
"origin": {
"Ability": "Collect"
}
},
{
"player": 0,
"Resources": {
"resources": {
"food": 1
},
"balance": "Gain"
},
"origin": {
"Ability": "Collect"
}
}
]
}
]
}
]
}
]
}
],
"log_index": 3,
"time_increments": [
2,
2
]
}

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.228",
"version": "0.1.229",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.228",
"version": "0.1.229",
"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.228",
"version": "0.1.229",
"private": true,
"type": "module",
"scripts": {

View file

@ -1,5 +1,5 @@
{
"revision": 3,
"revision": 4,
"width": 256,
"height": 256,
"assets": [
@ -8,7 +8,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -22,7 +22,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -36,7 +36,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -50,7 +50,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -64,7 +64,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -78,7 +78,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -92,7 +92,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -106,7 +106,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -120,7 +120,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -134,7 +134,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -148,7 +148,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -162,7 +162,35 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
"author": "Clash project contributors",
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
}
}
},
{
"key": "achievement-score-50",
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
"author": "Clash project contributors",
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
}
}
},
{
"key": "achievement-score-60",
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -176,7 +204,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -190,7 +218,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -204,7 +232,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -218,7 +246,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -232,7 +260,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -246,7 +274,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -260,7 +288,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -274,7 +302,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -288,7 +316,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -302,7 +330,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -316,7 +344,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -330,7 +358,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -344,7 +372,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",
@ -358,7 +386,7 @@
"source": {
"type": "original-svg",
"path": "web-client/scripts/nonfaction-art.mjs",
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
"sha256": "5a754c41dd4dfebd42f42820709c52fcc44faa0d3526de5a29ce7f41be0d395b",
"provenance": {
"type": "original-geometry",
"license": "MIT",

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": "07c2267bd5c9441a6d78bc4ec81e4859ea85654bc6e9d27c8e60511ef657ef7e",
"web-client/package-lock.json": "1b5ec545c3405e98d3526979a07316534b43e8ef7946e25cacfab6026c832f0b",
"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.160",
"version": "0.4.161",
"description": "Clash of Cultures: Monumental edition engine for Boardgamers Space",
"license": "MIT",
"type": "commonjs",

View file

@ -0,0 +1,102 @@
// Offline built-viewer + real WASM regression; no production game writes.
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { createRequire } from 'node:module';
import { chromium } from 'playwright';
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
const browser = await chromium.launch({
headless: true,
args: ['--use-gl=angle', '--use-angle=swiftshader'],
});
try {
for (const [width, freeEconomy] of [
[1400, false],
[390, false],
[1400, true],
[390, true],
]) {
let state = JSON.parse(
await readFile(
new URL('../../server/tests/test_games/advances/collect_free_economy.json', import.meta.url),
'utf8',
),
);
const fresh = JSON.parse(await engine.init(2, [], {}, 'ballcourts-browser', {}));
state.players.push(...fresh.players.slice(2));
const player = state.players[0];
player.civilization = 'Maya';
player.advances = [
'Farming',
'Mining',
'Arts',
'Sports',
...(freeEconomy ? ['Voting', 'FreeEconomy'] : []),
];
player.resources = { food: 5, wood: 5, ore: 5, mood_tokens: 0, culture_tokens: 3 };
player.cities[0].mood_state = 'Neutral';
player.cities[1].city_pieces.wonders = ['Colosseum'];
const actions = state.actions_left;
const sent = [],
errors = [];
const page = await browser.newPage({ viewport: { width, height: 900 } });
page.on('pageerror', (e) => errors.push(e.message));
await page.exposeFunction('applyMove', async (action) => {
sent.push(JSON.parse(action));
state = JSON.parse(engine.tryMove(JSON.stringify(state), action, 0));
await page.evaluate((s) => host.emit('state', s), engine.stripSecret(JSON.stringify(state), 0));
});
await page.route('**/*', async (route) => {
const path = new URL(route.request().url()).pathname;
if (path === '/')
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>',
});
if (!['/viewer.js', '/server_bg.wasm'].includes(path)) return route.abort();
return route.fulfill({
contentType: path.endsWith('.wasm') ? 'application/wasm' : 'text/javascript',
body: await readFile(new URL('../dist' + path, import.meta.url)),
});
});
await page.goto('http://clash.test');
await page.evaluate(
(s) => {
window.host = clash3d.launch('#app');
host.on('move', (a) => window.applyMove(a));
host.emit('player', { index: 0 });
host.emit('preferences', { sound: false });
host.emit('state', s);
},
engine.stripSecret(JSON.stringify(state), 0),
);
await page.getByRole('button', { name: 'Collect resources', exact: true }).click();
await page.locator('.ballcourts-toggle input').check();
await page.locator('.collect-map-label').first().click();
if (freeEconomy)
await page
.locator('.variant-picker')
.getByRole('button', { name: /Free Economy/ })
.click();
await page.screenshot({ path: `/tmp/clash-ballcourts-before-${freeEconomy ? 'free-' : ''}${width}.png` });
await page.locator('.collect-submit').click();
if (freeEconomy) await page.getByRole('button', { name: 'Pay 1 culture', exact: true }).click();
await page.waitForFunction(
() => !document.querySelector('.board-collection') && !document.querySelector('.decision-panel'),
);
assert.equal(sent.length, freeEconomy ? 2 : 1, 'Only the pre-existing Free Economy payment response');
if (freeEconomy) assert.deepEqual(sent[1], { Response: { Payment: [{ culture_tokens: 1 }] } });
assert.equal(sent[0].Playing.Collect.ballcourts, true);
assert.equal(state.players[0].resources.culture_tokens, freeEconomy ? 1 : 2);
assert.equal(state.players[0].resources.mood_tokens ?? 0, 0);
assert.equal(state.actions_left, actions - (freeEconomy ? 0 : 1));
assert.equal(state.events?.length ?? 0, 0);
assert.deepEqual(errors, []);
await page.screenshot({ path: `/tmp/clash-ballcourts-after-${freeEconomy ? 'free-' : ''}${width}.png` });
console.log(
`${width}px: ${freeEconomy ? 'Free Economy + ' : ''}Ballcourts paid exactly ${freeEconomy ? 2 : 1} culture, no new decision.`,
);
await page.close();
}
} finally {
await browser.close();
}

View file

@ -15,6 +15,8 @@ export const ids = [
...modes.flatMap((m) => [`complete-${m}`, `win-${m}`]),
'score-30',
'score-40',
'score-50',
'score-60',
'seven-cities',
'twenty-advances',
'three-objectives',
@ -182,13 +184,14 @@ function motif(id) {
path('M69 177V69H172 M69 89L89 69 M149 69V94 M135 94H163V109H135Z M54 181H87') +
group(129, 194, 0.65, check())
);
const high = id === 'score-40';
const score = id.slice('score-'.length);
const high = score !== '30';
return (
group(high ? 91 : 89, 132, high ? 1.3 : 1.1, city()) +
group(high ? 165 : 162, 127, high ? 0.55 : 0.45, monument(high ? 'library' : 'pyramids')) +
group(128, 166, 0.65, book()) +
(high ? path('M59 87H197 M68 80V94 M188 80V94') : '') +
`<text x="128" y="211" text-anchor="middle" stroke="none" fill="#f7cc6c" font-family="sans-serif" font-weight="bold" font-size="29">${high ? '40' : '30'}</text>`
`<text x="128" y="211" text-anchor="middle" stroke="none" fill="#f7cc6c" font-family="sans-serif" font-weight="bold" font-size="29">${score}</text>`
);
}
export function svg(id) {

View file

@ -8,12 +8,12 @@ export const outputDir = path.join(root, 'web-client/.engine/achievement-assets-
export const manifestPath = path.join(root, 'web-client/release/achievement-assets-nonfaction.json');
export async function validateInputs() {
const manifest = JSON.parse(await readFile(manifestPath));
assert.equal(manifest.revision, 3);
assert.equal(manifest.revision, 4);
assert.deepEqual(
manifest.assets.map((a) => a.key),
ids.map((id) => `achievement-${id}`),
);
assert.equal(manifest.assets.length, 26);
assert.equal(manifest.assets.length, 28);
for (const a of manifest.assets) {
assert.equal(a.source.type, 'original-svg');
assert.equal(a.source.path, 'web-client/scripts/nonfaction-art.mjs');
@ -24,13 +24,13 @@ export async function validateInputs() {
export async function validateOutputs() {
const manifest = await validateInputs();
const receipt = JSON.parse(await readFile(path.join(outputDir, 'receipt.json')));
assert.equal(receipt.revision, 3);
assert.equal(receipt.revision, 4);
assert.equal(receipt.manifestSha256, sha256(await readFile(manifestPath)));
assert.deepEqual(
receipt.assets.map((a) => a.key),
manifest.assets.map((a) => a.key),
);
assert.equal(new Set(receipt.assets.map((a) => a.sha256)).size, 26);
assert.equal(new Set(receipt.assets.map((a) => a.sha256)).size, 28);
for (const a of receipt.assets) {
assert.equal(a.file, `${a.key}.png`);
const b = await readFile(path.join(outputDir, a.file));
@ -54,7 +54,7 @@ export async function build() {
},
};
const manifest = {
revision: 3,
revision: 4,
width: 256,
height: 256,
assets: ids.map((id) => ({ key: `achievement-${id}`, source })),
@ -85,7 +85,7 @@ export async function build() {
assets.push({ key, file: `${key}.png`, sha256: sha256(bytes), width: 256, height: 256 });
}
const receipt = {
revision: 3,
revision: 4,
manifestSha256: sha256(await readFile(manifestPath)),
renderer: browser.version(),
assets,
@ -97,7 +97,7 @@ export async function build() {
`<figure><figcaption>${id}</figcaption>${[32, 48, 64].map((size) => `<img width="${size}" height="${size}" src="data:image/svg+xml;base64,${Buffer.from(svg(id)).toString('base64')}">`).join('')}</figure>`,
)
.join('');
const html = `<!doctype html><title>Clash 26 original achievements</title><style>body{font:13px sans-serif}section{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:16px}figure{margin:0;padding:10px}img{margin:5px;border-radius:50%}.dark{background:#101722;color:white}</style><h1>Clash — 32 / 48 / 64px circular review</h1><section>${cards}</section><section class="dark">${cards}</section>`;
const html = `<!doctype html><title>Clash 28 original achievements</title><style>body{font:13px sans-serif}section{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:16px}figure{margin:0;padding:10px}img{margin:5px;border-radius:50%}.dark{background:#101722;color:white}</style><h1>Clash — 32 / 48 / 64px circular review</h1><section>${cards}</section><section class="dark">${cards}</section>`;
await writeFile(path.join(outputDir, 'contact-sheet.html'), html);
await page.setViewportSize({ width: 1100, height: 900 });
await page.setContent(html);

View file

@ -7,12 +7,12 @@ import { createRequire } from 'node:module';
import { createHash } from 'node:crypto';
import { chromium } from 'playwright';
import { inspectEngine } from '@boardgamers/protocol/engine';
import { ids } from './nonfaction-art.mjs';
import { ids, svg } from './nonfaction-art.mjs';
import { validateOutputs, outputDir } from './nonfaction-assets.mjs';
import { root } from './achievement-asset-inputs.mjs';
// Last delivered release: revision 5, 45 definitions.
const baseline = 'ba8ee4e2';
test('existing evaluation and assets are unchanged apart from score-50 and deliberate tier ordering', async () => {
test('existing evaluation and faction assets are unchanged apart from score-50 and tier ordering', async () => {
const file = 'server/src/achievements.rs';
const old = execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' });
const current = await readFile(path.join(root, file), 'utf8');
@ -58,7 +58,6 @@ test('existing evaluation and assets are unchanged apart from score-50 and delib
previousArtwork.integrity[lockfile] = currentArtwork.integrity[lockfile];
assert.deepEqual(currentArtwork, previousArtwork);
for (const file of [
'web-client/release/achievement-assets-nonfaction.json',
'web-client/scripts/publish-achievement-assets.mjs',
'web-client/scripts/achievement-asset-inputs.mjs',
])
@ -67,13 +66,13 @@ test('existing evaluation and assets are unchanged apart from score-50 and delib
execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' }),
);
});
test('generated engine schema, 46 definitions sharing 41 existing assets', async () => {
test('generated engine schema, 46 definitions using 43 assets', async () => {
// Test current local WASM, not a stale published archive; an explicit packed
// engine can still be supplied during a future release verification.
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
assert.ok(inspectEngine(engine).compatible);
const m = engine.achievementDefinitions();
assert.equal(m.revision, 7);
assert.equal(m.revision, 8);
assert.equal(m.achievements.length, 46);
const baselineManifest = JSON.parse(
await readFile(path.join(root, 'web-client/src/fixtures/achievements-revision-5.json'), 'utf8'),
@ -114,11 +113,13 @@ test('generated engine schema, 46 definitions sharing 41 existing assets', async
id,
name: '50 Points',
description: 'Finish a game with at least 50 victory points in the final state.',
icon: { type: 'asset', key: 'achievement-score-40' },
icon: { type: 'asset', key: 'achievement-score-50' },
}
: wonderNames.has(id)
? { ...previous.get(id), name: wonderNames.get(id) }
: previous.get(id),
: id === 'score-60'
? { ...previous.get(id), icon: { type: 'asset', key: 'achievement-score-60' } }
: wonderNames.has(id)
? { ...previous.get(id), name: wonderNames.get(id) }
: previous.get(id),
),
);
const factions = JSON.parse(
@ -126,8 +127,6 @@ test('generated engine schema, 46 definitions sharing 41 existing assets', async
).assets;
const reused = {
'five-objectives': 'three-objectives',
'score-50': 'score-40',
'score-60': 'score-40',
'seven-objectives': 'three-objectives',
'thirty-advances': 'twenty-advances',
};
@ -148,7 +147,7 @@ test('generated engine schema, 46 definitions sharing 41 existing assets', async
assert.deepEqual(engine.achievements(raw), []);
assert.deepEqual(engine.timeIncrements(raw), [0, 0]);
});
test('all 26 unique outputs decode, dimensions and hashes match', async () => {
test('all 28 unique outputs decode, dimensions and hashes match', async () => {
const r = await validateOutputs();
const browser = await chromium.launch({ headless: true });
try {
@ -169,3 +168,22 @@ test('all 26 unique outputs decode, dimensions and hashes match', async () => {
await browser.close();
}
});
test('score pictograms render their exact numerals and preserve every existing SVG', async () => {
for (const score of [30, 40, 50, 60]) {
const vector = svg(`score-${score}`);
assert.deepEqual(
[...vector.matchAll(/<text\b[^>]*>([^<]*)<\/text>/g)].map((m) => m[1]),
[String(score)],
);
}
const previousSource = execFileSync('git', ['show', `${baseline}:web-client/scripts/nonfaction-art.mjs`], {
cwd: root,
encoding: 'utf8',
});
const previous = await import(
`data:text/javascript;base64,${Buffer.from(previousSource).toString('base64')}`
);
for (const id of previous.ids) assert.equal(svg(id), previous.svg(id), `${id} must remain unchanged`);
assert.equal(new Set([40, 50, 60].map((score) => svg(`score-${score}`))).size, 3);
});

View file

@ -22,7 +22,7 @@ const finish = () => engine.tryMove(fixture, JSON.stringify({ Playing: 'EndTurn'
test('WASM achievement catalog follows official protocol 0.11.0', () => {
const manifest = achievementManifestSchema.parse(hooks.achievementDefinitions());
assert.equal(manifest.revision, 7);
assert.equal(manifest.revision, 8);
assert.equal(manifest.achievements.length, 46);
assert.deepEqual(
manifest.achievements.slice(10, 22).map((a) => a.id),
@ -47,7 +47,7 @@ test('WASM achievement catalog follows official protocol 0.11.0', () => {
id: 'score-50',
name: '50 Points',
description: 'Finish a game with at least 50 victory points in the final state.',
icon: { type: 'asset', key: 'achievement-score-40' },
icon: { type: 'asset', key: 'achievement-score-50' },
},
);
assert.ok(!manifest.achievements.some((a) => a.id === 'four-cities'));
@ -63,7 +63,7 @@ test('WASM achievement catalog follows official protocol 0.11.0', () => {
const nonfactionArt = JSON.parse(
readFileSync(new URL('../release/achievement-assets-nonfaction.json', import.meta.url), 'utf8'),
);
assert.equal(nonfactionArt.revision, 3, 'revision 7 reuses the existing objective artwork');
assert.equal(nonfactionArt.revision, 4, 'revision 8 adds dedicated score artwork');
assert.equal(art.revision, 2, 'revision 7 preserves the existing faction artwork');
assert.deepEqual(
[
@ -81,7 +81,7 @@ test('WASM achievement catalog follows official protocol 0.11.0', () => {
}
});
test('revision 7 permits only eight wonder renames alongside revision 6 additions and order', () => {
test('catalog preserves previous definitions except wonder names, score artwork and revision 6 additions/order', () => {
// Captured from the generated ba8ee4e2 / engine 0.4.157 catalog before rebuilding.
const previous: AchievementManifest = JSON.parse(
readFileSync(new URL('./fixtures/achievements-revision-5.json', import.meta.url), 'utf8'),
@ -123,11 +123,13 @@ test('revision 7 permits only eight wonder renames alongside revision 6 addition
id,
name: '50 Points',
description: 'Finish a game with at least 50 victory points in the final state.',
icon: { type: 'asset', key: 'achievement-score-40' },
icon: { type: 'asset', key: 'achievement-score-50' },
}
: wonderNames.has(id)
? { ...previousById.get(id), name: wonderNames.get(id) }
: previousById.get(id),
: id === 'score-60'
? { ...previousById.get(id), icon: { type: 'asset', key: 'achievement-score-60' } }
: wonderNames.has(id)
? { ...previousById.get(id), name: wonderNames.get(id) }
: previousById.get(id),
),
);
});
@ -458,7 +460,7 @@ test('revision 5 milestones use inclusive canonical totals and unchanged eligibi
'score-60',
'60 Points',
'Finish a game with at least 60 victory points in the final state.',
'score-40',
'score-60',
],
[
'seven-objectives',

View file

@ -0,0 +1,44 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
const fixture = readFileSync(
new URL('../../server/tests/fixtures/legacy_ballcourts_history.json', import.meta.url),
'utf8',
);
const expected = JSON.parse(
readFileSync(
new URL('../../server/tests/fixtures/legacy_ballcourts_history.expected.json', import.meta.url),
'utf8',
),
);
const move = (raw: string, action: unknown) => engine.tryMove(raw, JSON.stringify(action), 0);
function matches(raw: string, projection: any) {
const data = JSON.parse(raw);
assert.equal(data.events?.length ?? 0, 0, 'no newly introduced payment decision');
for (const [key, value] of Object.entries(projection)) assert.deepEqual(data[key], value, key);
}
test('0.4.160 Ballcourts history replays immediate mood payment and the following action', () => {
matches(engine.replay(fixture, { to: expected.afterPayment }), expected.paid);
matches(engine.replay(fixture, {}), expected.following);
assert.equal(engine.logLength(engine.replay(fixture, {})), expected.full);
});
test('partial history branches retain the immediate Ballcourts action and replay identically', () => {
const before = engine.replay(fixture, { to: expected.before });
const branch = move(before, expected.bonus);
matches(branch, expected.paid);
matches(engine.replay(branch, {}), expected.paid);
});
test('old Ballcourts and following action undo/redo without extra payment responses', () => {
const full = engine.replay(fixture, {});
const paid = move(full, 'Undo');
matches(paid, expected.paid);
matches(move(paid, 'Redo'), expected.following);
const before = move(paid, 'Undo');
matches(move(before, 'Redo'), expected.paid);
const branch = move(before, expected.bonus);
matches(branch, expected.paid);
matches(move(move(branch, 'Undo'), 'Redo'), expected.paid);
matches(engine.replay(branch, {}), expected.paid);
});

View file

@ -6,7 +6,7 @@ import { pendingActionCard } from './card-reference.ts';
import { frameDetails } from './playback.ts';
import { journal } from './journal.ts';
import { manGodAbility } from './research-links.ts';
const engine = createRequire(import.meta.url)('../.engine/server.js');
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
const serialize = (g: any) => (typeof g === 'string' ? g : JSON.stringify(g));
const seat = (g: any) => engine.currentPlayer(serialize(g));
const view = (g: any, p = seat(g)): any => JSON.parse(engine.webView(engine.stripSecret(serialize(g), p), p));
@ -1948,3 +1948,48 @@ test('Explorers requires at least one available benefit and preserves ordinary c
}
}
});
test('Great Arena pays Ballcourts with culture for both collection and recruitment', async () => {
for (const recruit of [false, true]) {
const g = await setup('Maya'),
p = g.players[seat(g)],
city = p.cities[0];
addAdvance(p, 'Arts', 'Sports');
city.mood_state = 'Neutral';
city.city_pieces = { wonders: ['Colosseum'] };
p.resources.mood_tokens = 0;
p.resources.culture_tokens = 3;
p.resources.food = 3;
p.resources.wood = 3;
p.resources.ore = 3;
const choices = view(g).cities[0].choices;
const selections = [choices[0], choices.find((c: any) => c.position !== choices[0].position)].map(
(c: any) => ({ position: c.position, pile: c.pile, times: 1 }),
);
const params = recruit
? { kind: 'recruit', city: city.position, units: { infantry: 2 }, replaced: [], ballcourts: true }
: { kind: 'collect', city: city.position, selections, variant: 'Collect', ballcourts: true };
const offer = query(g, params);
let after = move(g, offer.action);
const next = after.players[seat(g)];
assert.equal(next.resources.mood_tokens ?? 0, 0);
assert.equal(next.resources.culture_tokens, 2);
assert.equal(after.actions_left, g.actions_left - 1);
assert.equal(next.cities[0].activations, 1);
if (recruit) {
assert.equal(next.units.length, p.units.length + 2);
assert.equal(next.resources.food, 1);
assert.equal(next.resources.ore, 1);
} else {
for (const resource of ['food', 'wood', 'ore'])
assert.equal(next.resources[resource], p.resources[resource] + (offer.total[resource] ?? 0));
}
city.city_pieces.wonders = [];
assert.throws(() => query(g, params));
assert.throws(() => move(g, offer.action));
city.city_pieces.wonders = ['Colosseum'];
p.resources.culture_tokens = 0;
assert.throws(() => query(g, params));
assert.throws(() => move(g, offer.action));
}
});