Construction du message de jet de constitution par template hbs
This commit is contained in:
Vincent Vandemeulebrouck
2022-12-07 14:21:48 +01:00
parent e652027b02
commit f02959adee
4 changed files with 19 additions and 15 deletions

View File

@ -590,11 +590,14 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async _jetRecuperationConstitution(bonusSoins, message = undefined) {
const tData = this.system;
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, tData.sante.vie.value - tData.sante.vie.max);
let rolled = await RdDResolutionTable.roll(tData.carac.constitution.value, difficulte);
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max);
let rolled = await RdDResolutionTable.roll(this.system.carac.constitution.value, difficulte);
if (message) {
message.content += RdDResolutionTable.explain(rolled).replace(/Jet :/, "Constitution :");
message.content = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs", {
actor: this,
carac: this.system.carac.constitution,
rolled
})
}
return rolled;
}

View File

@ -89,17 +89,6 @@ export class RdDResolutionTable {
return resultat;
}
/* -------------------------------------------- */
static explain(rolled) {
let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "% ";
if (rolled.caracValue != undefined && rolled.finalLevel != undefined) {
message += (rolled.diviseurSignificative > 1 ? `(1/${rolled.diviseurSignificative} de ` : "(")
+ rolled.caracValue + " à " + Misc.toSignedString(rolled.finalLevel) + ") ";
}
message += '<strong>' + rolled.quality + '</strong>'
return message;
}
/* -------------------------------------------- */
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
return await ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {

View File

@ -238,6 +238,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/partial-item-hautrevant.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html',
'systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs',
'systems/foundryvtt-reve-de-dragon/templates/resolution-table.html',
// Dialogs
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html',