VANITY v0.10.2 — targeting apply-damage fix

The apply button counted only bought damage and dropped the first net
Success, which is the hit itself. Fixed in the VRPG source; this repo
carries the published system.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
slaguru666
2026-07-23 00:13:53 +01:00
co-authored by Claude Opus 4.8
parent 38bfc940c9
commit 3216621324
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"id": "vanity",
"title": "VANITY — the Vanity Role-Playing Game",
"description": "A generic d6 RPG where ego is a resource and the universe keeps score. Pool = Attribute + Knack + situation; 5–6 = a Success; fail with two 1s = a Stumble that banks a Bane of Karma (Draft 13). No hit points — Grit. Vanity, Karma and Glory drive play. Includes the full Draft 13 rulebook, all spells and gear, the starter bestiary, a 100-item Treasures & Relics library, twenty ready-to-play characters (each with cameo art, token and backstory), ten animal companions with the d10 Bond table and the one-shot adventure The Vain Crown.",
"version": "0.10.1",
"version": "0.10.2",
"compatibility": {
"minimum": 13,
"verified": "14.364"
+6 -3
View File
@@ -376,7 +376,7 @@ function renderRollCard({ label, sublabel, results, threshold, pushed, context,
? `<div class="vanity-buttons twist-row"><button type="button" class="vanity-twist free" data-free="true"><i class="fa-solid fa-dice"></i> GM: Twist the Knife — free d66</button></div>`
: twistUsed ? `<div class="twist-spent">The knife has been twisted.</div>` : ""}
${spellScaling}
${targetBlock(target, results, spend)}
${targetBlock(target, results, spend, context)}
${extra ? `<div class="vanity-extra">${extra}</div>` : ""}
${specials}
${buttons ? `<div class="vanity-buttons">${buttons}</div>` : ""}
@@ -389,11 +389,14 @@ function renderRollCard({ label, sublabel, results, threshold, pushed, context,
* charge of the fiction — Subdue, mercy and "he was already down" all live in
* the beat between the roll and the click.
*/
function targetBlock(target, results, spend) {
function targetBlock(target, results, spend, context = "attack") {
if (!target) return "";
const successes = results.filter(r => r >= 5).length;
const net = Math.max(0, successes - (spend?.defence ?? target.successes ?? 0));
const damage = spend?.damage ?? 0;
// In an exchange the first net Success IS the hit — 1 Grit before anything is
// bought. Only a spell starts from nothing, because its Threshold bought the
// effect instead. Mirrors the arithmetic in renderSpendPanel.
const damage = net > 0 ? (context === "spell" ? 0 : 1) + (spend?.damage ?? 0) : 0;
const pips = (target.results ?? []).map(r =>
`<span class="d ${r >= 5 ? "hit" : r === 1 ? "one" : ""}">${DIE_FACES[r] ?? r}</span>`).join("");
const pierceNote = target.piercing