Talents automation + management

This commit is contained in:
2022-10-28 21:44:49 +02:00
parent e4d7ff4ca3
commit 6551a93791
14 changed files with 453 additions and 89 deletions

View File

@ -314,24 +314,25 @@ export class HawkmoonUtility {
rollData.predilections = duplicate(rollData.competence.system.predilections.filter(pred => pred.acquise && !pred.maitrise && !pred.used) || [])
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
if ( rollData.selectedTalents && rollData.selectedTalents.length > 0) {
for (let id of rollData.selectedTalents) {
let talent = actor.items.find(t => t.id == id)
let bonus = talent.system.automations.find( a => a.eventtype == "roll-bonus")
if (bonus) {
rollData.diceFormula += `+${bonus.value}`
}
}
}
} else {
rollData.diceFormula += `+${rollData.attr.value}*2+${rollData.modificateur}`
}
if (rollData.arme && rollData.arme.type == "arme") {
rollData.diceFormula += `+${rollData.arme.system.bonusmaniementoff}`
}
if (rollData.rune) {
rollData.runeduree = Math.ceil((rollData.runeame + 3) / 3)
if (rollData.runemode == "inscrire") {
rollData.runeduree *= 2
}
if (rollData.runemode == "prononcer") {
rollData.runeduree = 1
}
}
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll
@ -395,9 +396,11 @@ export class HawkmoonUtility {
/* -------------------------------------------- */
static async searchItem(dataItem) {
let item;
let item
if (dataItem.pack) {
item = await fromUuid("Compendium." + dataItem.pack + "." + dataItem.id);
let id = dataItem.id || dataItem._id
let items = await this.loadCompendium(dataItem.pack, item => item.id == id)
item = items[0] || undefined
} else {
item = game.items.get(dataItem.id)
}