Add customizable rolls to items

This commit is contained in:
mstein
2022-07-23 18:50:08 +02:00
parent 58ed9d7d74
commit b3e2771e91
24 changed files with 361 additions and 155 deletions
+13 -11
View File
@@ -65,7 +65,7 @@ export class M5Item extends Item {
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
if (actorCalc) {
calc.ew += actorCalc.stats.attackBonus
calc.ew += actorCalc.stats.attackBonus.value
calc.combatSkills = actorCalc.skills.combat
}
@@ -108,7 +108,7 @@ export class M5Item extends Item {
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
if (actorCalc) {
calc.ew += actorCalc.stats.spellCasting
calc.ew += actorCalc.stats.spellCasting.value
}
}
} else if (context.type === "item") {
@@ -204,15 +204,17 @@ export class M5Item extends Item {
const rollData = this.getRollData()
formulaNames.forEach(formulaName => {
const formula = item.data.rolls.formulas[formulaName]
rollData.rolls[formulaName] = {
formula: formula.formula,
label: formula.label,
type: formula.type,
result: "",
total: 0,
totalStr: "",
dice: {}
} as M5RollResult
if (formula) {
rollData.rolls[formulaName] = {
formula: formula.formula,
label: formula.label,
enabled: formula.enabled,
result: "",
total: 0,
totalStr: "",
dice: {}
} as M5RollResult
}
})
const roll = new M5Roll(rollData, this.actor, item.name)