Fix Conversion reclaim bonus and Splendid Year food reward

This commit is contained in:
coyotte508 2026-10-14 18:42:22 +02:00
commit 242312e2ff
8 changed files with 52 additions and 12 deletions

View file

@ -1336,7 +1336,8 @@
"english_face": "verified",
"review": "pending-complete-source-audit",
"printed_name": "A Splendid Year",
"source": "english-event-deck-1"
"source": "english-event-deck-1",
"verified_reward": "Printed E17: You gain 3 food (checked 2026-10-14)."
},
{
"id": 27,

View file

@ -120,7 +120,7 @@ fn fantastic_years() -> Vec<Incident> {
"You gain 3 food",
IncidentBaseEffect::BarbariansSpawn,
),
2,
3,
&GoodYearType::ActivePlayer,
),
]

View file

@ -101,7 +101,7 @@ impl InfluenceCultureAttemptInfo {
#[must_use]
pub(crate) fn is_defender(&self, player: usize) -> bool {
self.target_player == player
self.target_player == player && self.info.player != player
}
}
@ -451,12 +451,15 @@ pub fn influence_culture_boost_cost_from(
info = Ok(info?);
game.player(target_player_index).trigger_event(
|e| &e.on_influence_culture_attempt,
&mut info,
target_city,
game,
);
// Reclaiming targets our own city: apply our attempt listeners only once.
if target_player_index != attacker.index {
game.player(target_player_index).trigger_event(
|e| &e.on_influence_culture_attempt,
&mut info,
target_city,
game,
);
}
let i = info?;
if i.prevent_boost && range_boost > 0 {

View file

@ -783,3 +783,23 @@ fn anarchy_explains_lost_man_god_abilities() {
assert!(!log.contains("Losing Devotion"));
assert!(!game.player(0).can_use_advance(Advance::AbsolutePower));
}
#[test]
fn splendid_year_17_grants_three_food_to_active_player() {
let mut game = JSON.load_game("barbarians_spawn");
game.incidents_left = vec![17];
let before = game.player(0).resources.food;
let other = game.player(1).resources.food;
let game = server::game_api::execute(
game,
Action::Response(EventResponse::SelectAdvance(Advance::Storage)),
0,
);
let game = server::game_api::execute(
game,
Action::Response(EventResponse::SelectUnitType(UnitType::Elephant)),
0,
);
assert_eq!(game.player(0).resources.food, before + 3);
assert_eq!(game.player(1).resources.food, other);
}

View file

@ -343,3 +343,5 @@ Viewer 0.1.111 replaces influence payment action text with a numeric action cost
Viewer 0.1.112 adds Hand, Discarded actions and Discarded events tabs to Cards. Discards show engine pile order with the top card first, counts and expandable full rules including battle uses. Verified both piles in the local saved-game preview; Svelte and production build pass. Engine remains 0.4.81.
Viewer 0.1.113 / engine 0.4.82 fixes embarked naval defenders rolling dice and being eligible as direct combat casualties. Sea battles now admit only ships as fighters; excess passengers still resolve separately after ship losses. Verified against the reported Joyful-kraken-3479 battle and all 20 combat integration tests, including ship-only dice and remaining transport capacity.
Viewer 0.1.114 / engine 0.4.83 corrects E17 (A Splendid Year) to grant its stated 3 food instead of 2. Printed English card E17 confirms the 3-food reward. Also fixes Conversion when reclaiming an influenced building: the acting player is not treated as their own defender, and attempt listeners run once. Regression coverage checks the food reward and reclaim roll bonus.

View file

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

View file

@ -204,3 +204,17 @@ test('reclaiming influence allows another city and boosting, but self-targeting
const restricted = view(g).influence!.find((t) => t.position === 'C1' && t.name === 'Temple')!;
assert.ok(!restricted.origins!.some((o) => o.position === 'A1'), 'an influenced source cannot target another city');
});
test('Conversion adds exactly one to reclaim rolls and lowers the boost cost', () => {
const g = influenceFixture();
g.players[0].cities.push(g.players[1].cities.shift());
g.players[0].advances.push('Conversion');
const target = view(g).influence!.find(t => t.position === 'C1' && t.name === 'Temple')!;
const origin = target.origins!.find(o => o.position === 'A1')!;
assert.equal(origin.rollBonus, 1);
let state = move(g, origin.action);
if (view(state).influenceContext?.stage === 'range') state = move(state, { Response: { Payment: [origin.payment] } });
const context = view(state).influenceContext!;
assert.equal(context.rollBonus, 1);
assert.equal(view(state).decision!.fields[0].cost.culture_tokens, 3, 'raw 1 plus Conversion 1 needs three more');
});