Cleanup roll windows

- permettre plusieurs fenêtres de jets en même temps en éliminant les
  id dans le html et les jquery sur id pour éviter les interactions
- génération de la table par handlebars
This commit is contained in:
Vincent Vandemeulebrouck 2022-12-06 01:30:12 +01:00
parent f027e3318b
commit 2122a54db7
43 changed files with 319 additions and 343 deletions

View File

@ -150,17 +150,6 @@ export class RdDActor extends Actor {
this.computeEtatGeneral(); this.computeEtatGeneral();
} }
/* -------------------------------------------- */
setRollWindowsOpened(flag) {
// TODO: résoudre le souci lié aux ids dans les fenêtres roll
this.rollWindowsOpened = flag;
}
/* -------------------------------------------- */
isRollWindowsOpened() {
return this.rollWindowsOpened;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_prepareCreatureData(actorData) { _prepareCreatureData(actorData) {
this.computeEncombrementTotalEtMalusArmure(); this.computeEncombrementTotalEtMalusArmure();

View File

@ -73,7 +73,7 @@ export class DialogFabriquerPotion extends Dialog {
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
html.find("#nbBrins").change(event => { html.find("[name='nbBrins']").change(event => {
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value); this.potionData.nbBrins = Misc.toInt(event.currentTarget.value);
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins); const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins);
this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants) this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants)
@ -82,7 +82,7 @@ export class DialogFabriquerPotion extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async onFabriquer(it) { async onFabriquer(it) {
await $("#nbBrins").change(); await $("[name='nbBrins']").change();
this.actor.fabriquerPotion(this.potionData); this.actor.fabriquerPotion(this.potionData);
this.close(); this.close();
} }

View File

@ -35,7 +35,7 @@ export class DialogValidationEncaissement extends Dialog {
} }
let dialogOptions = { let dialogOptions = {
classes: ["rdddialog"], classes: ["rdd-roll-dialog"],
width: 350, width: 350,
height: 290 height: 290
} }

View File

@ -15,7 +15,7 @@
// Common conf // Common conf
let dialogConf = { content: html, title: "Editeur d'Astrologie", buttons: myButtons, default: "saveButton" }; let dialogConf = { content: html, title: "Editeur d'Astrologie", buttons: myButtons, default: "saveButton" };
let dialogOptions = { classes: ["rdddialog"], width: 600, height: 300, 'z-index': 99999 } let dialogOptions = { classes: ["rdd-roll-dialog"], width: 600, height: 300, 'z-index': 99999 }
super(dialogConf, dialogOptions) super(dialogConf, dialogOptions)
this.calendrier = calendrier; this.calendrier = calendrier;

View File

@ -20,7 +20,7 @@ export class RdDAstrologieJoueur extends Dialog {
astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie') astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie')
} }
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData); const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData);
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 }; let options = { classes: ["rdd-roll-dialog"], width: 600, height: 500, 'z-index': 99999 };
if (dialogConfig.options) { if (dialogConfig.options) {
mergeObject(options, dialogConfig.options, { overwrite: true }); mergeObject(options, dialogConfig.options, { overwrite: true });
} }
@ -37,7 +37,7 @@ export class RdDAstrologieJoueur extends Dialog {
// Get all n // Get all n
// Common conf // Common conf
let dialogConf = { content: html, title: "Nombres Astraux", buttons: myButtons, default: "saveButton" }; let dialogConf = { content: html, title: "Nombres Astraux", buttons: myButtons, default: "saveButton" };
let dialogOptions = { classes: ["rdddialog"], width: 600, height: 300, 'z-index': 99999 }; let dialogOptions = { classes: ["rdd-roll-dialog"], width: 600, height: 300, 'z-index': 99999 };
super(dialogConf, dialogOptions); super(dialogConf, dialogOptions);
this.actor = actor; this.actor = actor;
@ -68,7 +68,7 @@ export class RdDAstrologieJoueur extends Dialog {
carac_vue: this.actor.system.carac['vue'].value, carac_vue: this.actor.system.carac['vue'].value,
etat: this.dataNombreAstral.etat, etat: this.dataNombreAstral.etat,
astrologie: this.dataNombreAstral.astrologie, astrologie: this.dataNombreAstral.astrologie,
conditions: $("#diffConditions").val(), conditions: $("[name='diffConditions']").val(),
date: $("#joursAstrologie").val(), date: $("#joursAstrologie").val(),
userId: game.user.id userId: game.user.id
} }
@ -92,7 +92,7 @@ export class RdDAstrologieJoueur extends Dialog {
super.activateListeners(html); super.activateListeners(html);
$(function () { $(function () {
$("#diffConditions").val(0); $("[name='diffConditions']").val(0);
}); });
html.find('#jet-astrologie').click((event) => { html.find('#jet-astrologie').click((event) => {

View File

@ -14,7 +14,7 @@ const levelDown = [
{ level: -15, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 10 }, { level: -15, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 10 },
{ level: -16, score: 1, norm: 1, sign: 0, part: 0, epart: 0, etotal: 2 } { level: -16, score: 1, norm: 1, sign: 0, part: 0, epart: 0, etotal: 2 }
]; ];
const levelImpossible = { score: 0, norm:0, sign: 0, part: 0, epart: 0, etotal: 1 }; const levelImpossible = { score: 0, norm: 0, sign: 0, part: 0, epart: 0, etotal: 1 };
const reussites = [ const reussites = [
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 }, { code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
@ -42,6 +42,44 @@ export class RdDResolutionTable {
return table; return table;
} }
/* -------------------------------------------- */
static computeChances(carac, level) {
if (level < -16) {
return levelImpossible;
}
if (level < -10) {
return levelDown.find(it => it.level == level);
}
const percentage = RdDResolutionTable.computePercentage(carac, level);
return this._computeCell(level, percentage);
}
/* -------------------------------------------- */
static _computeRow(caracValue) {
let dataRow = [
this._computeCell(-10, Math.max(Math.floor(caracValue / 4), 1)),
this._computeCell(-9, Math.max(Math.floor(caracValue / 2), 1))
]
for (var diff = -8; diff <= 22; diff++) {
dataRow[diff + 10] = this._computeCell(diff, RdDResolutionTable.computePercentage(caracValue, diff));
}
return dataRow;
}
/* -------------------------------------------- */
static _computeCell(niveau, percentage) {
return {
niveau: niveau,
score: percentage,
norm: Math.min(99, percentage),
sign: this._reussiteSignificative(percentage),
part: this._reussitePart(percentage),
epart: this._echecParticulier(percentage),
etotal: this._echecTotal(percentage)
};
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static getResultat(code) { static getResultat(code) {
let resultat = reussites.find(r => code == r.code); let resultat = reussites.find(r => code == r.code);
@ -82,8 +120,8 @@ export class RdDResolutionTable {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async roll(caracValue, finalLevel, rollData = {}){ static async roll(caracValue, finalLevel, rollData = {}) {
let chances = this.computeChances(caracValue, finalLevel); let chances = duplicate(this.computeChances(caracValue, finalLevel));
this._updateChancesWithBonus(chances, rollData.bonus, finalLevel); this._updateChancesWithBonus(chances, rollData.bonus, finalLevel);
this._updateChancesFactor(chances, rollData.diviseurSignificative); this._updateChancesFactor(chances, rollData.diviseurSignificative);
chances.showDice = rollData.showDice; chances.showDice = rollData.showDice;
@ -95,7 +133,7 @@ export class RdDResolutionTable {
rolled.bonus = rollData.bonus; rolled.bonus = rollData.bonus;
rolled.factorHtml = Misc.getFractionHtml(rollData.diviseurSignificative); rolled.factorHtml = Misc.getFractionHtml(rollData.diviseurSignificative);
if (ReglesOptionelles.isUsing("afficher-colonnes-reussite")){ if (ReglesOptionelles.isUsing("afficher-colonnes-reussite")) {
rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll); rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll);
rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel; rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel;
} }
@ -103,13 +141,24 @@ export class RdDResolutionTable {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static findNiveauNecessaire(caracValue, rollValue) { static findNiveauNecessaire(carac, rolled) {
for (let cell of this.resolutionTable[caracValue]) { if (carac == 0) {
if ( rollValue <= cell.norm) { return NaN;
return cell.niveau;
}
} }
return 16; // Dummy default if (rolled >= carac){
const upper = Math.ceil(rolled/carac);
return 2*upper -10
}
if (rolled > Math.floor(carac/2)) {
return -8
}
if (rolled > Math.floor(carac/4)) {
return -9
}
if (rolled > 1) {
return -10
}
return -11;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -122,7 +171,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static _updateChancesWithBonus(chances, bonus, finalLevel) { static _updateChancesWithBonus(chances, bonus, finalLevel) {
if (bonus && finalLevel>-11) { if (bonus && finalLevel > -11) {
let newScore = Number(chances.score) + bonus; let newScore = Number(chances.score) + bonus;
mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true }); mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
} }
@ -142,21 +191,19 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async rollChances(chances, diviseur, forceDiceResult = -1) { static async rollChances(chances, diviseur, forceDiceResult = -1) {
chances.forceDiceResult = forceDiceResult <= 0 || forceDiceResult > 100 ? undefined : {total: forceDiceResult}; chances.forceDiceResult = forceDiceResult <= 0 || forceDiceResult > 100 ? undefined : { total: forceDiceResult };
chances.roll = await RdDDice.rollTotal( "1d100", chances); chances.roll = await RdDDice.rollTotal("1d100", chances);
mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true }); mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true });
return chances; return chances;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeChances(caracValue, difficulte) { static computePercentage(carac, diff) {
if (difficulte < -16) { if (diff < -16) return 0
return duplicate(levelImpossible); if (diff < -10) return 1
} if (diff == -10) return Math.max(Math.floor(carac / 4), 1)
if (difficulte < -10) { if (diff == -9) return Math.max(Math.floor(carac / 2), 1)
return duplicate(levelDown.find(levelData => levelData.level == difficulte)); return Math.max(Math.floor(carac * (diff + 10) / 2), 1);
}
return duplicate(RdDResolutionTable.resolutionTable[caracValue][difficulte + 10]);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -213,31 +260,6 @@ export class RdDResolutionTable {
return reussite; return reussite;
} }
/* -------------------------------------------- */
static _computeRow(caracValue) {
let dataRow = [
this._computeCell(-10, Math.max(Math.floor(caracValue / 4), 1)),
this._computeCell(-9, Math.max(Math.floor(caracValue / 2), 1))
]
for (var diff = -8; diff <= 22; diff++) {
dataRow[diff + 10] = this._computeCell(diff, Math.max(Math.floor(caracValue * (diff + 10) / 2), 1));
}
return dataRow;
}
/* -------------------------------------------- */
static _computeCell(niveau, percentage) {
return {
niveau: niveau,
score: percentage,
norm: Math.min(99, percentage),
sign: this._reussiteSignificative(percentage),
part: this._reussitePart(percentage),
epart: this._echecParticulier(percentage),
etotal: this._echecTotal(percentage)
};
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static _reussiteSignificative(percentage) { static _reussiteSignificative(percentage) {
return Math.floor(percentage / 2); return Math.floor(percentage / 2);
@ -261,92 +283,34 @@ export class RdDResolutionTable {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildHTMLResults(caracValue, levelValue) { static subTable(carac, level, delta = { carac: 2, level: 5}) {
if (caracValue == undefined || isNaN(caracValue)) caracValue = 10; return {
if (levelValue == undefined || isNaN(levelValue)) levelValue = 0; carac,
level,
let cell = this.computeChances(caracValue, levelValue); minCarac: carac - (delta?.carac ?? 2),
cell.epart = cell.epart > 99 ? 'N/A' : cell.epart; maxCarac: carac + (delta?.carac ?? 2),
cell.etotal = cell.etotal > 100 ? 'N/A' : cell.etotal; minLevel: level - (delta?.level ?? 5),
cell.score = Math.min(cell.score, 99); maxLevel: level + (delta?.level ?? 5)
};
return `
<span class="table-proba-reussite competence-label">
Particulière: <span class="rdd-roll-part">${cell.part}</span>
- Significative: <span class="rdd-roll-sign">${cell.sign}</span>
- Réussite: <span class="rdd-roll-norm">${cell.score}</span>
- Echec Particulier: <span class="rdd-roll-epart">${cell.epart}</span>
- Echec Total: <span class="rdd-roll-etotal">${cell.etotal}</span>
</span>
`
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildHTMLTableExtract(caracValue, levelValue) { static async buildHTMLTable({ carac: carac, level: level, minCarac = 1, maxCarac = 21, minLevel = -10, maxLevel = 11 }) {
return this.buildHTMLTable(caracValue, levelValue, caracValue - 2, caracValue + 2, levelValue - 5, levelValue + 5) let colonnes = maxLevel - minLevel;
}
static buildHTMLTable(caracValue, levelValue, minCarac = 1, maxCarac = 21, minLevel = -10, maxLevel = 11) {
return this._buildHTMLTable(caracValue, levelValue, minCarac, maxCarac, minLevel, maxLevel)
}
/* -------------------------------------------- */
static _buildHTMLTable(caracValue, levelValue, minCarac, maxCarac, minLevel, maxLevel) {
let countColonnes = maxLevel - minLevel;
minCarac = Math.max(minCarac, 1); minCarac = Math.max(minCarac, 1);
maxCarac = Math.min(maxCarac, caracMaximumResolution); maxCarac = Math.min(maxCarac, minCarac + 20);
minLevel = Math.max(minLevel, -10); minLevel = Math.max(minLevel, -10);
maxLevel = Math.max(Math.min(maxLevel, 22), minLevel + countColonnes); maxLevel = Math.max(Math.min(maxLevel, 30), minLevel + colonnes);
return await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/resolution-table.html', {
let table = $("<table class='table-resolution'/>") carac: carac,
.append(this._buildHTMLHeader(RdDResolutionTable.resolutionTable[0], minLevel, maxLevel)); difficulte: level,
min: minLevel,
for (var rowIndex = minCarac; rowIndex <= maxCarac; rowIndex++) { rows: RdDResolutionTable.incrementalArray(minCarac, maxCarac),
table.append(this._buildHTMLRow(RdDResolutionTable.resolutionTable[rowIndex], rowIndex, caracValue, levelValue, minLevel, maxLevel)); cols: RdDResolutionTable.incrementalArray(minLevel, maxLevel)
} });
table.append("</table>");
return table;
} }
static incrementalArray(min, max) {
/* -------------------------------------------- */ return Array.from(Array(max-min+1).keys()).map(i=>i+min)
static _buildHTMLHeader(dataRow, minLevel, maxLevel) {
let tr = $("<tr/>");
if (minLevel > -8) {
tr.append($("<th class='table-resolution-level'/>").text("-8"))
}
if (minLevel > -7) {
tr.append($("<th class='table-resolution-level'/>").text("..."));
}
for (let difficulte = minLevel; difficulte <= maxLevel; difficulte++) {
tr.append($("<th class='table-resolution-level'/>").text(Misc.toSignedString(difficulte)));
}
return tr;
}
/* -------------------------------------------- */
static _buildHTMLRow(dataRow, rowIndex, caracValue, levelValue, minLevel, maxLevel) {
let tr = $("<tr/>");
let max = maxLevel;
if (minLevel > -8) {
let score = dataRow[-8 + 10].score;
tr.append($("<td class='table-resolution-carac'/>").text(score))
}
if (minLevel > -7) {
tr.append($("<td/>"))
}
for (let difficulte = minLevel; difficulte <= max; difficulte++) {
let td = $("<td/>");
let score = dataRow[difficulte + 10].score;
if (rowIndex == caracValue && levelValue == difficulte) {
td.addClass('table-resolution-target');
} else if (difficulte == -8) {
td.addClass('table-resolution-carac');
}
tr.append(td.text(score));
}
return tr;
} }
} }

View File

@ -31,7 +31,7 @@ export class RdDEncaisser extends Dialog {
} }
let dialogOptions = { let dialogOptions = {
classes: ["rdddialog"], classes: ["rdd-roll-dialog"],
width: 320, width: 320,
height: 'fit-content' height: 'fit-content'
} }

View File

@ -15,7 +15,7 @@ export class RdDRollDialogEthylisme extends Dialog {
default: "rollButton", default: "rollButton",
buttons: { "rollButton": { label: "Test d'éthylisme", callback: html => this.onButton(html) } } buttons: { "rollButton": { label: "Test d'éthylisme", callback: html => this.onButton(html) } }
}; };
let dialogOptions = { classes: ["rdddialog"], width: 400, height: 'fit-content', 'z-index': 99999 } let dialogOptions = { classes: ["rdd-roll-dialog"], width: 400, height: 'fit-content', 'z-index': 99999 }
super(dialogConf, dialogOptions) super(dialogConf, dialogOptions)
//console.log("ETH", rollData); //console.log("ETH", rollData);
@ -39,20 +39,20 @@ export class RdDRollDialogEthylisme extends Dialog {
// Setup everything onload // Setup everything onload
$(function () { $(function () {
$("#forceAlcool").val(Misc.toInt(rollData.forceAlcool)); html.find(".force-alcool").val(Misc.toInt(rollData.forceAlcool));
dialog.updateRollResult(); dialog.updateRollResult();
}); });
// Update ! // Update !
html.find('#forceAlcool').change((event) => { html.find(".force-alcool").change((event) => {
rollData.forceAlcool = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus rollData.forceAlcool = Misc.toInt(event.currentTarget.value);
dialog.updateRollResult(); dialog.updateRollResult();
}); });
} }
async updateRollResult() { async updateRollResult() {
// Mise à jour valeurs // Mise à jour valeurs
$("#roll-param").text(this.rollData.vie + " / " + Misc.toSignedString(Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses)); $(".roll-ethylisme").text(this.rollData.vie + " / " + Misc.toSignedString(Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses));
$(".table-resolution").remove(); $(".table-resolution").remove();
} }

View File

@ -9,12 +9,19 @@ const titleTableDeResolution = 'Table de résolution';
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDRollResolutionTable extends Dialog { export class RdDRollResolutionTable extends Dialog {
static resolutionTable = undefined;
/* -------------------------------------------- */ /* -------------------------------------------- */
static async open(rollData = {}) { static async open() {
RdDRollResolutionTable._setDefaultOptions(rollData); if (RdDRollResolutionTable.resolutionTable == undefined) {
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData); const rollData = {}
const dialog = new RdDRollResolutionTable(rollData, html); RdDRollResolutionTable._setDefaultOptions(rollData);
dialog.render(true); let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData);
RdDRollResolutionTable.resolutionTable = new RdDRollResolutionTable(rollData, html);
RdDRollResolutionTable.resolutionTable.render(true);
}
else{
RdDRollResolutionTable.resolutionTable.bringToTop();
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -53,7 +60,7 @@ export class RdDRollResolutionTable extends Dialog {
'lancer-fermer': { label: 'Lancer les dés et fermer', callback: html => this.onLancerFermer() } 'lancer-fermer': { label: 'Lancer les dés et fermer', callback: html => this.onLancerFermer() }
} }
}; };
super(conf, { classes: ["rdddialog"], width: 800, height: 'fit-content', 'z-index': 99999 }); super(conf, { classes: ["rdd-roll-dialog"], top: 50, width: 'fit-content', height: 'fit-content', 'z-index': 99999 });
this.rollData = rollData; this.rollData = rollData;
} }
@ -82,55 +89,61 @@ export class RdDRollResolutionTable extends Dialog {
// Setup everything onload // Setup everything onload
function onLoad(){ function onLoad(){
$("#diffLibre").val(Misc.toInt(dialog.rollData.diffLibre)); $("[name='diffLibre']").val(Misc.toInt(dialog.rollData.diffLibre));
$("#diffConditions").val(Misc.toInt(dialog.rollData.diffConditions)); $("[name='diffConditions']").val(Misc.toInt(dialog.rollData.diffConditions));
dialog.updateRollResult(); dialog.updateRollResult(html);
} }
$(function () { onLoad();}); $(function () { onLoad();});
html.find('#lancer').click((event) => { html.find('.lancer-table-resolution').click((event) => {
this.onLancer(); this.onLancer();
}); });
// Update ! // Update !
html.find('#diffLibre').change((event) => { html.find("[name='diffLibre']").change((event) => {
this.rollData.diffLibre = Misc.toInt(event.currentTarget.value); this.rollData.diffLibre = Misc.toInt(event.currentTarget.value);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('#diffConditions').change((event) => { html.find("[name='diffConditions']").change((event) => {
this.rollData.diffConditions = Misc.toInt(event.currentTarget.value); this.rollData.diffConditions = Misc.toInt(event.currentTarget.value);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('#carac').change((event) => { html.find("[name='carac']").change((event) => {
let caracKey = event.currentTarget.value; let caracKey = event.currentTarget.value;
this.rollData.selectedCarac = this.rollData.carac[caracKey]; this.rollData.selectedCarac = this.rollData.carac[caracKey];
this.updateRollResult(); this.updateRollResult(html);
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateRollResult() { async updateRollResult(html) {
let rollData = this.rollData; let rollData = this.rollData;
rollData.caracValue = parseInt(rollData.selectedCarac.value) rollData.caracValue = parseInt(rollData.selectedCarac.value)
rollData.finalLevel = this._computeFinalLevel(rollData); rollData.finalLevel = this._computeFinalLevel(rollData);
const htmlTable = await RdDResolutionTable.buildHTMLTable({
carac:rollData.caracValue,
level: rollData.finalLevel
});
// Mise à jour valeurs // Mise à jour valeurs
$("#carac").val(rollData.caracValue); html.find("[name='carac']").val(rollData.caracValue);
$("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel)); $(".roll-param-resolution").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel));
$(".table-resolution").remove(); $(".table-resolution").remove();
$(".table-proba-reussite").remove(); $(".table-proba-reussite").remove();
$("#tableResolution").append(RdDResolutionTable.buildHTMLTable(rollData.caracValue, rollData.finalLevel));
$("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel)); html.find("div.placeholder-resolution").append(htmlTable)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeFinalLevel(rollData) { _computeFinalLevel(rollData) {
const diffConditions = Misc.toInt(rollData.diffConditions); const diffConditions = Misc.toInt(rollData.diffConditions);
const diffLibre = this._computeDiffLibre(rollData); const diffLibre = Misc.toInt(rollData.diffLibre);
return diffLibre + diffConditions; return diffLibre + diffConditions;
} }
/* -------------------------------------------- */ async close() {
_computeDiffLibre(rollData) { await super.close();
return Misc.toInt(rollData.diffLibre); RdDRollResolutionTable.resolutionTable = undefined;
} }
} }

View File

@ -17,23 +17,16 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async create(actor, rollData, dialogConfig, ...actions) { static async create(actor, rollData, dialogConfig, ...actions) {
if (actor.isRollWindowsOpened()) {
ui.notifications.warn("Vous avez déja une fenêtre de Test ouverte, il faut la fermer avant d'en ouvrir une autre.")
return;
}
actor.setRollWindowsOpened(true);
RdDRoll._ensureCorrectActions(actions); RdDRoll._ensureCorrectActions(actions);
RdDRoll._setDefaultOptions(actor, rollData); RdDRoll._setDefaultOptions(actor, rollData);
const html = await renderTemplate(dialogConfig.html, rollData); const html = await renderTemplate(dialogConfig.html, rollData);
let options = { classes: ["rdddialog"], width: 600, height: 'fit-content', 'z-index': 99999 }; let options = { classes: [ "rdd-roll-dialog"], width: 600, height: 'fit-content', 'z-index': 99999 };
if (dialogConfig.options) { if (dialogConfig.options) {
mergeObject(options, dialogConfig.options, { overwrite: true }) mergeObject(options, dialogConfig.options, { overwrite: true })
} }
return new RdDRoll(actor, rollData, html, options, actions, dialogConfig.close); return new RdDRoll(actor, rollData, html, options, actions);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -97,7 +90,6 @@ export class RdDRoll extends Dialog {
return facteurSign; return facteurSign;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static _ensureCorrectActions(actions) { static _ensureCorrectActions(actions) {
if (actions.length == 0) { if (actions.length == 0) {
@ -111,13 +103,13 @@ export class RdDRoll extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(actor, rollData, html, options, actions, close = undefined) { constructor(actor, rollData, html, options, actions) {
let conf = { let conf = {
title: actions[0].label, title: actions[0].label,
content: html, content: html,
buttons: {}, buttons: {},
default: actions[0].name, default: actions[0].name,
close: close close: options.close
}; };
for (let action of actions) { for (let action of actions) {
conf.buttons[action.name] = { conf.buttons[action.name] = {
@ -136,7 +128,6 @@ export class RdDRoll extends Dialog {
close() { close() {
if (this.rollData.canClose) { if (this.rollData.canClose) {
this.actor.setRollWindowsOpened(false);
return super.close(); return super.close();
} }
ui.notifications.info("Vous devez faire ce jet de dés!"); ui.notifications.info("Vous devez faire ce jet de dés!");
@ -145,10 +136,9 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async onAction(action, html) { async onAction(action, html) {
this.rollData.forceDiceResult = Number.parseInt($('#force-dice-result').val()) ?? -1; this.rollData.forceDiceResult = Number.parseInt(html.find("[name='force-dice-result']").val()) ?? -1;
await RdDResolutionTable.rollData(this.rollData); await RdDResolutionTable.rollData(this.rollData);
console.log("RdDRoll -=>", this.rollData, this.rollData.rolled); console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
this.actor.setRollWindowsOpened(false);
if (action.callbacks) if (action.callbacks)
for (let callback of action.callbacks) { for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) { if (callback.condition == undefined || callback.condition(this.rollData)) {
@ -173,90 +163,90 @@ export class RdDRoll extends Dialog {
const defaut_carac = rollData.competence.system.defaut_carac const defaut_carac = rollData.competence.system.defaut_carac
// Set the default carac from the competence item // Set the default carac from the competence item
rollData.selectedCarac = rollData.carac[defaut_carac]; rollData.selectedCarac = rollData.carac[defaut_carac];
$("#carac").val(defaut_carac); html.find("[name='carac']").val(defaut_carac);
} }
if (rollData.selectedSort) { if (rollData.selectedSort) {
dialog.setSelectedSort(rollData.selectedSort); dialog.setSelectedSort(rollData.selectedSort, html);
$(".draconic").val(rollData.selectedSort.system.listIndex); // Uniquement a la selection du sort, pour permettre de changer html.find(".draconic").val(rollData.selectedSort.system.listIndex); // Uniquement a la selection du sort, pour permettre de changer
} }
RdDItemSort.setCoutReveReel(rollData.selectedSort); RdDItemSort.setCoutReveReel(rollData.selectedSort);
$("#diffLibre").val(Misc.toInt(rollData.diffLibre)); html.find("[name='diffLibre']").val(Misc.toInt(rollData.diffLibre));
$("#diffConditions").val(Misc.toInt(rollData.diffConditions)); html.find("[name='diffConditions']").val(Misc.toInt(rollData.diffConditions));
dialog.updateRollResult(); dialog.updateRollResult(html);
} }
// Setup everything onload // Setup everything onload
$(function () { onLoad(); }); $(function () { onLoad(); });
// Update ! // Update !
html.find('#diffLibre').change((event) => { html.find("[name='diffLibre']").change((event) => {
this.rollData.diffLibre = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus this.rollData.diffLibre = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('#diffConditions').change((event) => { html.find("[name='diffConditions']").change((event) => {
this.rollData.diffConditions = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus this.rollData.diffConditions = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('#force-dice-result').change((event) => { html.find("[name='force-dice-result']").change((event) => {
this.rollData.forceDiceResult = Misc.toInt(event.currentTarget.value); this.rollData.forceDiceResult = Misc.toInt(event.currentTarget.value);
}); });
html.find('#carac').change((event) => { html.find("[name='carac']").change((event) => {
let caracKey = event.currentTarget.value; let caracKey = event.currentTarget.value;
this.rollData.selectedCarac = this.rollData.carac[caracKey]; // Update the selectedCarac this.rollData.selectedCarac = this.rollData.carac[caracKey]; // Update the selectedCarac
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.roll-draconic').change((event) => { html.find('.roll-draconic').change((event) => {
let draconicKey = Misc.toInt(event.currentTarget.value); let draconicKey = Misc.toInt(event.currentTarget.value);
this.rollData.competence = this.rollData.draconicList[draconicKey]; // Update the selectedCarac this.rollData.competence = this.rollData.draconicList[draconicKey]; // Update the selectedCarac
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.roll-sort').change((event) => { html.find('.roll-sort').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value); let sortKey = Misc.toInt(event.currentTarget.value);
this.setSelectedSort(this.rollData.sortList[sortKey]); this.setSelectedSort(this.rollData.sortList[sortKey], html);
this.updateRollResult(); this.updateRollResult(html);
$("#diffLibre").val(this.rollData.diffLibre); html.find("[name='diffLibre']").val(this.rollData.diffLibre);
}); });
html.find('.roll-carac-competence').change((event) => { html.find('.roll-carac-competence').change((event) => {
const competence = event.currentTarget.value; const competence = event.currentTarget.value;
this.rollData.competence = this.rollData.competences.find(it => it.name == competence); this.rollData.competence = this.rollData.competences.find(it => it.name == competence);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.roll-signedraconique').change((event) => { html.find('.roll-signedraconique').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value); let sortKey = Misc.toInt(event.currentTarget.value);
this.setSelectedSigneDraconique(this.rollData.signes[sortKey]); this.setSelectedSigneDraconique(this.rollData.signes[sortKey]);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('#ptreve-variable').change((event) => { html.find("[name='ptreve-variable']").change((event) => {
let ptreve = Misc.toInt(event.currentTarget.value); let ptreve = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort.system.ptreve_reel = ptreve; this.rollData.selectedSort.system.ptreve_reel = ptreve;
console.log("RdDRollSelectDialog - Cout reve", ptreve); console.log("RdDRollSelectDialog - Cout reve", ptreve);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find("[name='coupsNonMortels']").change((event) => { html.find("[name='coupsNonMortels']").change((event) => {
this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel"; this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel";
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.cuisine-proportions').change((event) => { html.find('.cuisine-proportions').change((event) => {
this.rollData.proportions = Number(event.currentTarget.value); this.rollData.proportions = Number(event.currentTarget.value);
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.select-by-name').change((event) => { html.find('.select-by-name').change((event) => {
const attribute = event.currentTarget.attributes['name'].value; const attribute = event.currentTarget.attributes['name'].value;
this.rollData[attribute] = event.currentTarget.value; this.rollData[attribute] = event.currentTarget.value;
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.checkbox-by-name').change((event) => { html.find('.checkbox-by-name').change((event) => {
const attribute = event.currentTarget.attributes['name'].value; const attribute = event.currentTarget.attributes['name'].value;
this.rollData[attribute] = event.currentTarget.checked; this.rollData[attribute] = event.currentTarget.checked;
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('input.use-encTotal').change((event) => { html.find('input.use-encTotal').change((event) => {
this.rollData.use.encTotal = event.currentTarget.checked; this.rollData.use.encTotal = event.currentTarget.checked;
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('input.use-surenc').change((event) => { html.find('input.use-surenc').change((event) => {
this.rollData.use.surenc = event.currentTarget.checked; this.rollData.use.surenc = event.currentTarget.checked;
this.updateRollResult(); this.updateRollResult(html);
}); });
html.find('.appel-moral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */ html.find('.appel-moral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */
this.rollData.use.moral = !this.rollData.use.moral; this.rollData.use.moral = !this.rollData.use.moral;
@ -274,38 +264,38 @@ export class RdDRoll extends Dialog {
tooltip.innerHTML = "Sans appel au moral"; tooltip.innerHTML = "Sans appel au moral";
appelMoral.src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg"; appelMoral.src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg";
} }
this.updateRollResult(); this.updateRollResult(html);
}); });
// Section Méditation // Section Méditation
html.find('.conditionMeditation').change((event) => { html.find('.conditionMeditation').change((event) => {
let condition = event.currentTarget.attributes['id'].value; let condition = event.currentTarget.attributes['name'].value;
this.rollData.conditionMeditation[condition] = event.currentTarget.checked; this.rollData.conditionMeditation[condition] = event.currentTarget.checked;
this.updateRollResult(); this.updateRollResult(html);
}); });
} }
async setSelectedSort(sort) { async setSelectedSort(sort, html) {
this.rollData.selectedSort = sort; // Update the selectedCarac this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic); this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord); this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7); this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort); RdDItemSort.setCoutReveReel(sort);
const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort }); const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort });
$(".sort-ou-rituel").text(sort.system.isrituel ? "rituel" : "sort"); html.find(".sort-ou-rituel").text(sort.system.isrituel ? "rituel" : "sort");
$(".bonus-case").text(`${this.rollData.bonus}%`); html.find(".bonus-case").text(`${this.rollData.bonus}%`);
$(".details-sort").remove(); html.find(".details-sort").remove();
$(".description-sort").append(htmlSortDescription); html.find(".description-sort").append(htmlSortDescription);
$(".roll-draconic").val(sort.system.listIndex); html.find(".roll-draconic").val(sort.system.listIndex);
$(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.system.difficulte)); html.find(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.system.difficulte));
$(".div-sort-ptreve-fixe").text(sort.system.ptreve); html.find(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(sort); const diffVariable = RdDItemSort.isDifficulteVariable(sort);
const coutVariable = RdDItemSort.isCoutVariable(sort); const coutVariable = RdDItemSort.isCoutVariable(sort);
HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel); HtmlUtility._showControlWhen(html.find(".div-sort-non-rituel"), !sort.system.isrituel);
HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable); HtmlUtility._showControlWhen(html.find(".div-sort-difficulte-var"), diffVariable);
HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable); HtmlUtility._showControlWhen(html.find(".div-sort-difficulte-fixe"), !diffVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable); HtmlUtility._showControlWhen(html.find(".div-sort-ptreve-var"), coutVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-fixe"), !coutVariable); HtmlUtility._showControlWhen(html.find(".div-sort-ptreve-fixe"), !coutVariable);
} }
async setSelectedSigneDraconique(signe){ async setSelectedSigneDraconique(signe){
@ -315,7 +305,7 @@ export class RdDRoll extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateRollResult() { async updateRollResult(html) {
let rollData = this.rollData; let rollData = this.rollData;
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat()) rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat())
@ -333,31 +323,27 @@ export class RdDRoll extends Dialog {
RollDataAjustements.calcul(rollData, this.actor); RollDataAjustements.calcul(rollData, this.actor);
rollData.finalLevel = this._computeFinalLevel(rollData); rollData.finalLevel = this._computeFinalLevel(rollData);
const resolutionTable = await RdDResolutionTable.buildHTMLTable(RdDResolutionTable.subTable(rollData.caracValue, rollData.finalLevel))
const adjustements = await this.buildAjustements(rollData);
HtmlUtility._showControlWhen($(".use-encTotal"), rollData.ajustements.encTotal.visible && RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac)); HtmlUtility._showControlWhen($(".use-encTotal"), rollData.ajustements.encTotal.visible && RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac));
HtmlUtility._showControlWhen($(".use-surenc"), rollData.ajustements.surenc.visible && RdDCarac.isActionPhysique(rollData.selectedCarac)); HtmlUtility._showControlWhen($(".use-surenc"), rollData.ajustements.surenc.visible && RdDCarac.isActionPhysique(rollData.selectedCarac));
HtmlUtility._showControlWhen($(".utilisation-moral"), rollData.use.appelAuMoral); HtmlUtility._showControlWhen($(".utilisation-moral"), rollData.use.appelAuMoral);
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral); HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral);
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData));
HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData));
// Mise à jour valeurs // Mise à jour valeurs
$(".dialog-roll-title").text(this._getTitle(rollData)); html.find(".dialog-roll-title").text(this._getTitle(rollData));
$("[name='coupsNonMortels']").prop('checked', rollData.mortalite == 'non-mortel'); html.find("[name='coupsNonMortels']").prop('checked', rollData.mortalite == 'non-mortel');
$(".dmg-arme-actor").text(dmgText); html.find(".dmg-arme-actor").text(dmgText);
$('.table-ajustement').remove(); html.find("div.placeholder-ajustements").empty().append(adjustements);
$(".table-resolution").remove(); html.find("div.placeholder-resolution").empty().append(resolutionTable)
$(".table-proba-reussite").remove();
$("#tableAjustements").append(await this.buildAjustements(rollData));
$("#tableResolution").append(RdDResolutionTable.buildHTMLTableExtract(rollData.caracValue, rollData.finalLevel));
$("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel));
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async buildAjustements(rollData) { async buildAjustements(rollData) {
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html`, rollData); return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html`, rollData);
return html;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -375,23 +361,11 @@ export class RdDRoll extends Dialog {
return 0; return 0;
} }
/* -------------------------------------------- */
_computeDiffLibre(rollData) {
let diffLibre = Misc.toInt(rollData.diffLibre);
if (rollData.draconicList && rollData.selectedSort) {
return RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre);
}
return diffLibre;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeMalusArmure(rollData) { _computeMalusArmure(rollData) {
let malusArmureValue = 0; let malusArmureValue = 0;
if (rollData.malusArmureValue && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) { if (rollData.malusArmureValue && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) {
$("#addon-message").text("Malus armure appliqué : " + rollData.malusArmureValue);
malusArmureValue = rollData.malusArmureValue; malusArmureValue = rollData.malusArmureValue;
} else {
$("#addon-message").text("");
} }
return malusArmureValue; return malusArmureValue;
} }

View File

@ -15,6 +15,7 @@ import { RdDConfirm } from "./rdd-confirm.js";
import { RdDCalendrier } from "./rdd-calendrier.js"; import { RdDCalendrier } from "./rdd-calendrier.js";
import { Environnement } from "./environnement.js"; import { Environnement } from "./environnement.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// This table starts at 0 -> niveau -10 // This table starts at 0 -> niveau -10
@ -237,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/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',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
@ -282,6 +284,8 @@ export class RdDUtility {
]; ];
Handlebars.registerHelper('either', (a, b) => a ?? b); Handlebars.registerHelper('either', (a, b) => a ?? b);
Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col));
Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col));
Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null')); Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null'));
Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null')); Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null'));
Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL'); Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL');

View File

@ -618,7 +618,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
opacity: 0.7 ; opacity: 0.7 ;
} }
.rdddialog .dialog-roll-sort { .rdd-roll-dialog .dialog-roll-sort {
width: 600px; width: 600px;
height: 430px; height: 430px;
z-index: 9999; z-index: 9999;
@ -659,6 +659,10 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
text-align: right; text-align: right;
} }
.placeholder-ajustements {
flex-direction: column;
}
.table-resolution-carac { .table-resolution-carac {
background-color: yellow; background-color: yellow;
} }
@ -668,7 +672,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
background-color: lightblue; background-color: lightblue;
} }
#tableProbaReussite{ div.placeholder-resolution span.table-proba-reussite{
font-size: 0.8rem; font-size: 0.8rem;
padding: 5px; padding: 5px;
} }

View File

@ -23,7 +23,7 @@
<span class="tooltiptext ttt-fatigue">{{{calc.fatigue.html}}}</span> <span class="tooltiptext ttt-fatigue">{{{calc.fatigue.html}}}</span>
Fatigue Fatigue
<a class="fatigue-moins"><i class="fas fa-minus-square"></i></a> <a class="fatigue-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="fatigue-value" type="text" name="system.sante.fatigue.value" value="{{system.sante.fatigue.value}}" data-dtype="Number" /> <input class="resource-content" type="text" name="system.sante.fatigue.value" value="{{system.sante.fatigue.value}}" data-dtype="Number" />
<span>/ {{system.sante.fatigue.max}}</span> <span>/ {{system.sante.fatigue.max}}</span>
<a class="fatigue-plus"><i class="fas fa-plus-square"></i></a> <a class="fatigue-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>
@ -32,7 +32,7 @@
<label class="compteur"> <label class="compteur">
<span class="ptreve-actuel"><a>Rêve</a></span> <span class="ptreve-actuel"><a>Rêve</a></span>
<a class="ptreve-actuel-moins"><i class="fas fa-minus-square"></i></a> <a class="ptreve-actuel-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="pointsreve-value" type="text" name="system.reve.reve.value" value="{{system.reve.reve.value}}" data-dtype="Number" /> <input class="resource-content" class="pointsreve-value" type="text" name="system.reve.reve.value" value="{{system.reve.reve.value}}" data-dtype="Number" />
<span>/ {{system.reve.seuil.value}}</span> <span>/ {{system.reve.seuil.value}}</span>
<a class="ptreve-actuel-plus"><i class="fas fa-plus-square"></i></a> <a class="ptreve-actuel-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>

View File

@ -6,7 +6,7 @@
</header> </header>
<label>&nbsp;&nbsp;Conditions</label> <label>&nbsp;&nbsp;Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="Number"> <select name="diffConditions" data-dtype="Number">
{{#select diffConditions}} {{#select diffConditions}}
{{#each ajustementsConditions as |key|}} {{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -5,7 +5,7 @@
<div class="form-group"> <div class="form-group">
<label>Nombre de brins</label> <label>Nombre de brins</label>
<select name="nbBrins" id="nbBrins" data-dtype="number"> <select name="nbBrins" data-dtype="number">
{{#select nbBrins}} {{#select nbBrins}}
{{{nbBrinsSelect}}} {{{nbBrinsSelect}}}
{{/select}} {{/select}}

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<div> <div>
<div class="flexrow flex-center"> <div class="flexrow flex-center">
<div> <div>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" /> <img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4> <h4>{{item.name}}</h4>
<div class="flexrow"> <div class="flexrow">

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" /> <img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4> <h4>{{item.name}}</h4>
<label>Quantité totale : {{item.system.quantite}}</label> <label>Quantité totale : {{item.system.quantite}}</label>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" /> <img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4> <h4>{{item.name}}</h4>
<div class="flexcol"> <div class="flexcol">

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Fabrication: {{recette.name}}</h2> <h2>Fabrication: {{recette.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left"> <div class="flex-group-left">
@ -20,12 +20,12 @@
{{/if}} {{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution">
<div id="tableProbaReussite"></div> </div>
</form> </form>
<script> <script>

View File

@ -14,12 +14,10 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div class="placeholder-resolution"></div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Chanter: {{oeuvre.name}}</h2> <h2>Chanter: {{oeuvre.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -15,12 +15,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -41,7 +41,7 @@
{{/if}} {{/if}}
{{#if ajustements.attaqueDefenseurSurpris.used}} {{#if ajustements.attaqueDefenseurSurpris.used}}
<div class="flexrow"> <div class="flexrow">
<label id="defenseur-surprise">{{ajustements.attaqueDefenseurSurpris.label}}</label> <label>{{ajustements.attaqueDefenseurSurpris.label}}</label>
</div> </div>
{{/if}} {{/if}}
@ -75,12 +75,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Boire</h2> <h2>Boire</h2>
<img class="chat-icon" src="systems/foundryvtt-reve-de-dragon/icons/objets/chope_gres.webp" alt="Chope d'alcool"/> <img class="chat-icon" src="systems/foundryvtt-reve-de-dragon/icons/objets/chope_gres.webp" alt="Chope d'alcool"/>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -6,14 +6,14 @@
<label>Etat général</label><label class="flexrow">{{etat}}</label> <label>Etat général</label><label class="flexrow">{{etat}}</label>
<label>Déjà bu</label><label class="flexrow">{{diffNbDoses}}</label> <label>Déjà bu</label><label class="flexrow">{{diffNbDoses}}</label>
<label>Force du breuvage</label> <label>Force du breuvage</label>
<select name="forceAlcool" id="forceAlcool" data-dtype="number"> <select class="force-alcool" data-dtype="number">
{{#select forceAlcool}} {{#select forceAlcool}}
{{#each ajustementsForce as |key|}} {{#each ajustementsForce as |key|}}
<option value={{key}}>{{key}}</option> <option value={{key}}>{{key}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}
</select> </select>
<label>Ajustement final</label><label id="roll-param">10 / 0</label> <label>Ajustement final</label><label class="roll-ethylisme">10 / 0</label>
</div> </div>
</form> </form>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Jouer à : {{oeuvre.name}}</h2> <h2>Jouer à : {{oeuvre.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -16,13 +16,12 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -17,12 +17,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -20,29 +20,28 @@
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Comportement antérieur : {{upperFirst meditation.system.comportement}}</label> <label>Comportement antérieur : {{upperFirst meditation.system.comportement}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" name="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Heure : {{upperFirst meditation.system.heure}}</label> <label>Heure : {{upperFirst meditation.system.heure}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" name="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Purification : {{upperFirst meditation.system.purification}}</label> <label>Purification : {{upperFirst meditation.system.purification}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" name="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Vêture : {{upperFirst meditation.system.veture}}</label> <label>Vêture : {{upperFirst meditation.system.veture}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" name="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} />
</div> </div>
<hr> <hr>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements"></div> <div class="placeholder-ajustements"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Interpréter la mélodie: {{oeuvre.name}}</h2> <h2>Interpréter la mélodie: {{oeuvre.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -15,12 +15,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Interpréter une Œuvre: {{oeuvre.name}}</h2> <h2>Interpréter une Œuvre: {{oeuvre.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog"> <form class="rdd-roll-dialog">
<h2>Cuisiner: {{oeuvre.name}}</h2> <h2>Cuisiner: {{oeuvre.name}}</h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
@ -29,12 +29,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -6,8 +6,7 @@
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
<button id="lancer" type="button">Lancer les dés</button> <button class="lancer-table-resolution" type="button">Lancer les dés</button>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>

View File

@ -12,12 +12,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -33,12 +33,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -21,7 +21,7 @@
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label for="ptreve-variable">Points de Rêve: </label> <label for="ptreve-variable">Points de Rêve: </label>
<select name="ptreve-variable" class="div-sort-ptreve-var" id="ptreve-variable" data-dtype="number"> <select name="ptreve-variable" class="div-sort-ptreve-var" data-dtype="number">
{{#select ptreve-variable}} {{#select ptreve-variable}}
{{#each coutreve as |cout key|}} {{#each coutreve as |cout key|}}
<option value={{cout}}>{{cout}}</option> <option value={{cout}}>{{cout}}</option>
@ -49,7 +49,7 @@
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label for="diffLibre">Difficulté</label> <label for="diffLibre">Difficulté</label>
<select name="diffLibre" class="div-sort-difficulte-var" id="diffLibre" data-dtype="number"> <select name="diffLibre" class="div-sort-difficulte-var" data-dtype="number">
{{#select diffLibre}} {{#select diffLibre}}
{{#each difficultesLibres as |key|}} {{#each difficultesLibres as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
@ -64,7 +64,7 @@
<label for="bonus-case">Bonus de case </label> <label for="bonus-case">Bonus de case </label>
<label name="bonus-case" class="bonus-case">0%</label> <label name="bonus-case" class="bonus-case">0%</label>
</div> </div>
<div id="tableAjustements" class="flexrow"></div> <div class="placeholder-ajustements" class="flexrow"></div>
</div> </div>
</div> </div>
<div class="description-sort"> <div class="description-sort">
@ -72,8 +72,7 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html" sort=selectedSort}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html" sort=selectedSort}}
</div> </div>
<div id="tableResolution"></div> <div class="placeholder-resolution"></div>
<div id="tableProbaReussite"></div>
</form> </form>
<script> <script>

View File

@ -4,7 +4,7 @@
<section class="sheet-body"> <section class="sheet-body">
<div class="form-group"> <div class="form-group">
<label for="xp">Caractéristique</label> <label for="xp">Caractéristique</label>
<select name="system.carac" id="caracselect" data-dtype="String"> <select name="system.carac" data-dtype="String">
{{#select system.carac}} {{#select system.carac}}
{{#each caracList as |carac key|}} {{#each caracList as |carac key|}}
<option value="{{key}}">{{carac.label}}</option> <option value="{{key}}">{{carac.label}}</option>
@ -14,7 +14,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String"> <select name="system.competence" data-dtype="String">
{{#select system.competence}} {{#select system.competence}}
<option value="">Sans compétence</option> <option value="">Sans compétence</option>
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}}

View File

@ -1,7 +1,7 @@
<div class="table-ajustement"> <div class="table-ajustement">
<span class="tooltip tooltip-dotted"> <span class="tooltip tooltip-dotted">
<span>Ajustement Final:</span> <span>Ajustement Final:</span>
<span id="roll-param">{{selectedCarac.value}} / {{numberFormat finalLevel decimals=0 sign=true}}</span> <span class="roll-param-resolution">{{selectedCarac.value}} / {{numberFormat finalLevel decimals=0 sign=true}}</span>
<div class="tooltiptext ttt-ajustements"> <div class="tooltiptext ttt-ajustements">
{{#each ajustements as |item key|}} {{#each ajustements as |item key|}}
{{#if item.used}} {{#if item.used}}

View File

@ -1,6 +1,6 @@
<div class="flexrow"> <div class="flexrow">
<label for="diffConditions">Conditions</label> <label for="diffConditions">Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="number" {{#unless use.conditions}}disabled{{/unless}}> <select name="diffConditions" data-dtype="number" {{#unless use.conditions}}disabled{{/unless}}>
{{#select diffConditions}} {{#select diffConditions}}
{{#each ajustementsConditions as |key|}} {{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -1,6 +1,6 @@
<div class="flexrow"> <div class="flexrow">
<label for="diffLibre">Difficulté choisie</label> <label for="diffLibre">Difficulté choisie</label>
<select name="diffLibre" id="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}> <select name="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}>
{{#select diffLibre}} {{#select diffLibre}}
{{#each difficultesLibres as |key|}} {{#each difficultesLibres as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -1,6 +1,6 @@
{{#if isGM}} {{#if isGM}}
<div class="flexrow"> <div class="flexrow">
<label for="force-dice-result">Résultat du dé</label> <label for="force-dice-result">Résultat du dé</label>
<input name='force-dice-result' id='force-dice-result' value='{{forceDiceResult}}'> <input name='force-dice-result' value='{{forceDiceResult}}'>
</div> </div>
{{/if}} {{/if}}

View File

@ -1,4 +1,4 @@
<select name="carac" id="carac" class="flex-grow select-carac" data-dtype="String"> <select name="carac" class="flex-grow" data-dtype="String">
{{#select carac}} {{#select carac}}
{{#each carac as |caracitem key|}} {{#each carac as |caracitem key|}}
<option value={{key}}>{{caracitem.label}}</option> <option value={{key}}>{{caracitem.label}}</option>

View File

@ -0,0 +1,44 @@
<table class='table-resolution'>
<tr>
{{#if (gt min -8)}}
<th class="table-resolution-level">-8</th>
{{/if}}
{{#if (gt min -7)}}
<th class="table-resolution-level">...</th>
{{/if}}
{{#each cols as |col|}}
<th class="table-resolution-level">{{numberFormat col decimals=0 sign=true}}</th>
{{/each}}
</tr>
{{#each rows as |row|}}
<tr>
{{#if (gt @root.min -8)}}
<td class="table-resolution-carac" data-row="{{row}}" data-col="{{col}}">{{computeResolutionScore row -8}}</td>
{{/if}}
{{#if (gt @root.min -7)}}
<td class=""></td>
{{/if}}
{{#each @root.cols as |col|}}
{{#if (and (eq row @root.carac) (eq col @root.difficulte))}}
<td class="table-resolution-target">{{computeResolutionScore row col}}</td>
{{else if (eq col -8)}}
<td class="table-resolution-carac">{{computeResolutionScore row col}}</td>
{{else}}
<td>{{computeResolutionScore row col}}</td>
{{/if}}
</td>
{{/each}}
</tr>
{{/each}}
</table>
{{#with (computeResolutionChances carac difficulte) as |cell|}}
<div>
<span class="table-proba-reussite">
Particulière: <span class="rdd-roll-part">{{cell.part}}</span>
- Significative: <span class="rdd-roll-sign">{{cell.sign}}</span>
- Réussite: <span class="rdd-roll-norm">{{cell.score}}</span>
- Echec Particulier: <span class="rdd-roll-epart">{{cell.epart}}</span>
- Echec Total: <span class="rdd-roll-etotal">{{cell.etotal}}</span>
</span>
</div>
{{/with}}