Separation difficulte libre/conditions

* ajout de diffConditions pour gérer l'ajustement de conditions
* renommage de bmValue en diffLibre
* calcul de l'ajustement (etat+conditions+difficulté libre)
* présentation des 2 champs

fix:
* utiliser .change() au lieu de .click() permet de supporter aussi
les changements au clavier
This commit is contained in:
2020-11-15 02:07:41 +01:00
parent 5776ae0a20
commit 52caf1b39a
14 changed files with 199 additions and 165 deletions

View File

@ -5,7 +5,25 @@
* to actual classes of the game system or of FoundryVTT
*/
export class Misc {
static _upperFirst(text) {
static upperFirst(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
static toSignedString(number){
const value = parseInt(number)
const isPositiveNumber = value != NaN && value > 0;
return isPositiveNumber ? "+"+number : number
}
/**
* Converts the value to an integer, or to 0 if undefined/null/not representing integer
* @param {*} value value to convert to an integer using parseInt
*/
static toInt(value)
{
if (value == undefined)
{
return 0;
}
const parsed = parseInt(value);
return isNaN(parsed) ? 0 : parsed;
}
}