diff --git a/src/games/dominion/DominionArt.js b/src/games/dominion/DominionArt.js index 5bdc1d1..b80089b 100644 --- a/src/games/dominion/DominionArt.js +++ b/src/games/dominion/DominionArt.js @@ -552,6 +552,11 @@ function valueInPanel(ctx, def, cx, cy, r) { return false; } +// Badge position over the art's top-right corner with a small inset. +function artTopRight(artX, artY, artW, r, pad) { + return { cx: artX + artW - pad - r, cy: artY + pad + r }; +} + // L = 270×390 (hover / showcase / prompt modals): full rules text. function paintLarge(ctx, scene, def) { const w = 270, h = 390; @@ -565,10 +570,15 @@ function paintLarge(ctx, scene, def) { const cx = w / 2; let y = 258; const isValueCard = (def.types.includes('treasure') && def.coin !== undefined) || def.types.includes('victory') || def.types.includes('curse'); + const isTreasureValue = def.types.includes('treasure') && def.coin !== undefined; if (isValueCard && !rest) { - valueInPanel(ctx, def, cx, 300, 30); + const pos = isTreasureValue ? artTopRight(16, 56, w - 32, 30, 12) : { cx, cy: 300 }; + valueInPanel(ctx, def, pos.cx, pos.cy, 30); } else { - if (isValueCard && valueInPanel(ctx, def, 40, 276, 16)) { /* small value badge */ } + if (isValueCard) { + const pos = isTreasureValue ? artTopRight(16, 56, w - 32, 16, 12) : { cx: 40, cy: 276 }; + valueInPanel(ctx, def, pos.cx, pos.cy, 16); + } if (bonus.length) { const rows = bonus.length <= 2 ? bonus : [bonus.slice(0, 2).join(' '), bonus.slice(2).join(' ')]; const bs = rest ? 16 : 20; @@ -600,14 +610,17 @@ function paintMedium(ctx, scene, def) { const w = 150, h = 216; const pal = paintFrame(ctx, def, w, h, 10); titlePlate(ctx, def, 7, 6, w - 14, 23, 14, pal); - artWindow(ctx, scene, def, 9, 34, w - 18, 92); + const artX = 9, artY = 34, artW = w - 18; + artWindow(ctx, scene, def, artX, artY, artW, 92); parchmentBox(ctx, 7, 131, w - 14, 63, 6, true); const bonus = bonusParts(def); const rest = rulesRemainder(def); const cx = w / 2; const isValueCard = (def.types.includes('treasure') && def.coin !== undefined) || def.types.includes('victory') || def.types.includes('curse'); + const isTreasureValue = def.types.includes('treasure') && def.coin !== undefined; if (isValueCard && !rest) { - valueInPanel(ctx, def, cx, 162, 21); + const pos = isTreasureValue ? artTopRight(artX, artY, artW, 21, 8) : { cx, cy: 162 }; + valueInPanel(ctx, def, pos.cx, pos.cy, 21); } else if (bonus.length && !rest) { const rows = bonus.length <= 2 ? bonus : [bonus.slice(0, 2).join(' '), bonus.slice(2).join(' ')]; const bs = rows.length > 2 ? 11 : 13; @@ -622,7 +635,10 @@ function paintMedium(ctx, scene, def) { drawLines(ctx, rows, cx, y, 11, pal.ink, 'bold', 1.1); y += rows.length * 12.1 + 2; } - if (isValueCard) valueInPanel(ctx, def, 22, 147, 10); + if (isValueCard) { + const pos = isTreasureValue ? artTopRight(artX, artY, artW, 10, 8) : { cx: 22, cy: 147 }; + valueInPanel(ctx, def, pos.cx, pos.cy, 10); + } if (rest) { const maxH = 191 - y; const fit = fitText(ctx, rest, w - 24, maxH, [10.5, 10, 9.5, 9, 8.5, 8]);