Cleanup
Construction du message de jet de constitution par template hbs
This commit is contained in:
parent
e652027b02
commit
f02959adee
@ -590,11 +590,14 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _jetRecuperationConstitution(bonusSoins, message = undefined) {
|
async _jetRecuperationConstitution(bonusSoins, message = undefined) {
|
||||||
const tData = this.system;
|
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max);
|
||||||
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, tData.sante.vie.value - tData.sante.vie.max);
|
let rolled = await RdDResolutionTable.roll(this.system.carac.constitution.value, difficulte);
|
||||||
let rolled = await RdDResolutionTable.roll(tData.carac.constitution.value, difficulte);
|
|
||||||
if (message) {
|
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;
|
return rolled;
|
||||||
}
|
}
|
||||||
|
@ -89,17 +89,6 @@ export class RdDResolutionTable {
|
|||||||
return resultat;
|
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') {
|
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||||
return await ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
return await ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||||
|
@ -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-hautrevant.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.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/partial-item-description.html',
|
||||||
|
'systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/resolution-table.html',
|
'systems/foundryvtt-reve-de-dragon/templates/resolution-table.html',
|
||||||
// Dialogs
|
// Dialogs
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html',
|
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html',
|
||||||
|
11
templates/roll/explain.hbs
Normal file
11
templates/roll/explain.hbs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<img class="chat-icon" src="{{actor.img}}" title="{{actor.name}}" alt="{{actor.name}}" />
|
||||||
|
<p>Jet de {{carac.label}} à {{rolled.finalLevel}}:
|
||||||
|
<strong>
|
||||||
|
{{rolled.roll}}
|
||||||
|
</strong> sur {{rolled.score}}%
|
||||||
|
{{#if (and rolled.caracValue rolled.finalLevel)}}
|
||||||
|
({{#if (gt rolled.diviseurSignificative 1)}}1/{{rolled.diviseurSignificative}}{{/if}}
|
||||||
|
de {{rolled.caracValue}} à {{numberFormat rolled.finalLevel decimals=0 sign=true}})
|
||||||
|
{{/if}}
|
||||||
|
<strong>{{rolled.quality}}</strong>
|
||||||
|
</p>
|
Loading…
Reference in New Issue
Block a user