Compare commits
3 Commits
fvtt-yggdr
...
fvtt-yggdr
| Author | SHA1 | Date | |
|---|---|---|---|
| ecd164c3e5 | |||
| ecdb85455d | |||
| 8d56fed614 |
@@ -87,12 +87,14 @@ export class YggdrasillUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async specificYggRoll( nbDice ) {
|
||||
return specificYggRoll(nbDice, false);
|
||||
}
|
||||
|
||||
static async specificYggRoll( nbDice, isFurorUsage ) {
|
||||
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 +104,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 }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -218,7 +218,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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"title": "Yggdrasill",
|
||||
"description": "Système non-officiel Yggdrasill (7ième Cercle) pour FoundryVTT",
|
||||
"version": "10.0.3",
|
||||
"version": "10.0.4",
|
||||
"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-10.0.4.zip",
|
||||
"license": "LICENSE.txt",
|
||||
"id": "fvtt-yggdrasill",
|
||||
"authors": [
|
||||
@@ -221,6 +221,7 @@
|
||||
},
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10.286"
|
||||
"verified": "10",
|
||||
"maximum": "10"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user