Apply captive token conversions to wonder construction costs
This commit is contained in:
parent
3c0c754905
commit
bd5d83c988
6 changed files with 44 additions and 5 deletions
|
|
@ -211,7 +211,7 @@ impl PaymentOptions {
|
|||
.add_extra_options(player, origin)
|
||||
}
|
||||
|
||||
fn add_extra_options(mut self, player: &Player, _origin: EventOrigin) -> Self {
|
||||
pub(crate) fn add_extra_options(mut self, player: &Player, _origin: EventOrigin) -> Self {
|
||||
let mut extra_conversions = Vec::new();
|
||||
player.trigger_event(
|
||||
|events| &events.general_payment_conversions,
|
||||
|
|
|
|||
|
|
@ -660,5 +660,11 @@ pub(crate) fn use_draw_replacement_wonder() -> Ability {
|
|||
}
|
||||
|
||||
pub(crate) fn wonder_cost(game: &Game, player: &Player, w: Wonder) -> CostInfo {
|
||||
CostInfo::new(player, w.info(game).cost.clone())
|
||||
CostInfo::new(
|
||||
player,
|
||||
w.info(game)
|
||||
.cost
|
||||
.clone()
|
||||
.add_extra_options(player, EventOrigin::Wonder(w)),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,3 +456,11 @@ Keep battle odds and a Details expander on one row, with losses, assumptions and
|
|||
comparisons inside. Group defenders inline and remove duplicate leader/estimate
|
||||
dividers in movement confirmation. Verified collapsed/expanded combat preview,
|
||||
Svelte checks, locale checks, and production build.
|
||||
|
||||
### 0.1.162 / engine 0.4.109 — Captives in wonder payments
|
||||
|
||||
Apply civilization payment conversions to wonder costs before checking availability.
|
||||
Human Sacrifice can now pay wonder culture costs directly with captives, including
|
||||
through the normal wonder construction button. Verified a local copy of the reported
|
||||
Placid-estuary-1587 purchase, regression coverage for availability and spending,
|
||||
frontend/engine tests, locales, type checking and production build. No saved data edited.
|
||||
|
|
|
|||
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.161",
|
||||
"version": "0.1.162",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.161",
|
||||
"version": "0.1.162",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.161",
|
||||
"version": "0.1.162",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1564,3 +1564,28 @@ test('Navigator grants Cartography again after a normal Move at the same action-
|
|||
assert.equal(after.actions_left,actions);
|
||||
assert.equal(after.players[index].resources.ideas,2);
|
||||
});
|
||||
|
||||
test('Human Sacrifice makes wonders directly buildable and pays their culture cost with captives', async () => {
|
||||
const g = await setup('Aztecs'), index = seat(g), p = g.players[index];
|
||||
addAdvance(p, 'Engineering', 'Priesthood');
|
||||
p.wonder_cards = ['GreatMausoleum'];
|
||||
g.wonders_left = g.wonders_left.filter((w: string) => w !== 'GreatMausoleum');
|
||||
p.cities[0].mood_state = 'Happy';
|
||||
p.cities.push({ position: g.map.tiles.find(([pos, t]: string[]) => pos !== p.cities[0].position && t === 'Forest')[0], mood_state: 'Happy' });
|
||||
p.resources = { food: 6, ore: 2, gold: 6, culture_tokens: 3 };
|
||||
heldCaptives(g, index, 2);
|
||||
assert.equal(view(g).wonderCards[0].action, null, 'captives alone do not enable token payment');
|
||||
addAdvance(p, 'Rituals');
|
||||
const card = view(g).wonderCards[0];
|
||||
assert.ok(card.action, card.reason);
|
||||
let after = move(g, card.action);
|
||||
if (view(after).decision.options.some((o: any) => o.value === p.cities[0].position))
|
||||
after = move(after, { Response: { SelectPositions: [p.cities[0].position] } });
|
||||
const payment = { food: 4, ore: 2, gold: 6, culture_tokens: 3, captives: 2 };
|
||||
after = move(after, { Response: { Payment: [payment] } });
|
||||
assert.ok(after.players[index].cities[0].city_pieces.wonders.includes('GreatMausoleum'));
|
||||
assert.equal(after.players[index].captives?.length ?? 0, 0);
|
||||
assert.equal(after.players[index].resources.captives ?? 0, 0);
|
||||
assert.equal(after.players[index].resources.culture_tokens ?? 0, 0);
|
||||
assert.equal(after.actions_left, g.actions_left - 1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue