Add initiative rolls

This commit is contained in:
2026-03-06 09:09:10 +01:00
parent 16cf35aed6
commit badfea1166
7 changed files with 55 additions and 2 deletions
+18
View File
@@ -0,0 +1,18 @@
export default class AwECombatant extends Combatant {
/**
* Initiative = 1d20 + highest attribute modifier.
* @override
*/
getInitiativeRoll(formula) {
const actor = this.actor
if (!actor) return super.getInitiativeRoll(formula)
const attrs = actor.system?.attributes ?? {}
const mods = ["agility", "awareness", "fitness", "influence"]
.map(k => attrs[k]?.mod ?? 0)
const highest = Math.max(...mods)
const rollFormula = highest >= 0 ? `1d20 + ${highest}` : `1d20 - ${Math.abs(highest)}`
return Roll.create(rollFormula)
}
}