Ajout multiples pour le combat et ameliorations des items
This commit is contained in:
@ -50,6 +50,10 @@ export class TeDeumUtility {
|
||||
//console.log("getConfigLabel", configName, key)
|
||||
return game.system.tedeum.config[configName][key].label
|
||||
})
|
||||
Handlebars.registerHelper('getConfigLabelArray', function (configName, key) {
|
||||
//console.log("getConfigLabel", configName, key)
|
||||
return game.system.tedeum.config[configName][key].label
|
||||
})
|
||||
Handlebars.registerHelper('isSpecArmeType', function (key, armeType) {
|
||||
return game.system.tedeum.config.ARME_SPECIFICITE[key][armeType]
|
||||
})
|
||||
@ -360,6 +364,10 @@ export class TeDeumUtility {
|
||||
/* -------------------------------------------- */
|
||||
static modifyDice(dice, bonusMalus) {
|
||||
let newIndex = game.system.tedeum.config.diceValeur.indexOf(dice) + Number(bonusMalus)
|
||||
if (newIndex < 0) {
|
||||
ui.notifications.error("Vos blessures ou maladies vous empêchent de réaliser cette action, vous êtes trop faibles")
|
||||
return undefined
|
||||
}
|
||||
newIndex = Math.min(Math.max(newIndex, 0), game.system.tedeum.config.diceValeur.length - 1)
|
||||
return game.system.tedeum.config.diceValeur[newIndex]
|
||||
}
|
||||
@ -368,7 +376,8 @@ export class TeDeumUtility {
|
||||
static computeRollFormula(rollData, actor, isConfrontation = false) {
|
||||
let diceFormula = ""
|
||||
if (rollData.competence) {
|
||||
let diceBase = this.modifyDice(rollData.carac.dice, rollData.bonusMalus+rollData.malusBlessures)
|
||||
let diceBase = this.modifyDice(rollData.carac.dice, Number(rollData.bonusMalus)+rollData.santeModifier)
|
||||
if (!diceBase) return;
|
||||
diceFormula = diceBase + "x + " + rollData.competence.system.score
|
||||
}
|
||||
if (rollData.enableProvidence) {
|
||||
@ -386,8 +395,9 @@ export class TeDeumUtility {
|
||||
rollData.difficulty = 7
|
||||
}
|
||||
rollData.difficulty = game.system.tedeum.config.difficulte[rollData.difficulty].value
|
||||
|
||||
let diceFormula = this.computeRollFormula(rollData, actor)
|
||||
if (!diceFormula) return;
|
||||
console.log("RollData", rollData, diceFormula )
|
||||
|
||||
// Performs roll
|
||||
let myRoll = await new Roll(diceFormula).roll()
|
||||
@ -501,7 +511,7 @@ export class TeDeumUtility {
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollId: foundry.utils.randomID(16),
|
||||
type: "roll-data",
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
difficulty: "pardefaut",
|
||||
@ -509,7 +519,7 @@ export class TeDeumUtility {
|
||||
isReroll : false,
|
||||
enableProvidence : false,
|
||||
malusBlessures: 0,
|
||||
config: duplicate(game.system.tedeum.config)
|
||||
config: foundry.utils.duplicate(game.system.tedeum.config)
|
||||
}
|
||||
TeDeumUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
|
Reference in New Issue
Block a user