Modify Skills again

This commit is contained in:
2022-07-31 19:32:54 +02:00
parent b0d5f441ee
commit 4b0831c427
9 changed files with 117 additions and 62 deletions

View File

@@ -274,12 +274,18 @@ export class CrucibleUtility {
}
diceFormula += "+" + String(level) + "d8cs>=5"
}
if(rollData.advantage == "advantage") {
if(rollData.advantage == "advantage1") {
diceFormula += "+ 1d10cs>=5"
}
if(rollData.advantage == "disadvantage") {
if(rollData.advantage == "advantage2") {
diceFormula += "+ 2d10cs>=5"
}
if(rollData.advantage == "disadvantage1") {
diceFormula += "- 1d10cs>=5"
}
if(rollData.advantage == "disadvantage2") {
diceFormula += "- 2d10cs>=5"
}
if (rollData.featDieName != "none") {
diceFormula += "+ 1d10cs>=5"
}
@@ -291,12 +297,19 @@ export class CrucibleUtility {
}
rollData.roll = myRoll
rollData.nbSuccess = myRoll.total
if (rollData.rollAdvantage) {
if (rollData.rollAdvantage != "none") {
let myRoll2 = new Roll(diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
if ( myRoll2.total > rollData.nbSuccess) {
rollData.roll = myRoll2
rollData.nbSuccess = myRoll2.total
if (rollData.rollAdvantage == "roll-advantage") {
if ( myRoll2.total > rollData.nbSuccess) {
rollData.roll = myRoll2
rollData.nbSuccess = myRoll2.total
}
} else {
if ( myRoll2.total < rollData.nbSuccess) {
rollData.roll = myRoll2
rollData.nbSuccess = myRoll2.total
}
}
}
// Manage exp
@@ -317,6 +330,21 @@ export class CrucibleUtility {
actor.lastRoll = rollData
}
/* -------------------------------------------- */
static sortArrayObjectsByName( myArray) {
myArray.sort((a, b) => {
let fa = a.name.toLowerCase();
let fb = b.name.toLowerCase();
if (fa < fb) {
return -1;
}
if (fa > fb) {
return 1;
}
return 0;
})
}
/* -------------------------------------------- */
static getUsers(filter) {
return game.users.filter(filter).map(user => user.data._id);