All fixes'

This commit is contained in:
2022-01-10 08:00:27 +01:00
parent 9fbbd93a2e
commit 6387426b73
9 changed files with 184 additions and 47 deletions

View File

@ -4,6 +4,7 @@ import { PegasusActorCreate } from "./pegasus-create-char.js";
/* -------------------------------------------- */
const __level2Dice = [ "d0", "d4", "d6", "d8", "d10", "d12" ];
const __level2DiceValue = [ 0, 4, 6, 8, 10, 12 ];
/* -------------------------------------------- */
export class PegasusUtility {
@ -179,6 +180,18 @@ export class PegasusUtility {
return it;
}
/* -------------------------------------------- */
static getDiceValue( level = 0) {
let locLevel = level
let diceValue = 0
while (locLevel > 0) {
let idx = locLevel % __level2Dice.length
diceValue += __level2DiceValue[idx]
locLevel -= idx
}
return diceValue
}
/* -------------------------------------------- */
static getDiceFromLevel(level = 0) {
level = Number(level)