Keep Earthquake eligibility summaries scoped to its target

This commit is contained in:
coyotte508 2026-10-13 01:34:54 +02:00
commit fa1624cd79
5 changed files with 25 additions and 4 deletions

View file

@ -101,7 +101,7 @@ fn earthquake(id: u8, name: &str, target: IncidentTarget) -> Incident {
},
)
.add_decrease_mood(
IncidentTarget::AllPlayers,
target,
MoodModifier::Decrease,
move |_p, _game, i| {
let c = &i.player.must_reduce_mood;

View file

@ -295,3 +295,5 @@ Viewer 0.1.87 / engine 0.4.72 ends a game immediately when dropping leaves only
Viewer 0.1.88 / engine 0.4.73 restores ship exploration beside any reachable sea space, including the destination sea area after Navigation. Unrevealed tiles remain endpoints, and enemy ships still block traversal. Verified against a local copy of ClashoftheTitans; no live move was submitted.
Viewer 0.1.89 adds Influence to the main action bar. Its map flow chooses a destination and specific building first, preselects the cheapest eligible source, then explicitly presents Arts/Influence Culture and their upfront costs before rolling. A single available method still requires confirmation. Desktop, mobile and Strategy browser checks cover building selection, method changes, and no submission before confirmation. Engine remains 0.4.73.
Viewer 0.1.90 / engine 0.4.74 fixes Earthquake's reported target scope: its mood continuation uses the same target as its destruction step. Ordinary Earthquake is shown as affecting only its triggering player; Heavy Earthquake still affects all players. Journal eligibility explanations no longer list unrelated civilizations for ordinary Earthquake.

View file

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

View file

@ -33,6 +33,12 @@ test('events expose engine rules and protections to spectators without revealing
assert.equal(view(state).objectiveCards.length, 0);
});
test('Earthquake targets only its triggering player; Heavy Earthquake targets everyone', () => {
const catalog = view(fixture('earthquake/earthquake')).eventCatalog!;
assert.deepEqual(catalog.find(e => e.id === 30)!.targets, ['active']);
assert.deepEqual(catalog.find(e => e.id === 31)!.targets, ['all']);
});
test('Fire keeps its own title and forest rules while explaining and recording its gold and wood effects', () => {
const raw = JSON.parse(fixture('pandemics/fire'));
const cityPositions = new Set(raw.players[0].cities.map((c: { position: string }) => c.position));
@ -432,3 +438,16 @@ test('automatic exploration explains why the block rotation was forced', () => {
/Rotation forced: the revealed water must connect to existing water/,
);
});
test('Earthquake never labels a non-target player as below its city threshold', () => {
const catalog = view(fixture('earthquake/earthquake')).eventCatalog!;
const earthquake = catalog.find(e => e.id === 30)!;
const game = history([{ log: ['A new game event has been triggered: Earthquake'] }]);
game.players[0].cities = [{ position: 'D2', mood_state: 'Happy' }];
game.players.push({ id: 1, civilization: 'Carthage', advances: [], cities: [{ position: 'E2', mood_state: 'Happy' }] } as Game['players'][number]);
const v = publicView([earthquake]);
v.players.push({ index: 1, civilizationAdvances: [] } as unknown as View['players'][number]);
const event = journal(game, v)[0].event!;
assert.deepEqual(event.explanations.map(e => e.player), [0]);
assert.match(event.explanations[0].text, /requires 3/);
});