diff --git a/modules/yggdrasill-actor.js b/modules/yggdrasill-actor.js index 97d0140..221598b 100644 --- a/modules/yggdrasill-actor.js +++ b/modules/yggdrasill-actor.js @@ -505,8 +505,10 @@ export class YggdrasillActor extends Actor { rollMode: game.settings.get("core", "rollMode"), title: title, isBlesse: this.data.data.etat.etat == "blesse", - optionsBonusMalus: YggdrasillUtility.buildListOptions(-6, +6), + optionsBonusMalus: YggdrasillUtility.buildListOptions(-15, +15), bonusMalus: 0, + bonusdefense: 0, + optionsBD: YggdrasillUtility.buildListOptions(0, +15), optionsSR: YggdrasillUtility.buildSROptions( ), sr: 0 } @@ -535,11 +537,12 @@ export class YggdrasillActor extends Actor { isEpuise: this.isEpuise(), isBlesse: this.isBlesse(), isMeurtri: this.isMeurtri(), - optionsBonusMalus: YggdrasillUtility.buildListOptions(-6, +6), + optionsBonusMalus: YggdrasillUtility.buildListOptions(-15, +15), bonusMalus: 0, optionsFuror: YggdrasillUtility.buildListOptions(0, this.getCurrentFuror() ), furorUsage: 0, optionsSR: YggdrasillUtility.buildSROptions( ), + optionsBD: YggdrasillUtility.buildListOptions(0, +15), sr: 0 } let rollDialog = await YggdrasillRoll.create( this, rollData); @@ -567,7 +570,7 @@ export class YggdrasillActor extends Actor { isEpuise: this.isEpuise(), isBlesse: this.isBlesse(), isMeurtri: this.isMeurtri(), - optionsBonusMalus: YggdrasillUtility.buildListOptions(-6, +6), + optionsBonusMalus: YggdrasillUtility.buildListOptions(-15, +15), bonusMalus: 0, optionsFuror: YggdrasillUtility.buildListOptions(0, this.getCurrentFuror() ), furorUsage: 0, @@ -645,6 +648,7 @@ export class YggdrasillActor extends Actor { let rollData = { mode: magie, + isMagie: true, alias: this.name, actorImg: this.img, actorId: this.id, @@ -663,8 +667,8 @@ export class YggdrasillActor extends Actor { isEpuise: this.isEpuise(), isBlesse: this.isBlesse(), isMeurtri: this.isMeurtri(), - optionsBonusMalus: YggdrasillUtility.buildListOptions(-6, +6), - optionsBD: YggdrasillUtility.buildListOptions(0, +6), + optionsBonusMalus: YggdrasillUtility.buildListOptions(-15, +15), + optionsBD: YggdrasillUtility.buildListOptions(0, +15), bonusMalus: 0, optionsFuror: YggdrasillUtility.buildListOptions(0, this.getCurrentFuror() ), furorUsage: 0, @@ -714,8 +718,8 @@ export class YggdrasillActor extends Actor { isEpuise: this.isEpuise(), isBlesse: this.isBlesse(), isMeurtri: this.isMeurtri(), - optionsBonusMalus: YggdrasillUtility.buildListOptions(-6, +6), - optionsBD: YggdrasillUtility.buildListOptions(0, +6), + optionsBonusMalus: YggdrasillUtility.buildListOptions(-15, +15), + optionsBD: YggdrasillUtility.buildListOptions(0, +15), bonusMalus: 0, optionsFuror: YggdrasillUtility.buildListOptions(0, this.getCurrentFuror() ), furorUsage: 0, diff --git a/modules/yggdrasill-figurant-sheet.js b/modules/yggdrasill-figurant-sheet.js index c763c8f..64129c8 100644 --- a/modules/yggdrasill-figurant-sheet.js +++ b/modules/yggdrasill-figurant-sheet.js @@ -40,7 +40,7 @@ export class YggdrasillFigurantSheet extends ActorSheet { effetsmagiques: this.actor.getEffetsMagiques(), encTotal: this.actor.getEncTotal(), monnaies: this.actor.getMonnaies(), - optionsAttr: new Array(21).fill('option'), + optionsAttr: new Array(41).fill('option'), optionsBase: YggdrasillUtility.createDirectOptionList(0, 20), options: this.options, owner: this.document.isOwner, diff --git a/modules/yggdrasill-roll-dialog.js b/modules/yggdrasill-roll-dialog.js index fe7cf73..98e6ab6 100644 --- a/modules/yggdrasill-roll-dialog.js +++ b/modules/yggdrasill-roll-dialog.js @@ -91,27 +91,32 @@ export class YggdrasillRoll extends Dialog { if ( this.rollData.supportRune == "peau") { support = 3; this.rollData.echelleDuree = "Actions"; + this.rollData.echelleDureeVie = "Heures" } if ( this.rollData.supportRune == "tissu") { support = 6; this.rollData.echelleDuree = "Tours"; + this.rollData.echelleDureeVie = "Jours" } if ( this.rollData.supportRune == "cuir") { support = 9; this.rollData.echelleDuree = "Minutes"; + this.rollData.echelleDureeVie = "Semaines" } if ( this.rollData.supportRune == "bois") { support = 12; this.rollData.echelleDuree = "Heures"; + this.rollData.echelleDureeVie = "Mois" } if ( this.rollData.supportRune == "pierremetal") { support = 15; this.rollData.echelleDuree = "Jours"; + this.rollData.echelleDureeVie = "Années" } let SR = this.rollData.puissanceRune + (Number(this.rollData.sort.data.niveau)*3) + support; $("#srTotal").text(SR); $("#runeDuree").text( this.rollData.dureeRune + " " + this.rollData.echelleDuree); - $("#runeDureeVie").text( this.rollData.puissanceRune + " " + this.rollData.echelleDuree); + $("#runeDureeVie").text( this.rollData.competence.data.niveau + " " + this.rollData.echelleDureeVie); this.rollData.sr = SR; } diff --git a/modules/yggdrasill-utility.js b/modules/yggdrasill-utility.js index fe57610..1ba30b0 100644 --- a/modules/yggdrasill-utility.js +++ b/modules/yggdrasill-utility.js @@ -98,6 +98,38 @@ export class YggdrasillUtility { return compendiumData.filter(filter); } + /* -------------------------------------------- */ + static async specificYggRoll( nbDice ) { + let rawDices = [] + let rolls = [] + let maxTab = [] + + maxTab[0] = {idx: 0, value: 0} + maxTab[1] = {idx: 0, value: 0} + + for (let i=0; i 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} + } + /* -------------------------------------------- */ static async rollAttribute( rollData ) { // Init stuff @@ -114,31 +146,27 @@ export class YggdrasillUtility { rollData.finalBM -= 3; } - let rolls = [] - rollData.rawDices = [] - for (let i=0; i < 2; i++) { - rolls[i] = new Roll("1d10x10").roll( { async: false} ); - rollData.rawDices.push({ 'result': rolls[i].total}); - } - this.showDiceSoNice(rolls[0], game.settings.get("core", "rollMode") ); - await this.showDiceSoNice(rolls[1], game.settings.get("core", "rollMode") ); + let results = await this.specificYggRoll( 2 ) + rollData.rawDices = results.rawDices + rollData.maxTab = results.maxTab + rollData.rolls = results.rolls rollData.bonus = niveau + rollData.finalBM - rollData.finalTotal = 0 - for (let i=0; i< 2; i++) { - rollData.finalTotal = rolls[i].dice[0].results[0].result - } + rollData.finalTotal = rollData.maxTab[0].value + rollData.maxTab[1].value; rollData.finalTotal += rollData.bonus - + // Compute total SR rollData.srFinal = rollData.sr; + if ( rollData.bonusdefense ) { + rollData.srFinal += rollData.bonusdefense; + } if ( rollData.srFinal > 0 ) { isCritical = rollData.finalTotal >= rollData.srFinal*2; isSuccess = rollData.finalTotal >= rollData.srFinal; marge = rollData.finalTotal - rollData.srFinal; } - if (rolls[0].dice[0].results[0].result == 1 && rolls[1].dice[0].results[0].result == 1) { + if (rollData.rolls[0].dice[0].results[0].result == 1 && rollData.rolls[1].dice[0].results[0].result == 1) { isFailure = true; } // Dégats @@ -154,7 +182,6 @@ export class YggdrasillUtility { rollData.isSuccess = isSuccess; rollData.isCritical = isCritical; rollData.marge = marge; - rollData.rolls = rolls console.log("ROLLLL ATTR!!!!", rollData); @@ -196,41 +223,30 @@ export class YggdrasillUtility { rollData.finalBM -= 3; } - rollData.rawDices = [] if (sumDice > nbDice) sumDice = nbDice; - let rolls = [] - let maxTab = [ {idx: 0, value: 0}, {idx: 0, value:0}] - for (let i=0; i maxTab[0].value) { - if ( maxTab[0].value > maxTab[1].value) { - maxTab[1].value = maxTab[0].value - maxTab[1].idx = maxTab[0].idx - } - maxTab[0].value = rolls[i].total - maxTab[0].idx = i - } else { - if ( rolls[i].total > maxTab[1].value) { - maxTab[1].value = rolls[i].total - maxTab[1].idx = i - } - } + if ( rollData.furorUsage > 0 ) { + results = await this.specificYggRoll( rollData.furorUsage ) + rollData.furorRawDices = results.rawDices + rollData.furorMaxTab = results.maxTab + rollData.furorRolls = results.rolls + let actor = game.actors.get(rollData.actorId); + actor.decrementFuror( rollData.furorUsage); } - let bonusRoll = new Roll(rollData.furorUsage+"d10x10+"+niveauCompetence+"+"+rollData.finalBM).roll( {async: false}) - if ( rollData.furorUsage > 0) { - this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode") ); - } - rollData.finalTotal = (sumDice ==1) ? maxTab[0].value : maxTab[0].value + maxTab[1].value; - rollData.finalTotal += bonusRoll.total; - rollData.furorResult = (rollData.furorUsage >0 ) ? bonusRoll.dice[0].results[0].result : 0; - rollData.maxTab = maxTab + + rollData.bonusTotal = niveauCompetence + rollData.finalBM + rollData.finalTotal = (sumDice ==1) ? rollData.maxTab[0].value : rollData.maxTab[0].value + rollData.maxTab[1].value; + rollData.furorResult = 0 + for (let i=0; i= 3 ) { let nbOnes = 0 - for (let roll of rolls) { + for (let roll of rollData.rolls) { if (roll.dice[0].results[0].result == 1 ) nbOnes++; } isFailure = nbOnes >= 3; } - if ( rollData.furorUsage > 0 ) { - let actor = game.actors.get(rollData.actorId); - actor.decrementFuror( rollData.furorUsage); - } // Dégats if ( isSuccess && (rollData.mode == "armecc" || rollData.mode == "armedist") ) { @@ -269,7 +281,6 @@ export class YggdrasillUtility { } // Stockage resultats - rollData.rolls = rolls rollData.sumDice = sumDice; rollData.isFailure = isFailure; rollData.isSuccess = isSuccess; diff --git a/styles/simple.css b/styles/simple.css index 8d96035..f8501b8 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -876,8 +876,7 @@ ul, li { } #sidebar.collapsed { - height: 430px !important; - position: absolute; + height: 470px !important; } #sidebar-tabs > .collapsed, #chat-controls .chat-control-icon { diff --git a/system.json b/system.json index da4d634..13adb9b 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "fvtt-yggdrasill", "title": "Yggdrasill", "description": "Système non-officiel Yggdrasill (7ièm Cercle) pour FoundryVTT", - "version": "1.1.10", + "version": "1.1.11", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "9", diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index 36df9f4..e8fe48a 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -4,104 +4,118 @@
-
- {{alias}} -

- {{#if (eq mode "attribut")}} - Jet de {{attr.label}} {{subAttr.label}} (2d10+{{subAttr.value}}) - {{else}} - {{#if (eq mode "competence")}} +
+ {{alias}} +

+ {{#if (eq mode "attribut")}} + Jet de {{attr.label}} {{subAttr.label}} (2d10+{{subAttr.value}}) + {{else}} + {{#if (eq mode "competence")}} Jet de {{selectedCarac.label}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) {{else}} - {{#if (eq mode "armecc")}} - Attaque au corps à Corps {{attackDef.label}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) - {{else}} - {{#if (eq mode "armedist")}} - Attaque à Distance {{attackDef.label}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) - {{else}} - {{#if (eq mode "sejdr")}} - Lancer du Sort {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) - {{else}} - {{#if (eq mode "rune")}} - Gravure de la Rune {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) - {{else}} - {{#if (eq mode "galdr")}} - Lancer du Domaine {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) - {{else}} - Jet de {{selectedCarac.label}} ({{selectedCarac.value}}d10) - {{/if}} - {{/if}} - {{/if}} - {{/if}} - {{/if}} + {{#if (eq mode "armecc")}} + Attaque au corps à Corps {{attackDef.label}} ({{selectedCarac.value}}d10) / {{competence.name}} + ({{competence.data.niveau}}) + {{else}} + {{#if (eq mode "armedist")}} + Attaque à Distance {{attackDef.label}} ({{selectedCarac.value}}d10) / {{competence.name}} + ({{competence.data.niveau}}) + {{else}} + {{#if (eq mode "sejdr")}} + Lancer du Sort {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) + {{else}} + {{#if (eq mode "rune")}} + Gravure de la Rune {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) + {{else}} + {{#if (eq mode "galdr")}} + Lancer du Domaine {{sort.name}} ({{selectedCarac.value}}d10) / {{competence.name}} ({{competence.data.niveau}}) + {{else}} + Jet de {{selectedCarac.label}} ({{selectedCarac.value}}d10) {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} +

+
+ +
+
    +
  • Dés : + {{#each rawDices as |roll key|}} + {{roll.result}}  + {{/each}} +
  • + {{#if sumDice}} +
  • Nombre de dés additionnés : {{sumDice}}
  • + {{/if}} +
  • {{#if (eq mode "carac")}}Carac{{else}}Competence{{/if}} : {{niveauCompetence}}
  • +
  • Bonus/Malus Final : {{finalBM}}
  • + {{#if sr}} +
  • Seuil de Réussite final : {{srFinal}}
  • + {{/if}} + {{#if furorUsage}} +
  • Furor dépensée : {{furorUsage}}
  • +
  • Resultat de la Furor : {{furorResult}}
  • + {{/if}} +
  • +

    Total : {{finalTotal}}

    +
  • +
+ + {{#if dureeGaldrText}} +
+ Durée du Sort : {{dureeGaldrText}} +
{{/if}} -

-
-
-
    -
  • Dés : - {{#each rawDices as |roll key|}} - {{roll.result}}  - {{/each}} -
  • - {{#if sumDice}} -
  • Nombre de dés additionnés : {{sumDice}}
  • + {{#if zoneGaldrText}} +
    + Volume Max de l'Illusion : {{zoneGaldrText}} +
    {{/if}} -
  • {{#if (eq mode "carac")}}Carac{{else}}Competence{{/if}} : {{niveauCompetence}}
  • -
  • Bonus/Malus Final : {{finalBM}}
  • - {{#if sr}} -
  • Seuil de Réussite final : {{srFinal}}
  • + + {{#if ciblesGaldrText}} +
    + Nombre de Cibles : {{ciblesGaldrText}} +
    {{/if}} - {{#if furorUsage}} -
  • Furor dépensée : {{furorUsage}}
  • -
  • Resultat de la Furor : {{furorResult}}
  • + + + {{#if degats}} +
    + Degats : {{degats}} ({{degatsExplain}}) +
    {{/if}} -
  • Total : {{finalTotal}}

  • -
- - {{#if dureeGaldrText}} -
- Durée du Sort : {{dureeGaldrText}} -
- {{/if}} - {{#if zoneGaldrText}} -
- Volume Max de l'Illusion : {{zoneGaldrText}} -
- {{/if}} + {{#if attackDef.protection}} +
+ Annuation de Protection du Défenseur : {{attackDef.protection}} +
+ {{/if}} - {{#if ciblesGaldrText}} -
- Nombre de Cibles : {{ciblesGaldrText}} -
- {{/if}} - - - {{#if degats}} -
- Degats : {{degats}} ({{degatsExplain}}) -
- {{/if}} - - {{#if attackDef.protection}} -
- Annuation de Protection du Défenseur : {{attackDef.protection}} -
- {{/if}} - - {{#if isCritical}} -
- critique - Réussite Critique ! + {{#if isCritical}} +
+ critique + Réussite Critique ! +
{{/if}} {{#if isFailure}} - echec - Echec Critique ! -
- {{/if}} +
+ echec + Echec Critique ! +
+ {{/if}} -
+ {{#if (and isSuccess isMagie)}} +
+
+ {{{sort.data.description}}} +
+ {{/if}} + + + \ No newline at end of file diff --git a/templates/roll-dialog-attribut.html b/templates/roll-dialog-attribut.html index 8585684..f64efb7 100644 --- a/templates/roll-dialog-attribut.html +++ b/templates/roll-dialog-attribut.html @@ -17,6 +17,15 @@ {{/select}} + +
+ Défense Physique du défenseur : + +
Seuil de Réussite :