2020-11-16 03:54:43 +01:00
|
|
|
export class RdDDice {
|
|
|
|
|
2020-11-21 09:10:31 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async deDraconique(rollMode="selfroll") {
|
2020-11-16 03:54:43 +01:00
|
|
|
let roll = new Roll("1d8x8").evaluate();
|
2020-11-21 09:10:31 +01:00
|
|
|
await this.show(roll, rollMode);
|
2020-11-16 03:54:43 +01:00
|
|
|
return roll.total - Math.ceil(roll.total / 8);
|
|
|
|
}
|
|
|
|
|
2020-11-17 11:35:05 +01:00
|
|
|
|
2020-11-21 09:10:31 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async show(roll, rollMode = "roll") {
|
2020-11-17 11:35:05 +01:00
|
|
|
if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
|
2020-11-21 09:10:31 +01:00
|
|
|
await this.showDiceSoNice(roll, rollMode);
|
2020-11-17 11:35:05 +01:00
|
|
|
}
|
2020-11-16 03:54:43 +01:00
|
|
|
return roll;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async showDiceSoNice(roll, rollMode = "roll") {
|
|
|
|
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
|
|
|
let whisper = null;
|
|
|
|
let blind = false;
|
|
|
|
switch (rollMode) {
|
|
|
|
case "blindroll": //GM only
|
|
|
|
blind = true;
|
|
|
|
case "gmroll": //GM + rolling player
|
|
|
|
let gmList = game.users.filter(user => user.isGM);
|
|
|
|
let gmIDList = [];
|
|
|
|
gmList.forEach(gm => gmIDList.push(gm.data._id));
|
|
|
|
whisper = gmIDList;
|
|
|
|
break;
|
|
|
|
case "roll": //everybody
|
|
|
|
let userList = game.users.filter(user => user.active);
|
|
|
|
let userIDList = [];
|
|
|
|
userList.forEach(user => userIDList.push(user.data._id));
|
|
|
|
whisper = userIDList;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|