Nouvelles corrections sur la fiche

This commit is contained in:
2026-03-06 14:49:32 +01:00
parent a527bd494f
commit 97e97273da
6 changed files with 84 additions and 1 deletions
+32
View File
@@ -32,6 +32,38 @@ export default class AwEActor extends Actor {
if (actorData.type !== "creature") return
}
/**
* Roll a weapon attack: attack roll + damage if hit.
* @param {Item} weaponItem - The weapon item being used.
* @param {object} options - Additional roll options.
* @returns {Promise<AwERoll|null>} The evaluated roll, or null if cancelled.
*/
async rollWeapon(weaponItem, options = {}) {
const attrId = weaponItem.system.attackAttribute
const attribute = this.system.attributes[attrId]
if (!attribute) return null
const knowledgeBonuses = this.itemTypes.field?.map(f => ({
label: f.name,
bonus: f.system.knowledgeBonus ?? ""
})).filter(f => f.bonus !== "") ?? []
return AwERoll.prompt({
attributeKey: attrId,
modifier: attribute.mod ?? 0,
attributeBonus: attribute.bonus ?? 0,
knowledgeBonuses,
actorId: this.id,
actorName: this.name,
actorImage: this.img,
sourceItemName: weaponItem.name,
sourceItemImg: weaponItem.img,
damageFormula: weaponItem.system.damageFormula,
damageType: weaponItem.system.damageType,
...options
})
}
/**
* Roll an attribute check.
* @param {string} attributeId - The attribute to roll.