Fixes dices issues
This commit is contained in:
@@ -271,17 +271,22 @@ export class CrucibleUtility {
|
||||
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
|
||||
// stat => 0
|
||||
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
|
||||
|
||||
// skill => 2
|
||||
// feat => 4
|
||||
// bonus => 6
|
||||
if (rollData.skill) {
|
||||
let level = rollData.skill.data.level
|
||||
if (level == 0 && rollData.skill.data.isfeatdie ) {
|
||||
rollData.hasSLBonus = true
|
||||
level += 2
|
||||
if (level > 7) { level = 7}
|
||||
rollData.skill.data.skilldice = __skillLevel2Dice[level]
|
||||
}
|
||||
|
||||
rollData.skill.data.skilldice = __skillLevel2Dice[level]
|
||||
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"
|
||||
@@ -290,32 +295,49 @@ export class CrucibleUtility {
|
||||
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
|
||||
rollData.hasFeatDie = true
|
||||
diceFormula += "+ 1d10cs>=5"
|
||||
} else {
|
||||
diceFormula += `+ 0d10cs>=5`
|
||||
}
|
||||
if (rollData.skill.data.bonusdice != "none") {
|
||||
rollData.hasBonusDice = rollData.skill.data.bonusdice
|
||||
diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
|
||||
} else {
|
||||
diceFormula += `+ 0d6cs>=5`
|
||||
}
|
||||
} else {
|
||||
diceFormula += `+ 0d8cs=>5 + 0d10cs>=5 + 0d6cs>=5`
|
||||
}
|
||||
|
||||
// advantage => 8
|
||||
let advFormula = "+ 0d8cs>=5"
|
||||
if(rollData.advantage == "advantage1") {
|
||||
diceFormula += "+ 1d10cs>=5"
|
||||
advFormula = "+ 1d8cs>=5"
|
||||
}
|
||||
if(rollData.advantage == "advantage2") {
|
||||
diceFormula += "+ 2d10cs>=5"
|
||||
advFormula = "+ 2d8cs>=5"
|
||||
}
|
||||
diceFormula += advFormula
|
||||
|
||||
// disadvantage => 10
|
||||
let disFormula = "- 0d8cs>=5"
|
||||
if(rollData.disadvantage == "disadvantage1") {
|
||||
diceFormula += "- 1d10cs>=5"
|
||||
disFormula = "- 1d8cs>=5"
|
||||
}
|
||||
if(rollData.disadvantage == "disadvantage2") {
|
||||
diceFormula += "- 2d10cs>=5"
|
||||
disFormula = "- 2d8cs>=5"
|
||||
}
|
||||
diceFormula += disFormula
|
||||
|
||||
// armor => 12
|
||||
let skillArmorPenalty = 0
|
||||
for (let armor of rollData.armors) {
|
||||
skillArmorPenalty += armor.data.skillpenalty
|
||||
}
|
||||
if (skillArmorPenalty > 0 ) {
|
||||
if (rollData.skill && rollData.skill.data.armorpenalty && skillArmorPenalty > 0 ) {
|
||||
rollData.skillArmorPenalty = skillArmorPenalty
|
||||
diceFormula += `- ${skillArmorPenalty}d10cs>=5`
|
||||
diceFormula += `- ${skillArmorPenalty}d8cs>=5`
|
||||
} else {
|
||||
diceFormula += `- 0d8cs>=5`
|
||||
}
|
||||
|
||||
// Performs roll
|
||||
|
||||
Reference in New Issue
Block a user