4 Commits

3 changed files with 17 additions and 24 deletions

View File

@@ -407,7 +407,6 @@ export class YggdrasillActor extends Actor {
/* -------------------------------------------- */
getActiveEffects(matching = it => true) {
let array = Array.from(this.getEmbeddedCollection("ActiveEffect").values());
return Array.from(this.getEmbeddedCollection("ActiveEffect").values()).filter(it => matching(it));
}
/* -------------------------------------------- */

View File

@@ -1,5 +1,4 @@
/* -------------------------------------------- */
//import { YggdrasillCombat } from "./yggdrasill-combat.js";
/* -------------------------------------------- */
const dureeGaldrText = { "1d5a": "Actions", "1d10t": "Tours", "1d10m": "Minutes", "1d10h": "Heures", "1d5j": "Jours"};
@@ -86,13 +85,11 @@ export class YggdrasillUtility {
}
/* -------------------------------------------- */
static async specificYggRoll( nbDice ) {
static async specificYggRoll( nbDice, isFurorUsage = false) {
let rawDices = []
let rolls = []
let maxTab = []
maxTab[0] = {idx: 0, value: 0}
maxTab[1] = {idx: 0, value: 0}
let maxTabMaxIndex = isFurorUsage ? nbDice : 2;
for (let i=0; i<nbDice; i++) {
rolls[i] = new Roll("1d10x10").roll( {async: false}) //+sumDice+"+"+rollData.furorUsage+"d10+"+niveauCompetence+"+"+rollData.finalBM).roll( { async: false} );
@@ -102,19 +99,17 @@ export class YggdrasillUtility {
this.showDiceSoNice(rolls[i], game.settings.get("core", "rollMode") );
}
rawDices.push({ 'result': rolls[i].total});
if ( rolls[i].total > maxTab[0].value) {
if ( nbDice > 1 && maxTab[0].value > maxTab[1].value) {
maxTab[1].value = maxTab[0].value
}
maxTab[0].value = rolls[i].total
} else {
if ( nbDice > 1 && rolls[i].total > maxTab[1].value) {
maxTab[1].value = rolls[i].total
}
}
}
return { rawDices: rawDices, maxTab: maxTab, rolls: rolls}
rolls.sort((a,b) => a.total-b.total);
rolls.reverse();
for (let i=0; i<maxTabMaxIndex; i++) {
maxTab[i] = {idx: 0, value: 0};
if (rolls[i].total != undefined) maxTab[i].value = rolls[i].total;
}
return { rawDices: rawDices, maxTab: maxTab, rolls: rolls }
}
/* -------------------------------------------- */
@@ -175,7 +170,6 @@ export class YggdrasillUtility {
this.createChatWithRollMode( rollData.alias, {
content: await renderTemplate(`systems/fvtt-yggdrasill/templates/chat-generic-result.html`, rollData)
});
//myRoll.toMessage();
}
/* -------------------------------------------- */
@@ -218,7 +212,7 @@ export class YggdrasillUtility {
console.log("RES", results, nbDice, sumDice)
if ( rollData.furorUsage > 0 ) {
results = await this.specificYggRoll( rollData.furorUsage )
results = await this.specificYggRoll( rollData.furorUsage, true )
rollData.furorRawDices = results.rawDices
rollData.furorMaxTab = results.maxTab
rollData.furorRolls = results.rolls
@@ -292,7 +286,6 @@ export class YggdrasillUtility {
this.createChatWithRollMode( rollData.alias, {
content: await renderTemplate(`systems/fvtt-yggdrasill/templates/chat-generic-result.html`, rollData)
});
//myRoll.toMessage();
}
/* -------------------------------------------- */

View File

@@ -1,7 +1,7 @@
{
"title": "Yggdrasill",
"description": "Système non-officiel Yggdrasill (7ième Cercle) pour FoundryVTT",
"version": "10.0.3",
"version": "11.0.0",
"esmodules": [
"modules/yggdrasill-main.js"
],
@@ -196,7 +196,7 @@
"socket": true,
"url": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/raw/branch/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/archive/fvtt-yggdrasill-10.0.3.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/archive/fvtt-yggdrasill-11.0.0.zip",
"license": "LICENSE.txt",
"id": "fvtt-yggdrasill",
"authors": [
@@ -221,6 +221,7 @@
},
"compatibility": {
"minimum": "10",
"verified": "10.286"
"verified": "11",
"maximum": "11"
}
}