Correction choix carac compétence
Distinction entre "carac" qui représente la liste des caractéristiques et "caracValue, la valeur selectionnée
This commit is contained in:
parent
544ad7982d
commit
5d04063579
@ -127,7 +127,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async performRoll(rollData) {
|
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
|
//rolled.isPart = true; // Pour tester le particulières
|
||||||
rollData.rolled = rolled; // garder le résultat
|
rollData.rolled = rolled; // garder le résultat
|
||||||
console.log("performRoll", rollData, rolled)
|
console.log("performRoll", rollData, rolled)
|
||||||
|
@ -61,8 +61,8 @@ export class RdDResolutionTable {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static build() {
|
static build() {
|
||||||
let table = []
|
let table = []
|
||||||
for (var carac = 0; carac <= 30; carac++) {
|
for (var caracValue = 0; caracValue <= 60; caracValue++) {
|
||||||
table[carac] = this._computeRow(carac);
|
table[caracValue] = this._computeRow(caracValue);
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
@ -78,18 +78,18 @@ export class RdDResolutionTable {
|
|||||||
|
|
||||||
static explain(rolled) {
|
static explain(rolled) {
|
||||||
let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "%";
|
let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "%";
|
||||||
if (rolled.carac != null && rolled.finalLevel!= null) {
|
if (rolled.caracValue != null && rolled.finalLevel!= null) {
|
||||||
message += " (" + rolled.carac + " à " + Misc.toSignedString(rolled.finalLevel) + ")";
|
message += " (" + rolled.caracValue + " à " + Misc.toSignedString(rolled.finalLevel) + ")";
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
|
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async roll(carac, finalLevel) {
|
static async roll(caracValue, finalLevel) {
|
||||||
let chances = this.computeChances(carac, finalLevel);
|
let chances = this.computeChances(caracValue, finalLevel);
|
||||||
chances.showDice = true;
|
chances.showDice = true;
|
||||||
let rolled = await this.rollChances(chances);
|
let rolled = await this.rollChances(chances);
|
||||||
rolled.carac = carac;
|
rolled.caracValue = caracValue;
|
||||||
rolled.finalLevel = finalLevel;
|
rolled.finalLevel = finalLevel;
|
||||||
return rolled;
|
return rolled;
|
||||||
}
|
}
|
||||||
@ -105,14 +105,14 @@ export class RdDResolutionTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static computeChances(carac, difficulte) {
|
static computeChances(caracValue, difficulte) {
|
||||||
if (difficulte < -16) {
|
if (difficulte < -16) {
|
||||||
return duplicate(levelImpossible);
|
return duplicate(levelImpossible);
|
||||||
}
|
}
|
||||||
if (difficulte < -10) {
|
if (difficulte < -10) {
|
||||||
return duplicate(levelDown.find(levelData => levelData.level == difficulte));
|
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 = [
|
let dataRow = [
|
||||||
this._computeCell(-10, Math.max(Math.floor(carac / 4), 1)),
|
this._computeCell(-10, Math.max(Math.floor(caracValue / 4), 1)),
|
||||||
this._computeCell(-9, Math.max(Math.floor(carac / 2), 1))
|
this._computeCell(-9, Math.max(Math.floor(caracValue / 2), 1))
|
||||||
]
|
]
|
||||||
for (var diff = -8; diff <= 22; diff++) {
|
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;
|
return dataRow;
|
||||||
}
|
}
|
||||||
@ -205,8 +205,8 @@ export class RdDResolutionTable {
|
|||||||
let table = $("<table class='table-resolution'/>")
|
let table = $("<table class='table-resolution'/>")
|
||||||
.append(this._buildHTMLHeader(this.resolutionTable[0], minLevel, maxLevel));
|
.append(this._buildHTMLHeader(this.resolutionTable[0], minLevel, maxLevel));
|
||||||
|
|
||||||
for (var carac = minCarac; carac <= maxCarac; carac++) {
|
for (var caracValue = minCarac; caracValue <= maxCarac; caracValue++) {
|
||||||
table.append(this._buildHTMLRow(this.resolutionTable[carac], carac, caracValue, levelValue, minLevel, maxLevel));
|
table.append(this._buildHTMLRow(this.resolutionTable[caracValue], caracValue, caracValue, levelValue, minLevel, maxLevel));
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
let rollLevel = RdDRollDialog._computeFinalLevel(rollData);
|
let rollLevel = RdDRollDialog._computeFinalLevel(rollData);
|
||||||
|
|
||||||
rollData.finalLevel = rollLevel;
|
rollData.finalLevel = rollLevel;
|
||||||
rollData.carac = rollData.selectedCarac.value
|
rollData.caracValue = caracValue
|
||||||
|
|
||||||
// Sort management
|
// Sort management
|
||||||
if ( rollData.selectedSort ) {
|
if ( rollData.selectedSort ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user