diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index f49b4748..a2427989 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -151,6 +151,10 @@ export class RdDResolutionTable { } /* -------------------------------------------- */ + static buildHTMLTableExtract(caracValue, levelValue) { + return this.buildHTMLTable(caracValue, levelValue, caracValue - 2, caracValue + 2, levelValue - 5, levelValue + 5) + } + static buildHTMLTable(caracValue, levelValue, minCarac = 1, maxCarac = 21, minLevel = -10, maxLevel = 11) { return this._buildHTMLTable(caracValue, levelValue, minCarac, maxCarac, minLevel, maxLevel) } @@ -162,7 +166,7 @@ export class RdDResolutionTable { minLevel = Math.max(minLevel, -10); maxLevel = Math.min(maxLevel, 22); - var table = $("") + let table = $("
") .append(this._buildHTMLHeader(this.resolutionTable[0], minLevel, maxLevel)); for (var carac = minCarac; carac <= maxCarac; carac++) { @@ -172,8 +176,16 @@ export class RdDResolutionTable { } static _buildHTMLHeader(dataRow, minLevel, maxLevel) { - var tr = $(""); - for (var difficulte = minLevel; difficulte <= maxLevel; difficulte++) { + let tr = $(""); + let max = maxLevel; + + if (minLevel > -8) { + tr.append($(""); - for (var difficulte = minLevel; difficulte <= maxLevel; difficulte++) { - var td = $(""); + let max = maxLevel; + + if (minLevel > -8) { + let score = dataRow[-8 + 10].score; + tr.append($("
").text("-8")) + } + if (minLevel > -7) { + tr.append($("").text("...")); + } + for (let difficulte = minLevel; difficulte <= max; difficulte++) { const niveau = dataRow[difficulte + 10].niveau; const txt = (niveau > 0 ? "+" : "") + niveau; tr.append($("").text(txt)); @@ -182,9 +194,18 @@ export class RdDResolutionTable { } static _buildHTMLRow(dataRow, rowIndex, caracValue, levelValue, minLevel, maxLevel) { - var tr = $("
"); + let tr = $("
").text(score)) + } + if (minLevel > -7) { + tr.append($("")) + } + for (let difficulte = minLevel; difficulte <= max; difficulte++) { + let td = $(""); let score = dataRow[difficulte + 10].score; if (rowIndex == caracValue && levelValue == difficulte) { td.addClass('table-resolution-target'); diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index d6dc14dc..a14ecec3 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -71,7 +71,7 @@ export class RdDRollDialog extends Dialog { $("#roll-param").text(rollData.selectedCarac.value + " / " + rollData.finalLevelStr); $("#compdialogTitle").text(RdDRollDialog._getTitle(rollData)); $(".table-resolution").remove(); - $("#resolutionTable").append(RdDResolutionTable.buildHTMLTable(caracValue, rollLevel, caracValue - 2, caracValue + 2)); + $("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel)); } // Setup everything onload @@ -91,25 +91,25 @@ export class RdDRollDialog extends Dialog { // Update ! html.find('#bonusmalus').click((event) => { rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus - console.debug("RdDRollDialog","BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) ); + console.debug("RdDRollDialog","BM CLICKED !!!", rollData); updateRollResult(rollData); }); html.find('#carac').click((event) => { let caracKey = event.currentTarget.value; rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac - console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue); + console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData); updateRollResult(rollData); }); html.find('#draconic').click((event) => { let draconicKey = event.currentTarget.value; rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac - console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue); + console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData); updateRollResult(rollData); }); html.find('#sort').click((event) => { let sortKey = event.currentTarget.value; rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac - console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue); + console.debug("RdDRollDialog","CARAC CLICKED !!!", rollData); updateRollResult(rollData); }); diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 255fa290..e2f27793 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -138,7 +138,7 @@ export class RdDTMRDialog extends Dialog { const roll = RdDResolutionTable.roll(carac, difficulte); - if ( roll.roll > scoreDef.score ) { + if ( !roll.isSuccess) { TMRUtility.processRencontreEchec( this.actor, this.currentRencontre); ChatMessage.create( { title: "TMR", content: "Vous avez échoué à votre maîtrise d'un " . this.currentRencontre.name + " de force " + this.currentRencontre.force +