#27 Gestion des rencontres

This commit is contained in:
sladecraven 2020-11-21 09:10:31 +01:00
parent 40f0efec1a
commit 40027882e4
4 changed files with 17 additions and 15 deletions

View File

@ -126,7 +126,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async performRoll(rollData) {
let rolled = RdDResolutionTable.roll(rollData.carac, rollData.finalLevel);
let rolled = await RdDResolutionTable.roll(rollData.carac, rollData.finalLevel);
//rolled.isPart = true; // Pour tester le particulières
rollData.rolled = rolled; // garder le résultat
console.log("performRoll", rollData, rolled)
@ -411,13 +411,13 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
combattreReveDeDragon(force){
async combattreReveDeDragon(force){
let draconic = this.getBestDraconic();
let niveau = Math.max(0, draconic.data.niveau);
let etat = this.data.data.compteurs.etat.value;
let difficulte = niveau - etat - force;
let reveActuel = this.getReveActuel();
let rolled = RdDResolutionTable.roll(reveActuel, difficulte);
let rolled = await RdDResolutionTable.roll(reveActuel, difficulte);
// TODO: xp particulière
console.log("combattreReveDeDragon", rolled );
return this.appliquerReveDeDragon(rolled, force);
@ -913,8 +913,8 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
_stressRoll() {
let result = RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
async _stressRoll() {
let result = await RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
console.log("_stressRoll", result);
switch (result.code) {
case "sign": return { factor: 0.75, comment: " (75%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
@ -924,7 +924,7 @@ export class RdDActor extends Actor {
case "etotal": return { factor: 0, comment: " (0%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
case "part":
{
let second = RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
let second = await RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
console.log("_stressRoll", second);
switch (second.code) {
case "part": case "sign":

View File

@ -1,15 +1,17 @@
export class RdDDice {
static deDraconique(rollMode="selfroll") {
/* -------------------------------------------- */
static async deDraconique(rollMode="selfroll") {
let roll = new Roll("1d8x8").evaluate();
this.show(roll, rollMode);
await this.show(roll, rollMode);
return roll.total - Math.ceil(roll.total / 8);
}
static show(roll, rollMode = "roll") {
/* -------------------------------------------- */
static async show(roll, rollMode = "roll") {
if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
this.showDiceSoNice(roll, rollMode);
await this.showDiceSoNice(roll, rollMode);
}
return roll;
}

View File

@ -85,20 +85,20 @@ export class RdDResolutionTable {
}
/* -------------------------------------------- */
static roll(carac, finalLevel) {
static async roll(carac, finalLevel) {
let chances = this.computeChances(carac, finalLevel);
chances.showDice = true;
let rolled = this.rollChances(chances);
let rolled = await this.rollChances(chances);
rolled.carac = carac;
rolled.finalLevel = finalLevel;
return rolled;
}
/* -------------------------------------------- */
static rollChances(chances) {
static async rollChances(chances) {
let myRoll = new Roll("d100").roll();
myRoll.showDice = chances.showDice;
RdDDice.show(myRoll);
await RdDDice.show(myRoll);
chances.roll = myRoll.total;
mergeObject(chances, this._computeReussite(chances, chances.roll));
return chances;

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.68",
"version": "0.9.69",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6",
"templateVersion": 47,