diff --git a/module/actor.js b/module/actor.js index 53ac2d52..5f7cc623 100644 --- a/module/actor.js +++ b/module/actor.js @@ -127,7 +127,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async performRoll(rollData) { - let rolled = await RdDResolutionTable.roll(rollData.carac, rollData.finalLevel); + let rolled = await RdDResolutionTable.roll(rollData.caracValue, rollData.finalLevel); //rolled.isPart = true; // Pour tester le particulières rollData.rolled = rolled; // garder le résultat console.log("performRoll", rollData, rolled) @@ -973,7 +973,7 @@ export class RdDActor extends Actor { { let carac; if ( caracName == "reveActuel") { // Fake carac for Reve Actuel - carac = {type: "number", + carac = {type: "number", value: this.getReveActuel(), label: "Rêve Actuel" } diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 7e769c01..7af9777c 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -61,8 +61,8 @@ export class RdDResolutionTable { /* -------------------------------------------- */ static build() { let table = [] - for (var carac = 0; carac <= 30; carac++) { - table[carac] = this._computeRow(carac); + for (var caracValue = 0; caracValue <= 60; caracValue++) { + table[caracValue] = this._computeRow(caracValue); } return table; } @@ -78,18 +78,18 @@ export class RdDResolutionTable { static explain(rolled) { let message = "
Jet : " + rolled.roll + " sur " + rolled.score + "%"; - if (rolled.carac != null && rolled.finalLevel!= null) { - message += " (" + rolled.carac + " à " + Misc.toSignedString(rolled.finalLevel) + ")"; + if (rolled.caracValue != null && rolled.finalLevel!= null) { + message += " (" + rolled.caracValue + " à " + Misc.toSignedString(rolled.finalLevel) + ")"; } return message; } /* -------------------------------------------- */ - static async roll(carac, finalLevel) { - let chances = this.computeChances(carac, finalLevel); + static async roll(caracValue, finalLevel) { + let chances = this.computeChances(caracValue, finalLevel); chances.showDice = true; let rolled = await this.rollChances(chances); - rolled.carac = carac; + rolled.caracValue = caracValue; rolled.finalLevel = finalLevel; return rolled; } @@ -105,14 +105,14 @@ export class RdDResolutionTable { } /* -------------------------------------------- */ - static computeChances(carac, difficulte) { + static computeChances(caracValue, difficulte) { if (difficulte < -16) { return duplicate(levelImpossible); } if (difficulte < -10) { return duplicate(levelDown.find(levelData => levelData.level == difficulte)); } - return duplicate(this.resolutionTable[carac][difficulte + 10]); + return duplicate(this.resolutionTable[caracValue][difficulte + 10]); } /* -------------------------------------------- */ @@ -142,13 +142,13 @@ export class RdDResolutionTable { } /* -------------------------------------------- */ - static _computeRow(carac) { + static _computeRow(caracValue) { let dataRow = [ - this._computeCell(-10, Math.max(Math.floor(carac / 4), 1)), - this._computeCell(-9, Math.max(Math.floor(carac / 2), 1)) + 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(carac * (diff + 10) / 2), 1)); + dataRow[diff + 10] = this._computeCell(diff, Math.max(Math.floor(caracValue * (diff + 10) / 2), 1)); } return dataRow; } @@ -205,8 +205,8 @@ export class RdDResolutionTable { let table = $("") .append(this._buildHTMLHeader(this.resolutionTable[0], minLevel, maxLevel)); - for (var carac = minCarac; carac <= maxCarac; carac++) { - table.append(this._buildHTMLRow(this.resolutionTable[carac], carac, caracValue, levelValue, minLevel, maxLevel)); + for (var caracValue = minCarac; caracValue <= maxCarac; caracValue++) { + table.append(this._buildHTMLRow(this.resolutionTable[caracValue], caracValue, caracValue, levelValue, minLevel, maxLevel)); } return table; } diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index 60cb82a3..057d60db 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -67,7 +67,7 @@ export class RdDRollDialog extends Dialog { let rollLevel = RdDRollDialog._computeFinalLevel(rollData); rollData.finalLevel = rollLevel; - rollData.carac = rollData.selectedCarac.value + rollData.caracValue = caracValue // Sort management if ( rollData.selectedSort ) {