Take Church bonus by default and compact mobile production controls

This commit is contained in:
coyotte508 2026-10-13 21:43:28 +02:00
commit aaed54d8c1
5 changed files with 32 additions and 1 deletions

View file

@ -59,3 +59,17 @@ test("historical quarry overpayments remain replayable but cannot be submitted n
}
assert.fail("Expected a historical quarry payment fixture");
});
test("building choices automatically take the Church bonus", async () => {
const E = await import("../engine/index.js");
let s = E.init(3, [], {}, "church-payment");
s.players[0].coins = 20;
s.players[0].buildings = [{ id: "church", w: 1, c: 0 }];
s.market.monument = 1;
s = E.move(s, { type: "role", id: "builder" }, 0);
const offered = E.legal(s, 0).filter((m) => m.type === "build" && m.id === "monument" && showBuildingPayment(s.players[0], m));
assert.equal(offered.length, 1);
assert.equal(offered[0].decline, undefined);
const after = E.move(s, offered[0], 0);
assert.equal(after.players[0].vp, s.players[0].vp + 2);
});

View file

@ -2,6 +2,7 @@ import { BUILDINGS } from "../engine/catalog.js";
// Keep the minimum payment visible. Extra payments matter only for Big Spender.
export function showBuildingPayment(player, move) {
if (move.type === "build" && move.decline?.includes("church")) return false;
return (
move.type !== "build" ||
move.pay === undefined ||

View file

@ -1,4 +1,5 @@
const paths = {
edit: '<path d="m4 16 11-11 4 4-11 11-5 1Z"/><path d="m13 7 4 4m-13 5 4 4"/>',
stock:
'<rect x="3" y="8" width="13" height="13" rx="1"/><path d="M7 5h12v12M10 2h12v12"/>',
cityFootprint:

View file

@ -2813,3 +2813,18 @@ body:has(.pr-game) {
align-items: center;
gap: 2px;
}
.pr-game .produce-goods { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; }
.pr-game .produce-action > span { display: flex; align-items: center; gap: 8px; }
@media (max-width: 760px) {
.pr-game .action-dock .produce-label,
.pr-game .action-dock .production-custom > span { display: none; }
.pr-game .action-dock:not(.action-dock-compact) .dock-controls > button.production-custom {
flex: 0 0 44px;
padding: 8px;
}
.pr-game .action-dock:not(.action-dock-compact) .dock-controls:has(.produce-action) > button.dock-pass {
flex: 0 0 auto;
}
.pr-game .action-dock .produce-action { flex: 1 1 auto; }
}

View file

@ -437,7 +437,7 @@ export function mountGame(
}
function actionButton(m) {
if (m.type === "produce")
return `${moveButton(m, moveLabel(m), "craftsman", "primary")}<button class="quiet" data-custom-production="${encode(m)}" ${allowed() ? "" : "disabled"}>${t("selectQty")}</button>`;
return `${moveButton(m, `<span class="produce-label">${t("produce")}</span><span class="produce-goods">${goodsRow(m.goods)}</span>`, "check", "primary produce-action", t("produce"))}<button class="quiet production-custom" data-custom-production="${encode(m)}" title="${esc(t("selectQty"))}" aria-label="${esc(t("selectQty"))}" ${allowed() ? "" : "disabled"}>${icon("edit")}<span>${t("selectQty")}</span></button>`;
if (m.type === "role") return roleCard(state.roles.find((r) => r.id === m.id));
const compact = compactAction(m);
return compact