forked from public/foundryvtt-reve-de-dragon
#51 Gestion des bonus de cases
This commit is contained in:
@ -76,6 +76,7 @@ export class RdDResolutionTable {
|
||||
return resultat;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static explain(rolled) {
|
||||
let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "%";
|
||||
if (rolled.caracValue != null && rolled.finalLevel!= null) {
|
||||
@ -84,19 +85,32 @@ export class RdDResolutionTable {
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async roll(caracValue, finalLevel) {
|
||||
static updateChancesWithBonus( chances, bonus ) {
|
||||
let newScore = Number(chances.score) + Number(bonus);
|
||||
chances.score = newScore;
|
||||
chances.sign = this._reussiteSignificative(newScore);
|
||||
chances.part = this._reussitePart(newScore);
|
||||
chances.epart = this._echecParticulier(newScore);
|
||||
chances.etotal = this._echecTotal(newScore);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async roll(caracValue, finalLevel, bonus = 0 ) {
|
||||
let chances = this.computeChances(caracValue, finalLevel);
|
||||
chances.showDice = true;
|
||||
this.updateChancesWithBonus( chances, bonus);
|
||||
let rolled = await this.rollChances(chances);
|
||||
rolled.caracValue = caracValue;
|
||||
rolled.finalLevel = finalLevel;
|
||||
rolled.bonus = bonus;
|
||||
return rolled;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollChances(chances) {
|
||||
let myRoll = new Roll("d100").roll();
|
||||
let myRoll = new Roll("1d100").roll();
|
||||
myRoll.showDice = chances.showDice;
|
||||
await RdDDice.show(myRoll);
|
||||
chances.roll = myRoll.total;
|
||||
@ -211,6 +225,7 @@ export class RdDResolutionTable {
|
||||
return table;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _buildHTMLHeader(dataRow, minLevel, maxLevel) {
|
||||
let tr = $("<tr/>");
|
||||
|
||||
@ -226,6 +241,7 @@ export class RdDResolutionTable {
|
||||
return tr;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _buildHTMLRow(dataRow, rowIndex, caracValue, levelValue, minLevel, maxLevel) {
|
||||
let tr = $("<tr/>");
|
||||
let max = maxLevel;
|
||||
|
Reference in New Issue
Block a user