Managedeletion
This commit is contained in:
@ -4,8 +4,9 @@ import { PegasusCommands } from "./pegasus-commands.js";
|
||||
import { PegasusActorCreate } from "./pegasus-create-char.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"];
|
||||
const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"]
|
||||
const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10": 10, "d12": 12 }
|
||||
const __dice2Level = {"d0": 0, "d4": 1, "d6": 2, "d8": 3, "d10": 4, "d12": 5}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class PegasusUtility {
|
||||
@ -142,14 +143,17 @@ export class PegasusUtility {
|
||||
static updateStatDicePool( rollData) {
|
||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "stat")
|
||||
let statDice = rollData.dicePool.find(dice => dice.name == "stat")
|
||||
if (rollData.statDicesLevel > 0) {
|
||||
if (statDice.level > 0) {
|
||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.statDicesLevel)
|
||||
let diceList = diceKey.split(" ")
|
||||
let mod = statDice.mod
|
||||
for (let myDice of diceList) {
|
||||
myDice = myDice.trim()
|
||||
let newDice = {
|
||||
name: "stat", key: myDice, level: rollData.statDicesLevel, mod: statDice.mod,
|
||||
name: "stat", key: myDice, level: PegasusUtility.getLevelFromDice(myDice), mod: mod,
|
||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
||||
}
|
||||
mod = 0 // Only first dice has modifier
|
||||
newDicePool.push(newDice)
|
||||
}
|
||||
}
|
||||
@ -163,8 +167,9 @@ export class PegasusUtility {
|
||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.specDicesLevel)
|
||||
let diceList = diceKey.split(" ")
|
||||
for (let myDice of diceList) {
|
||||
myDice = myDice.trim()
|
||||
let newDice = {
|
||||
name: "spec", key: myDice, level: rollData.specDicesLevel,
|
||||
name: "spec", key: myDice, level: PegasusUtility.getLevelFromDice(myDice),
|
||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
||||
}
|
||||
newDicePool.push(newDice)
|
||||
@ -467,6 +472,10 @@ export class PegasusUtility {
|
||||
}
|
||||
return diceValue
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getLevelFromDice(dice) {
|
||||
return __dice2Level[dice]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDiceFromLevel(level = 0) {
|
||||
|
Reference in New Issue
Block a user