Require an eligible leader city for Tributes collection availability

This commit is contained in:
coyotte508 2026-10-24 10:11:39 +02:00
commit 92d68f83b2
5 changed files with 48 additions and 3 deletions

View file

@ -459,6 +459,20 @@ pub fn available_collect_actions_for_city(
#[must_use]
pub fn available_collect_actions(game: &Game, player: usize) -> Vec<PlayingActionType> {
base_or_modified_available(game, player, &PlayingActionType::Collect)
.into_iter()
.filter(|action| {
*action
!= crate::content::custom_actions::PlayingActionModifier::Tributes
.playing_action_type()
|| game.player(player).cities.iter().any(|city| {
city.can_activate()
&& crate::content::civilizations::aztecs::tributes_city(
game.player(player),
city.position,
)
})
})
.collect()
}
pub(crate) fn collect_event_origin(

View file

@ -480,3 +480,10 @@ against the same follow-up state. This includes Great Engineer through Alexander
and Shogunate at zero actions. Verified both abilities, advance-only and construction
paths, frontend/engine tests, locales, type checking and production build.
Rules reference: https://wizkids.com/posters/repository/wizkids/Clash-of-Cultures---Rulebook---WEB---2021-02-05-compressed.pdf (p. 34).
### 0.1.165 / engine 0.4.112 — Tributes collection availability
Acamapichtli's Tributes only enables collection when he occupies an owned city
of size 3 or less that can still activate. At zero actions, being outside a city
no longer enables the Collect button. Verified eligible, oversized and exhausted
cities, normal paid collection, all 856 tests, locales, type checking and build.

View file

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

View file

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

View file

@ -44,6 +44,30 @@ async function fixture(name: string, civ: string, leader?: string) {
return g;
}
test('Tributes only enables collection with an eligible city containing Acamapichtli', async () => {
const g = await setup('Aztecs', 'Acamapichtli');
const p = g.players[seat(g)], city = p.cities[0];
const leader = p.units.find((u: any) => u.unit_type?.Leader === 'Acamapichtli');
g.actions_left = 0;
const offers = () => view(g).collectActions;
assert.ok(offers().some((a: any) => a.name === 'Tributes'));
leader.position = g.map.tiles.find(([pos]: [string]) => !p.cities.some((c: any) => c.position === pos))[0];
assert.deepEqual(offers(), []);
assert.ok(view(g).cities.every((c: any) => c.reason), 'no city should enable the Collect toolbar button');
g.actions_left = 1;
assert.ok(offers().some((a: any) => a.value === 'Collect'));
assert.ok(!offers().some((a: any) => a.name === 'Tributes'));
g.actions_left = 0;
leader.position = city.position;
city.city_pieces = { academy: seat(g), fortress: seat(g), temple: seat(g) };
assert.deepEqual(offers(), []);
city.city_pieces = {};
city.angry_activation = true;
assert.deepEqual(offers(), []);
city.angry_activation = false;
assert.ok(offers().some((a: any) => a.name === 'Tributes'));
});
test('Egypt and Phoenicia offer four advances and three leaders', async () => {
const g = await engine.init(2, [], { civilization: 'ChooseCivilization' }, 'remaining-picker', {});
for (const name of ['Egypt', 'Phoenicia']) {