Resolve pirate round rewards in combat estimates
This commit is contained in:
parent
0fc1a56de7
commit
a36df40af3
5 changed files with 29 additions and 3 deletions
|
|
@ -136,6 +136,11 @@ pub(super) fn estimate(game: &Game, seat: usize, input: &Value) -> Result<Value,
|
|||
}
|
||||
EventResponse::Payment(payments)
|
||||
}
|
||||
Request::ResourceReward(r) if name == "Pirate ship destroyed" => {
|
||||
// This round reward is fixed gold, including an empty reward
|
||||
// when no pirate was hit. Resolve it before the next round.
|
||||
EventResponse::ResourceReward(r.reward.payment_options.default_payment())
|
||||
}
|
||||
Request::SelectHandCards(r) if *r.needed.start() == 0 => {
|
||||
EventResponse::SelectHandCards(vec![])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,3 +433,5 @@ Viewer 0.1.154 keeps an additional collection tile visibly selected when it exce
|
|||
Viewer 0.1.155 / engine 0.4.106 measures effect ranges along revealed spaces, never through unexplored regions or off-board gaps. This fixes Tech Exchange/Inspiration, Mercenaries, civilization and leader proximity abilities, and distance-based objectives, Provinces and Knut scoring. Revealed detours count normally; disconnected positions do not supply a measurable distance. Trade routes, cultural influence, Husbandry and movement retain their existing path-specific restrictions. Existing recorded results are not rewritten.
|
||||
|
||||
Rule source: the official Monumental Edition rulebook, page 36, “Spaces”: https://wizkids.com/posters/repository/wizkids/Clash-of-Cultures---Rulebook---WEB---2021-02-05-compressed.pdf. Verified with 850 frontend/engine tests, 55 targeted Rust tests, locale validation, type checking and production build. Regression cases cover blocked paths, longer revealed detours, sea paths, off-board gaps, Tribute Empire and Colony. Synthetic range fixtures now place their contacts and connecting paths on revealed board spaces.
|
||||
|
||||
Viewer 0.1.156 / engine 0.4.107 lets combat estimates resolve the fixed “Pirate ship destroyed” gold reward between rounds, including zero-gold rewards. Estimates now continue from attack confirmation and tactics selection against pirates. Live game state and post-combat reward choices remain unchanged. Verified with 851 frontend/engine tests, deterministic non-mutation and tactics-step regression coverage, locale validation, type checking and production build.
|
||||
|
|
|
|||
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.155",
|
||||
"version": "0.1.156",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.155",
|
||||
"version": "0.1.156",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.155",
|
||||
"version": "0.1.156",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -134,3 +134,22 @@ test('unaffordable Siegecraft is unavailable, never presented as a free cancella
|
|||
assert.equal(estimate(raw, action).samples, 64);
|
||||
assert.throws(() => estimate(raw, action, { siege: 3 }), /Cannot afford/);
|
||||
});
|
||||
|
||||
test('pirate battle estimates resolve round rewards, including zero gold, without changing the game', () => {
|
||||
const game = JSON.parse(fixture('ship_combat'));
|
||||
game.players[2].units = game.players[1].units;
|
||||
game.players[1].units = [];
|
||||
game.players[0].action_cards = [6];
|
||||
const raw = JSON.stringify(game);
|
||||
const action = attack(raw, [7, 8], 'D2');
|
||||
const before = engine.tryMove(raw, JSON.stringify(action), 0);
|
||||
// This batch includes no-hit rounds that previously failed on the empty reward.
|
||||
const result = estimate(raw, action);
|
||||
assert.equal(result.wins + result.draws + result.losses, 64);
|
||||
assert.deepEqual(estimate(raw, action), result);
|
||||
assert.equal(engine.tryMove(raw, JSON.stringify(action), 0), before);
|
||||
const view = JSON.parse(engine.webView(before, 0));
|
||||
assert.equal(view.decision.name, 'Tactics');
|
||||
const fromTactics = estimate(before, { Response: { SelectHandCards: [] } });
|
||||
assert.equal(fromTactics.wins + fromTactics.draws + fromTactics.losses, 64);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue