Amélioration fenêtre de Tchat #42
This commit is contained in:
@ -88,7 +88,47 @@ export class RdDResolutionTable {
|
||||
return message;
|
||||
}
|
||||
|
||||
static async explainRollDataV2(rollData, template = 'chat-resultat-rdd.html') {
|
||||
rollData.ajustements = RdDResolutionTable._buildAjustements(rollData);
|
||||
rollData.show = rollData.show || {};
|
||||
|
||||
let html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
|
||||
return html;
|
||||
}
|
||||
|
||||
static _buildAjustements(rollData) {
|
||||
let list = [];
|
||||
if (rollData.competence) {
|
||||
list.push({ label: rollData.competence.name, value: rollData.competence.data.niveau});
|
||||
}
|
||||
if (rollData.diffLibre != undefined) {
|
||||
const label = rollData.selectedSort ? rollData.selectedSort.name : 'libre';
|
||||
list.push({ label: label, value: rollData.diffLibre });
|
||||
}
|
||||
if (rollData.diffConditions != undefined) {
|
||||
list.push({ label: 'conditions', value: rollData.diffConditions });
|
||||
}
|
||||
if (rollData.etat != undefined) {
|
||||
list.push({ label: 'état', value: rollData.etat });
|
||||
}
|
||||
if (rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté') {
|
||||
list.push({ label: 'moral', value: rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté' ? rollData.moral : undefined });
|
||||
}
|
||||
if (RdDResolutionTable.isAjustementAstrologique(rollData)) {
|
||||
list.push({ label: 'astrologique', value: rollData.ajustementAstrologique||0 });
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static explainRollData(rollData) {
|
||||
let parts = RdDResolutionTable._buildAjustementsList(rollData);
|
||||
let message = parts.length > 0 ? "<br>Difficulté " + parts.reduce((a, b) => a + ' / ' + b) : "";
|
||||
|
||||
return message+ RdDResolutionTable.explain(rollData.rolled)
|
||||
}
|
||||
|
||||
|
||||
static _buildAjustementsList(rollData) {
|
||||
let parts = [];
|
||||
if (rollData.diffLibre != undefined) {
|
||||
parts.push(`<strong>libre: ${rollData.diffLibre}</strong>`);
|
||||
@ -102,9 +142,7 @@ export class RdDResolutionTable {
|
||||
if (rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté') {
|
||||
parts.push(`moral: ${rollData.moral}`);
|
||||
}
|
||||
let message = parts.length > 0 ? "<br>Difficulté " + parts.reduce((a, b) => a + ' / ' + b) : "";
|
||||
|
||||
return message+ RdDResolutionTable.explain(rollData.rolled)
|
||||
return parts;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -165,6 +203,16 @@ export class RdDResolutionTable {
|
||||
return duplicate(this.resolutionTable[caracValue][difficulte + 10]);
|
||||
}
|
||||
|
||||
static isAjustementAstrologique(rollData) {
|
||||
if (rollData.selectedCarac.label.toLowerCase().includes('chance')) {
|
||||
return true;
|
||||
}
|
||||
if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isEchec(rollData) {
|
||||
switch (rollData.surprise) {
|
||||
|
Reference in New Issue
Block a user