Merge branch 'master-rappel-regles' into 'master'

Amélioration, rappel-des-regles

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!215
This commit is contained in:
Leratier Bretonnien 2021-04-27 07:34:02 +00:00
commit 5443cb52bb
3 changed files with 20 additions and 9 deletions

View File

@ -50,7 +50,7 @@ const poesieHautReve = [
},
{
reference: 'Denis Gerfaud',
extrait: `Ainsi se cuccèdent les Jours et les Ages.
extrait: `Ainsi se succèdent les Jours et les Ages.
<br>Les jours des Dragons sont les Ages des Hommes.`
},
{

View File

@ -165,7 +165,8 @@ export class RdDResolutionTable {
if (difficulte < -10) {
return duplicate(levelDown.find(levelData => levelData.level == difficulte));
}
return duplicate(RdDResolutionTable.resolutionTable[caracValue][difficulte + 10]);
const chances = RdDResolutionTable.resolutionTable[caracValue][difficulte + 10];
return chances ? duplicate(chances) : RdDResolutionTable._computeCell(difficulte, RdDResolutionTable.computeChances(caracValue, difficulte));
}
/* -------------------------------------------- */
@ -224,16 +225,26 @@ export class RdDResolutionTable {
/* -------------------------------------------- */
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));
let dataRow = [];
for (var diff = -10; diff <= 22; diff++) {
dataRow[diff + 10] = this._computeCell(diff, RdDResolutionTable._computePercentage(caracValue, diff));
}
return dataRow;
}
static _computePercentage(caracValue, diff) {
if (diff <-10) {
return 1;
}
if (diff == -10){
return Math.max(Math.floor(caracValue / 4), 1);
}
if (diff == -9) {
return Math.max(Math.floor(caracValue / 2), 1)
}
return Math.max(Math.floor(caracValue * (diff + 10) / 2), 1);
}
/* -------------------------------------------- */
static _computeCell(niveau, percentage) {
return {

File diff suppressed because one or more lines are too long