#24 Ajout du dé draconique
This commit is contained in:
44
module/rdd-dice.js
Normal file
44
module/rdd-dice.js
Normal file
@ -0,0 +1,44 @@
|
||||
export class RdDDice {
|
||||
static async deRencontre() {
|
||||
let roll = this.show(new Roll("1d7").evaluate());
|
||||
// let roll = this.show(new Roll("1d8r8").evaluate());
|
||||
// roll.total = roll.total % 8;
|
||||
return roll;
|
||||
}
|
||||
|
||||
static async deDraconique() {
|
||||
let roll = new Roll("1d8x8").evaluate();
|
||||
await this.show(roll);
|
||||
return roll.total - Math.ceil(roll.total / 8);
|
||||
}
|
||||
|
||||
static async show(roll, rollMode = "roll") {
|
||||
await this.showDiceSoNice(roll, rollMode);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user