Ajout support Dice So Nice
This commit is contained in:
parent
25742d811f
commit
267a72f87e
@ -122,7 +122,7 @@ export class RdDActor extends Actor {
|
|||||||
async performRoll(rollData) {
|
async performRoll(rollData) {
|
||||||
|
|
||||||
// Perform the roll
|
// Perform the roll
|
||||||
let rolled = RdDResolutionTable.rollChances(rollData.rollTarget);
|
let rolled = await RdDResolutionTable.rollChances(rollData.rollTarget);
|
||||||
//rolled.isPart = true; // Pour tester le particulières
|
//rolled.isPart = true; // Pour tester le particulières
|
||||||
rollData.rolled = rolled; // garder le résultat
|
rollData.rolled = rolled; // garder le résultat
|
||||||
this.currentRollData = rollData;
|
this.currentRollData = rollData;
|
||||||
@ -719,8 +719,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_stressRoll(target) {
|
async _stressRoll(target) {
|
||||||
let result = RdDResolutionTable.rollChances(target)
|
let result = await RdDResolutionTable.rollChances(target)
|
||||||
switch (result.quality) {
|
switch (result.quality) {
|
||||||
case "sign": return { factor: 0.75, comment: "Significative (75%) - " + result.roll }
|
case "sign": return { factor: 0.75, comment: "Significative (75%) - " + result.roll }
|
||||||
case "norm": return { factor: 0.5, comment: "Normale (50%) - " + result.roll }
|
case "norm": return { factor: 0.5, comment: "Normale (50%) - " + result.roll }
|
||||||
@ -728,7 +728,7 @@ export class RdDActor extends Actor {
|
|||||||
case "epart": return { factor: 0.1, comment: "Echec particulier(10%) - " + result.roll }
|
case "epart": return { factor: 0.1, comment: "Echec particulier(10%) - " + result.roll }
|
||||||
case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll }
|
case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll }
|
||||||
}
|
}
|
||||||
let second = RdDResolutionTable.rollChances(target)
|
let second = await RdDResolutionTable.rollChances(target)
|
||||||
switch (second.quality) {
|
switch (second.quality) {
|
||||||
case "part": case "sign":
|
case "part": case "sign":
|
||||||
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
||||||
|
@ -66,6 +66,7 @@ export class RdDResolutionTable {
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static getResultat(code)
|
static getResultat(code)
|
||||||
{
|
{
|
||||||
let resultat = reussites.filter(r => code == r.code);
|
let resultat = reussites.filter(r => code == r.code);
|
||||||
@ -75,6 +76,7 @@ export class RdDResolutionTable {
|
|||||||
}
|
}
|
||||||
return resultat;
|
return resultat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static roll(carac, difficulte) {
|
static roll(carac, difficulte) {
|
||||||
const chances = this.computeChances(carac, difficulte);
|
const chances = this.computeChances(carac, difficulte);
|
||||||
@ -82,12 +84,41 @@ export class RdDResolutionTable {
|
|||||||
return rolled;
|
return rolled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rollChances(chances) {
|
/* -------------------------------------------- */
|
||||||
chances.roll = new Roll("d100").roll().total;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async rollChances(chances) {
|
||||||
|
let myRoll = new Roll("d100").roll();
|
||||||
|
await this.showDiceSoNice(myRoll );
|
||||||
|
chances.roll = myRoll.total;
|
||||||
mergeObject(chances, this._computeReussite(chances, chances.roll));
|
mergeObject(chances, this._computeReussite(chances, chances.roll));
|
||||||
return chances;
|
return chances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static computeChances(carac, difficulte) {
|
static computeChances(carac, difficulte) {
|
||||||
if (difficulte < -16) {
|
if (difficulte < -16) {
|
||||||
return duplicate(levelImpossible);
|
return duplicate(levelImpossible);
|
||||||
@ -98,6 +129,7 @@ export class RdDResolutionTable {
|
|||||||
return duplicate(this.resolutionTable[carac][difficulte + 10]);
|
return duplicate(this.resolutionTable[carac][difficulte + 10]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static buildXpMessage(rolled, level) {
|
static buildXpMessage(rolled, level) {
|
||||||
if (rolled.isPart && level < 0) {
|
if (rolled.isPart && level < 0) {
|
||||||
const xp = Math.abs(level);
|
const xp = Math.abs(level);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-reve-de-dragon",
|
"name": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"version": "0.9.46",
|
"version": "0.9.47",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 46,
|
"templateVersion": 46,
|
||||||
|
Loading…
Reference in New Issue
Block a user