Correction compendiums

This commit is contained in:
2026-04-27 21:30:33 +02:00
parent 1e252ff6f2
commit bc49286f91
76 changed files with 1645 additions and 73 deletions
+25
View File
@@ -118,4 +118,29 @@ export function registerHandlebarsHelpers() {
}
return game.i18n.localize(keys[activation] ?? "CDE.Activation")
})
/**
* Compute the SVG x,y coordinates for a cran on the initiative wheel.
* Cran 124 are arranged counter-clockwise from the bottom (reference at 6 o'clock).
* angle = 90° + cran * 15° (counter-clockwise = positive in standard math, negative in SVG).
* In SVG coords: x = cx + r*cos(a), y = cy - r*sin(a) [y-axis is flipped in SVG].
*/
Handlebars.registerHelper("cranPosition", function (cran, cx, cy, r) {
const angleDeg = 90 + cran * 15 // counter-clockwise from bottom
const angleRad = (angleDeg * Math.PI) / 180
const x = Math.round(cx + r * Math.cos(angleRad))
const y = Math.round(cy - r * Math.sin(angleRad))
return { x, y }
})
/** X offset for overlapping fighters on the same cran. Centres a 30px image on the cran cx. */
Handlebars.registerHelper("fighterX", function (cx, index, total) {
const offset = total > 1 ? (index - (total - 1) / 2) * 34 : 0
return Math.round(cx - 15 + offset)
})
/** Y offset for fighters — positions image just above the cran circle. */
Handlebars.registerHelper("fighterY", function (cy, index, total) {
return Math.round(cy - 50)
})
}