forked from public/foundryvtt-reve-de-dragon
Merge branch 'v1.4' of https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon into v1.4
This commit is contained in:
@ -6,6 +6,7 @@ import { Misc } from "./misc.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
import { DialogItemAchat } from "./dialog-item-achat.js";
|
||||
import { ReglesOptionelles } from "./regles-optionelles.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// This table starts at 0 -> niveau -10
|
||||
@ -389,6 +390,14 @@ export class RdDUtility {
|
||||
}
|
||||
return -7;
|
||||
}
|
||||
|
||||
static calculFatigueHtml(fatigue, endurance) {
|
||||
return ReglesOptionelles.isUsing("appliquer-fatigue") ? {
|
||||
malus: RdDUtility.calculMalusFatigue(fatigue, endurance),
|
||||
html: "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(fatigue, endurance).html() + "</table>"
|
||||
} : { malus:0, html:''};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Build the nice (?) html table used to manage fatigue.
|
||||
// max should be the endurance max value
|
||||
@ -476,18 +485,21 @@ export class RdDUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static currentFatigueMalus(value, max) {
|
||||
max = Math.max(1, Math.min(max, 60));
|
||||
value = Math.min(max * 2, Math.max(0, value));
|
||||
|
||||
let fatigueTab = fatigueMatrix[max];
|
||||
let fatigueRem = value;
|
||||
for (let idx = 0; idx < fatigueTab.length; idx++) {
|
||||
fatigueRem -= fatigueTab[idx];
|
||||
if (fatigueRem <= 0) {
|
||||
return fatigueMalus[idx];
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||
max = Math.max(1, Math.min(max, 60));
|
||||
value = Math.min(max * 2, Math.max(0, value));
|
||||
|
||||
let fatigueTab = fatigueMatrix[max];
|
||||
let fatigueRem = value;
|
||||
for (let idx = 0; idx < fatigueTab.length; idx++) {
|
||||
fatigueRem -= fatigueTab[idx];
|
||||
if (fatigueRem <= 0) {
|
||||
return fatigueMalus[idx];
|
||||
}
|
||||
}
|
||||
return -7; // This is the max !
|
||||
}
|
||||
return -7; // This is the max !
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user