Various fixes and ehnagcements
This commit is contained in:
@@ -5,6 +5,7 @@ import { CrucibleCommands } from "./crucible-commands.js";
|
||||
/* -------------------------------------------- */
|
||||
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 __skillLevel2Dice = ["0d8", "1d8", "2d8","3d8", "4d8", '6d8', "8d8", "10d8"]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class CrucibleUtility {
|
||||
@@ -258,6 +259,12 @@ export class CrucibleUtility {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateSkill( skill) {
|
||||
skill.data.level = skill.data.background + skill.data.basic + skill.data.class + skill.data.explevel
|
||||
if (skill.data.level > 7) { skill.data.level = 7}
|
||||
skill.data.skilldice = __skillLevel2Dice[skill.data.level]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollCrucible(rollData) {
|
||||
@@ -267,17 +274,27 @@ export class CrucibleUtility {
|
||||
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
|
||||
if (rollData.skill) {
|
||||
let level = rollData.skill.data.level
|
||||
if (rollData.featSLName != "none") {
|
||||
let feat = rollData.featsSL.find(item => item.name == rollData.featSLName )
|
||||
level += feat.data.sl
|
||||
rollData.featSL = feat.data.sl
|
||||
if (level == 0 && rollData.skill.data.isfeatdie ) {
|
||||
rollData.hasSLBonus = true
|
||||
level += 2
|
||||
if (level > 7) { level = 7}
|
||||
rollData.skill.data.skilldice = __skillLevel2Dice[level]
|
||||
}
|
||||
|
||||
diceFormula += "+" + String(level) + "d8cs>=5"
|
||||
diceFormula += "+" + String(rollData.skill.data.skilldice) + "cs>=5"
|
||||
if (rollData.skill.data.skilltype == "complex" && rollData.skill.data.level == 0) {
|
||||
rollData.complexSkillDisadvantage = true
|
||||
rollData.rollAdvantage = "roll-disadvantage"
|
||||
}
|
||||
|
||||
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
|
||||
rollData.hasFeatDie = true
|
||||
diceFormula += "+ 1d10cs>=5"
|
||||
}
|
||||
if (rollData.skill.data.bonusdice != "none") {
|
||||
rollData.hasBonusDice = rollData.skill.data.bonusdice
|
||||
diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
|
||||
}
|
||||
}
|
||||
|
||||
if(rollData.advantage == "advantage1") {
|
||||
@@ -286,15 +303,21 @@ export class CrucibleUtility {
|
||||
if(rollData.advantage == "advantage2") {
|
||||
diceFormula += "+ 2d10cs>=5"
|
||||
}
|
||||
if(rollData.advantage == "disadvantage1") {
|
||||
if(rollData.disadvantage == "disadvantage1") {
|
||||
diceFormula += "- 1d10cs>=5"
|
||||
}
|
||||
if(rollData.advantage == "disadvantage2") {
|
||||
if(rollData.disadvantage == "disadvantage2") {
|
||||
diceFormula += "- 2d10cs>=5"
|
||||
}
|
||||
if (rollData.featDieName != "none") {
|
||||
diceFormula += "+ 1d10cs>=5"
|
||||
let skillArmorPenalty = 0
|
||||
for (let armor of rollData.armors) {
|
||||
skillArmorPenalty += armor.data.skillpenalty
|
||||
}
|
||||
if (skillArmorPenalty > 0 ) {
|
||||
rollData.skillArmorPenalty = skillArmorPenalty
|
||||
diceFormula += `- ${skillArmorPenalty}d10cs>=5`
|
||||
}
|
||||
|
||||
// Performs roll
|
||||
let myRoll = rollData.roll
|
||||
if (!myRoll) { // New rolls only of no rerolls
|
||||
|
||||
Reference in New Issue
Block a user