Allow reclaiming cultural influence from another city
This commit is contained in:
parent
ce72d9f5b4
commit
afca642e40
6 changed files with 43 additions and 8 deletions
|
|
@ -637,10 +637,11 @@ fn affordable_start_position(
|
|||
add_action_cost: bool,
|
||||
selected: Option<Position>,
|
||||
) -> Result<(Position, u8), String> {
|
||||
if target_city.player_index == player_index {
|
||||
if selected.is_some_and(|p| p != target_city.position) {
|
||||
return Err("Reclaim buildings from their own city".into());
|
||||
}
|
||||
// Preserve self-targeting as the default, but allow another eligible origin
|
||||
// to reclaim an influenced building using normal range and roll boosts.
|
||||
if target_city.player_index == player_index
|
||||
&& selected.is_none_or(|p| p == target_city.position)
|
||||
{
|
||||
Ok((target_city.position, 0))
|
||||
} else {
|
||||
let player = game.player(player_index);
|
||||
|
|
|
|||
|
|
@ -325,3 +325,5 @@ Viewer 0.1.102 / engine 0.4.79 labels Spies hand choices by current owner, inclu
|
|||
Viewer 0.1.103 fixes journal “Action card · Card 0” entries. Redacted card-removal records now use the same actor's public Playing ActionCard ID for the name and exact-card link. Genuinely hidden discards stay generic. Verified the reported game's history for all three seats and regression coverage for redacted plays versus hidden discards. Engine remains 0.4.79.
|
||||
|
||||
Viewer 0.1.104 removes the duplicate Cultural Influence entry from Abilities and keeps its dedicated action-bar button. Abilities availability now depends only on abilities, and the influence tutorial targets the dedicated button. Checked Svelte and desktop/mobile influence selection flows. Engine remains 0.4.79.
|
||||
|
||||
Viewer 0.1.105 / engine 0.4.80 allows reclaiming influenced buildings from another eligible city with normal range and roll boosts. Self-targeted attempts remain unboostable and now say so in the payment preview. Regression coverage verifies remote reclaim and boosting, self-target failure without spending, and rejection of another influenced source.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.104",
|
||||
"version": "0.1.105",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.104",
|
||||
"version": "0.1.105",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.104",
|
||||
"version": "0.1.105",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,9 @@
|
|||
</div>
|
||||
<p class="movement-hint">
|
||||
Roll {Math.max(1, 5 - bonus)}+{#if bonus}
|
||||
(+{bonus} bonus){/if} to succeed. {preventBoost
|
||||
(+{bonus} bonus){/if} to succeed. {origin?.position === target?.position
|
||||
? 'A city targeting itself cannot spend culture to boost the roll.'
|
||||
: preventBoost
|
||||
? 'This target prevents spending culture to boost range or the roll.'
|
||||
: 'After rolling, you can choose whether to spend culture to reach 5.'}{#if origin?.reroll}
|
||||
Buddhism offers one optional reroll.{/if}
|
||||
|
|
|
|||
|
|
@ -167,3 +167,33 @@ test('destination selection defers Arts versus regular influence and defaults to
|
|||
assert.equal(activeInfluence(state)?.source, 'B1');
|
||||
assert.equal(activeInfluence({ ...state, influenceOrigin: 'A1' })?.source, 'A1');
|
||||
});
|
||||
|
||||
|
||||
test('reclaiming influence allows another city and boosting, but self-targeting cannot boost', () => {
|
||||
const g = influenceFixture();
|
||||
const reclaimedCity = g.players[1].cities.shift();
|
||||
g.players[0].cities.push(reclaimedCity);
|
||||
const target = view(g).influence!.find((t) => t.position === 'C1' && t.name === 'Temple')!;
|
||||
const other = target.origins!.find((o) => o.position === 'A1');
|
||||
const self = target.origins!.find((o) => o.position === 'C1');
|
||||
assert.ok(other, 'another uninfluenced city is an available source');
|
||||
assert.ok(self, 'the influenced city can still target itself');
|
||||
let state = move(g, other.action);
|
||||
if (view(state).influenceContext?.stage === 'range')
|
||||
state = move(state, { Response: { Payment: [other.payment] } });
|
||||
assert.equal(view(state).influenceContext?.stage, 'boost');
|
||||
const cost = view(state).decision!.fields[0].cost;
|
||||
state = move(state, { Response: { Payment: [cost] } });
|
||||
assert.equal(state.players[0].cities.find((c: any) => c.position === 'C1').city_pieces.temple, 0);
|
||||
assert.ok(state.successful_cultural_influence);
|
||||
|
||||
const failed = move(g, self.action);
|
||||
assert.equal(view(failed).influenceContext, null);
|
||||
assert.ok(!failed.successful_cultural_influence);
|
||||
assert.equal(failed.players[0].cities.find((c: any) => c.position === 'C1').city_pieces.temple, 1);
|
||||
assert.equal(failed.players[0].resources.culture_tokens, g.players[0].resources.culture_tokens);
|
||||
|
||||
g.players[0].cities[0].city_pieces = { academy: 1 };
|
||||
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');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue