From dab371578d0a945b794a75e73999656c64a0239b Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 15 Mar 2021 21:54:01 +0100 Subject: [PATCH 1/7] Ajout hover sur boutons des acteurs --- styles/simple.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/styles/simple.css b/styles/simple.css index 7a73a2b1..c3f6f71e 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -246,6 +246,12 @@ table {border: 1px solid #7a7971;} height: 8%; max-height: 48px; border-width: 0; + border: 1px solid rgba(0, 0, 0, 0); +} +.button-img:hover { + color: rgba(255, 255, 128, 0.7); + border: 1px solid rgba(255, 128, 0, 0.8); + cursor: pointer; } .button-effect-img { From 98de1a692256d1d0618e4b1a50480355f5b08291 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 16 Mar 2021 21:49:21 +0100 Subject: [PATCH 2/7] Moral sur les oeuvres MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplification de l'appel au moral pour les oeuvres Ajout de la possibilité d'utiliser le moral sur les oeuvres Affichage du moral/appel selon la caractéristique --- module/actor-sheet.js | 6 +- module/rdd-roll.js | 66 ++++++++----------- module/rolldata-ajustements.js | 4 +- styles/simple.css | 2 +- templates/actor-sheet.html | 7 +- templates/dialog-competence.html | 33 +++++----- templates/dialog-roll-alchimie.html | 14 ++-- templates/dialog-roll-carac.html | 41 ++++++------ templates/dialog-roll-chant.html | 14 ++-- templates/dialog-roll-danse.html | 74 +++++++++++---------- templates/dialog-roll-jeu.html | 78 ++++++++++++----------- templates/dialog-roll-musique.html | 12 ++-- templates/dialog-roll-oeuvre.html | 12 ++-- templates/dialog-roll-recettecuisine.html | 14 ++-- 14 files changed, 199 insertions(+), 178 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index e42c3ce8..b4abf4f4 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -489,15 +489,15 @@ export class RdDActorSheet extends ActorSheet { this.actor.transformerStress(); this.render(true); }); - html.find('#moral-malheureux').click((event) => { + html.find('.moral-malheureux').click((event) => { this.actor.jetDeMoral('malheureuse'); this.render(true); }); - html.find('#moral-neutre').click((event) => { + html.find('.moral-neutre').click((event) => { this.actor.jetDeMoral('neutre'); this.render(true); }); - html.find('#moral-heureux').click((event) => { + html.find('.moral-heureux').click((event) => { this.actor.jetDeMoral('heureuse'); this.render(true); }); diff --git a/module/rdd-roll.js b/module/rdd-roll.js index fb25994d..be625be5 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -18,7 +18,7 @@ export class RdDRoll extends Dialog { /* -------------------------------------------- */ static async create(actor, rollData, dialogConfig, ...actions) { - if (actor.isRollWindowsOpened() ) { + if (actor.isRollWindowsOpened()) { ui.notifications.warn("Vous avez déja une fenêtre de Test ouverte, il faut la fermer avant d'en ouvrir une autre.") return; } @@ -49,20 +49,21 @@ export class RdDRoll extends Dialog { diffConditions: 0, diffLibre: rollData.competence?.data.default_diffLibre ?? 0, malusArmureValue: actor.getMalusArmure(), - surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false, + surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false, surencMalusValue: actor.getSurenc(), useMalusSurenc: false, - appelAuMoralPossible : false, /* Est-ce que l'appel au moral est possible ? Variable utisé pour l'affichage ou non de la ligne concernant le moral */ - appelAuMoralDemander :false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ - perteMoralEchec : false, /* Pour l'affichage dans le chat */ - use: { libre: true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false /* Le jet se fait ou non en utilisant l'appel au moral */}, + useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ + perteMoralEchec: false, /* Pour l'affichage dans le chat */ + use: { libre: true, conditions: true, surenc: false, encTotal: false }, isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), useMalusEncTotal: false, encTotal: actor.getEncTotal(), ajustementAstrologique: actor.ajustementAstrologique(), surprise: actor.getSurprise(false), canClose: true - } + }; + + mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); if (rollData.forceCarac) { rollData.carac = rollData.forceCarac; @@ -120,7 +121,7 @@ export class RdDRoll extends Dialog { await RdDResolutionTable.rollData(this.rollData); console.log("RdDRoll -=>", this.rollData, this.rollData.rolled); this.actor.setRollWindowsOpened(false); - + if (action.callbacks) for (let callback of action.callbacks) { if (callback.condition == undefined || callback.condition(this.rollData)) { @@ -206,27 +207,22 @@ export class RdDRoll extends Dialog { this.rollData.useMalusEncTotal = event.currentTarget.checked; this.updateRollResult(); }); - html.find('#iconeSmile').change((event) => { - console.log("iconeSmile"); - console.log(html.find('.iconeSmile')); + html.find('.imgAppelAuMoral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */ + this.rollData.useMoral = !this.rollData.useMoral; + if (this.rollData.useMoral) { + if (this.rollData.moral > 0) { + html.find('.imgAppelAuMoral')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-heureux.svg"; + html.find('.tooltipAppelAuMoralText')[0].innerHTML = "Appel au moral"; + } else { + html.find('.imgAppelAuMoral')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg"; + html.find('.tooltipAppelAuMoralText')[0].innerHTML = "Appel à l'énergie du désespoir"; + } + } else { + html.find('.imgAppelAuMoral')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg"; + html.find('.tooltipAppelAuMoralText')[0].innerHTML = "Sans appel au moral"; + } this.updateRollResult(); - }); - html.find('#iconeSmile').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */ - this.rollData.appelAuMoralDemander = ! this.rollData.appelAuMoralDemander; - if ( this.rollData.appelAuMoralDemander ) { - if ( this.rollData.moral > 0 ) { - html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-heureux.svg"; - html.find('#tooltipAppelAuMoralText')[0].innerHTML = "Appel au moral"; - } else { - html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg"; - html.find('#tooltipAppelAuMoralText')[0].innerHTML = "Appel à l'énergie du désespoir"; - } - } else { - html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg"; - html.find('#tooltipAppelAuMoralText')[0].innerHTML = "Sans appel au moral"; - } - this.updateRollResult(); - }); + }); // Section Méditation html.find('.conditionMeditation').change((event) => { let condition = event.currentTarget.attributes['id'].value; @@ -238,10 +234,11 @@ export class RdDRoll extends Dialog { /* -------------------------------------------- */ async updateRollResult() { let rollData = this.rollData; - + rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat()); rollData.caracValue = parseInt(rollData.selectedCarac.value); rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel'; + rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac); let dmgText = Misc.toSignedString(rollData.dmg.total); if (rollData.coupsNonMortels) { @@ -252,21 +249,12 @@ export class RdDRoll extends Dialog { HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort)) HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort)) } - - if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac || ! actor.isPersonnage() ) ) { - rollData.appelAuMoralPossible = false; - rollData.use.appelAuMoral = false; - } else { - rollData.appelAuMoralPossible = true; - rollData.use.appelAuMoral = rollData.appelAuMoralDemander; - - } RollDataAjustements.calcul(rollData, this.actor); rollData.finalLevel = this._computeFinalLevel(rollData); HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); - HtmlUtility._showControlWhen($("#divAppelAuMoral"), rollData.appelAuMoralPossible ); + HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral); HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence)); HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData)); diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 049b0972..1d4eb657 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -73,8 +73,8 @@ export const referenceAjustements = { getValue: (rollData, actor) => actor.getSurenc() }, moral: { - isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac), - isUsed: (rollData, actor) => rollData.use?.appelAuMoral, + isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.useMoral, + isUsed: (rollData, actor) => rollData.useMoral, getLabel: (rollData, actor) => 'Appel au moral', getValue: (rollData, actor) => 1 }, diff --git a/styles/simple.css b/styles/simple.css index c3f6f71e..8f14b3aa 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -825,7 +825,7 @@ ul, li { display: none !important; } -.iconeSmile { +.imgAppelAuMoral { height: 20px; width: 20px; border:none; diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 80f64dea..e96e8512 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -1,4 +1,3 @@ -{{log "handlebar actor-sheet" this}}
{{!-- Sheet Header --}} @@ -198,9 +197,9 @@ {{else if (eq compteur.label 'Ethylisme')}} Jet d'Ethylisme {{else if (eq compteur.label 'Moral')}} - Jet de moral situation malheureuse - Jet de moral situation neutre - Jet de moral situation heureuse + Jet de moral situation malheureuse + Jet de moral situation neutre + Jet de moral situation heureuse {{else}} {{/if}} diff --git a/templates/dialog-competence.html b/templates/dialog-competence.html index a099493b..a2d55743 100644 --- a/templates/dialog-competence.html +++ b/templates/dialog-competence.html @@ -1,7 +1,7 @@

- + - -
-
- - - Sans appel au moral -
-
+ + +
+ + Sans appel au moral +
{{#if attackerRoll}} - + {{else}} - + {{/if}} - + -
{{#if arme}}
{{#if attackerRoll}} {{#if attackerRoll.tactique}} - + {{/if}} - + {{else}} - + {{/if}} {{#if ajustements.attaqueDefenseurSurpris.used}} - + {{/if}}
{{/if}} diff --git a/templates/dialog-roll-alchimie.html b/templates/dialog-roll-alchimie.html index 87323064..5062e3ea 100644 --- a/templates/dialog-roll-alchimie.html +++ b/templates/dialog-roll-alchimie.html @@ -1,14 +1,18 @@
    -
  • -
  • -
  • +
  • +
  • +
+
+ + Sans appel au moral +
- + - + +

+
+ + - - + + - -
-{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} -
-
-
-
-
-
+ + +
+ + Sans appel au moral +
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} +
+
+
+
+
+
+ \ No newline at end of file diff --git a/templates/dialog-roll-chant.html b/templates/dialog-roll-chant.html index 6fa436b5..cff88cd8 100644 --- a/templates/dialog-roll-chant.html +++ b/templates/dialog-roll-chant.html @@ -1,13 +1,17 @@
    -
  • -
  • +
  • +
-
+
+ + Sans appel au moral +
+
- + - + - {{#select carac}} - {{#each carac as |caracitem key|}} - - {{/each}} - {{/select}} - +
+ + +
+ + Sans appel au moral +
+
-
- - {{#select diffConditions}} {{#each ajustementsConditions as |key|}} {{/each}} {{/select}} - - - -
+ + + +
-
-
-
-
-
-
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/templates/dialog-roll-jeu.html b/templates/dialog-roll-jeu.html index 0ccf3b77..c8336994 100644 --- a/templates/dialog-roll-jeu.html +++ b/templates/dialog-roll-jeu.html @@ -1,46 +1,52 @@
-
-
    -
  • -
  • -
  • -
  • -
-
-
- - - - + {{#select carac}} + {{#each carac as |caracitem key|}} + + {{/each}} + {{/select}} + +
+ + Sans appel au moral +
+
+
+ + - - -
+ + + + -
-
-
-
-
-
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/templates/dialog-roll-musique.html b/templates/dialog-roll-musique.html index faa65989..c54c5552 100644 --- a/templates/dialog-roll-musique.html +++ b/templates/dialog-roll-musique.html @@ -1,13 +1,17 @@
    -
  • -
  • +
  • +
+
+ + Sans appel au moral +
- + - + {{#select diffConditions}} {{#each ajustementsConditions as |key|}} @@ -15,7 +19,7 @@ {{/each}} {{/select}} - + {{#select diffConditions}} {{#each ajustementsConditions as |key|}} @@ -17,7 +21,7 @@ {{/each}} {{/select}} - + {{#select diffConditions}} {{#each ajustementsConditions as |key|}} @@ -13,7 +13,7 @@ {{/each}} {{/select}} - + - - + + {{!-- Sheet Body --}}
diff --git a/templates/dialog-roll-ethylisme.html b/templates/dialog-roll-ethylisme.html index 2a74d639..613d6e0b 100644 --- a/templates/dialog-roll-ethylisme.html +++ b/templates/dialog-roll-ethylisme.html @@ -1,13 +1,13 @@
- - - + + +
- + {{#select diffConditions}} {{#each ajustementsConditions as |key|}} diff --git a/templates/dialog-roll-meditation.html b/templates/dialog-roll-meditation.html index 85d089a6..fbd6432c 100644 --- a/templates/dialog-roll-meditation.html +++ b/templates/dialog-roll-meditation.html @@ -2,46 +2,46 @@
  • - - + +
  • - - + +
  • - - + +
  • -
  • +
- +
  • - +
  • - +
  • - +
  • - +
- + {{#select carac}} {{#each carac as |caracitem key|}} @@ -8,23 +8,22 @@ {{/each}} {{/select}} - + - + -
diff --git a/templates/dialog-roll-sort.html b/templates/dialog-roll-sort.html index c32366ef..923ac976 100644 --- a/templates/dialog-roll-sort.html +++ b/templates/dialog-roll-sort.html @@ -1,11 +1,11 @@
- - + +
- + - + {{#select sort}} {{#each sortList as |sort key|}} @@ -35,7 +35,7 @@
- + {{#select ptreve-variable}} {{#each coutreve as |cout key|}} diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index 3d5f9a69..8441eccd 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -9,7 +9,7 @@ {{!-- Sheet Body --}}
- + {{#select item.data.categorie}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-competence.html"}} diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index a77801a0..5672c489 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -9,7 +9,7 @@ {{!-- Sheet Body --}}
- + -
-
-
- Encaisser des dommages - Remise à neuf -
-
-
-
- {{data.blessures.resume}} -
-
-
- - - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Carac Tab --}} -
-
-
-
    - {{#each data.carac as |carac key|}} -
  1. - {{#if carac.isTaille}} - {{carac.label}} - {{else}} - {{carac.label}} - {{/if}} - -
  2. - {{/each}} -
  3. - Total Caractéristiques - {{data.caracSum}} -
  4. -
-
-
-
    - {{#each data.attributs as |attr key|}} -
  1. - {{attr.label}} : - -
  2. - {{/each}} -
  3. - Vie : - / - -
  4. -
  5. - Endurance : - / - -
  6. -
  7. - Sonné : - - -
  8. -
  9. - Etat Général : - {{data.compteurs.etat.value}} -
  10. -
-
-
-
- - {{!-- Compétences Tab --}} -
-
-
-
    - {{#each data.competencecreature as |comp key|}} -
  1. - - {{comp.name}} - - - -
    - - -
    -
  2. - {{/each}} -
-
-
-
- - {{!-- blessures Tab --}} -
- Blessures Légeres : -
- {{#each data.blessures.legeres.liste as |bless key|}} -
  • - {{#if bless.active}}{{else}}{{/if}} - Premiers soins - - Soins complets - - Jours - - - Loc. -
  • - {{/each}} -
    - Blessures Graves : -
    - {{#each data.blessures.graves.liste as |bless key|}} -
  • - {{#if bless.active}}{{else}}{{/if}} - Premiers soins - - Soins complets - - Jours - - - Loc. -
  • - {{/each}} -
    - Blessure Critique : -
    - {{#each data.blessures.critiques.liste as |bless key|}} -
  • - {{#if bless.active}}{{else}}{{/if}} - Premiers soins - - Soins complets - - Jours - - - Loc. -
  • - - {{/each}} -
    -
    - - {{!-- Equipment Tab --}} -
    - Encombrement total/max : {{numberFormat data.encTotal decimals=1}} / {{data.attributs.encombrement.value}} -
      -
    1. - Nom - Q. - Enc. - Equiper - Editer/Suppr. -
    2. - {{#each data.objets as |item id|}} - {{#unless item.estContenu}} - {{#if (ne item.type 'conteneur')}} -
    3. - - {{item.name}} - {{item.data.quantite}} - {{numberFormat item.data.encTotal decimals=2}} - -
    4. - {{/if}} - {{/unless}} - {{/each}} - {{#each data.conteneurs as |conteneur id|}} - {{buildConteneur this}} - {{/each}} -
    - - {{!-- Biography Tab --}} -
    -
    - {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} -
    - {{>"systems/foundryvtt-reve-de-dragon/templates/editor-notes-mj.html"}} -
    - -
    - -
    - \ No newline at end of file From f26ae24d132e0410076c31a3d7a8b451651024a4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 17 Mar 2021 01:21:37 +0100 Subject: [PATCH 6/7] Nettoyage feuilles acteurs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - template partial pour les compétences - séparation des options/calculs/données - extraction de méthodes pour les calculs (total xp, total carac, ...) - déplacement de code de RdDUtility vers RdDItemCompetence / RdDCarac --- module/actor-creature-sheet.js | 33 +- module/actor-entite-sheet.js | 19 +- module/actor-sheet.js | 104 +++--- module/actor-vehicule-sheet.js | 11 +- module/actor.js | 11 +- module/item-competence.js | 90 ++++- module/item-sheet.js | 2 +- module/rdd-carac.js | 102 ++++++ module/rdd-commands.js | 3 +- module/rdd-utility.js | 104 +----- templates/actor-creature-sheet.html | 10 +- templates/actor-entite-sheet.html | 9 +- templates/actor-sheet-competence-partial.html | 31 ++ templates/actor-sheet.html | 312 +++--------------- templates/actor-vehicule-sheet.html | 4 +- templates/editor-notes-mj.html | 2 +- 16 files changed, 376 insertions(+), 471 deletions(-) diff --git a/module/actor-creature-sheet.js b/module/actor-creature-sheet.js index e3ad06fd..e0429e53 100644 --- a/module/actor-creature-sheet.js +++ b/module/actor-creature-sheet.js @@ -7,6 +7,7 @@ import { HtmlUtility } from "./html-utility.js"; import { RdDUtility } from "./rdd-utility.js"; import { RdDActorSheet } from "./actor-sheet.js"; +import { RdDCarac } from "./rdd-carac.js"; /* -------------------------------------------- */ export class RdDActorCreatureSheet extends RdDActorSheet { @@ -25,37 +26,21 @@ export class RdDActorCreatureSheet extends RdDActorSheet { /* -------------------------------------------- */ - getData() { - let formData = super.getDData(); + async getData() { + let formData = await super.getData(); console.log("Creature : ", formData); - - formData.itemsByType = {}; - for (const item of formData.items) { - let list = formData.itemsByType[item.type]; - if (!list) { - list = []; - formData.itemsByType[item.type] = list; - } - list.push(item); + formData.calc = { + caracTotal: RdDCarac.computeTotal(formData.data.carac), + resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), + encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), } - - // Compute current carac sum - let sum = 0; - Object.values(formData.data.carac).forEach(carac => { if (!carac.derivee) { sum += parseInt(carac.value) } }); - formData.data.caracSum = sum; - - formData.data.carac.taille.isTaille = true; // To avoid button link; - formData.data.blessures.resume = this.actor.computeResumeBlessure(formData.data.blessures); - - formData.data.isGM = game.user.isGM; + formData.calc.surEncombrementMessage = (formData.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : ""; + formData.options.isGM = game.user.isGM; formData.data.competencecreature = formData.itemsByType["competencecreature"]; - this.actor.computeEncombrementTotalEtMalusArmure(); RdDUtility.filterItemsPerTypeForSheet(formData); RdDUtility.buildArbreDeConteneur(this, formData); - formData.data.encTotal = this.actor.encTotal; - formData.data.isGM = game.user.isGM; console.log("Creature : ", this.objetVersConteneur, formData); diff --git a/module/actor-entite-sheet.js b/module/actor-entite-sheet.js index 407b6b40..1b7afc01 100644 --- a/module/actor-entite-sheet.js +++ b/module/actor-entite-sheet.js @@ -4,6 +4,7 @@ */ import { HtmlUtility } from "./html-utility.js"; +import { Misc } from "./misc.js"; /* -------------------------------------------- */ export class RdDActorEntiteSheet extends ActorSheet { @@ -29,22 +30,16 @@ export class RdDActorEntiteSheet extends ActorSheet { } /* -------------------------------------------- */ - getData() { + async getData() { let formData = super.getData(); - formData.itemsByType = {}; - for (const item of formData.items) { - let list = formData.itemsByType[item.type]; - if (!list) { - list = []; - formData.itemsByType[item.type] = list; - } - list.push(item); - } - + formData.itemsByType = Misc.classify(formData.items); + + formData.options.isGM = game.user.isGM; + formData.data.carac.taille.isTaille = true; // To avoid button link; formData.data.competencecreature = formData.itemsByType["competencecreature"]; - formData.data.isGM = game.user.isGM; + return formData; } diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 6b725a9a..6abc9c39 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -10,6 +10,7 @@ import { RdDItemCompetence } from "./item-competence.js"; import { RdDBonus } from "./rdd-bonus.js"; import { Misc } from "./misc.js"; import { RdDCombatManager } from "./rdd-combat.js"; +import { RdDCarac } from "./rdd-carac.js"; /* -------------------------------------------- */ export class RdDActorSheet extends ActorSheet { @@ -31,51 +32,66 @@ export class RdDActorSheet extends ActorSheet { } /* -------------------------------------------- */ - getData() { + async getData() { let formData = super.getData(); + // -------------- version 0.7.9 + // let formData = { + // cssClass: this.entity.owner ? "editable" : "locked", + // editable: this.isEditable, + // entity: duplicate(this.entity.data), + // limited: this.entity.limited, + // options: this.options, + // owner: this.entity.owner, + // title: this.title + // } + // // Entity data + // formData.actor = formData.entity; + // formData.data = formData.entity.data; - if (formData.actor.type == 'creature' || formData.actor.type == 'humanoide') return formData; // Shortcut - - formData.data.editCaracComp = this.options.editCaracComp; - formData.data.showCompNiveauBase = this.options.showCompNiveauBase; - formData.data.montrerArchetype = this.options.montrerArchetype; + // // Owned items + // formData.items = formData.actor.items; + // formData.items.sort((a, b) => (a.sort || 0) - (b.sort || 0)); formData.itemsByType = Misc.classify(formData.items); + RdDUtility.filterItemsPerTypeForSheet(formData); - // Competence per category - formData.data.comptageArchetype = RdDUtility.getLimitesArchetypes(); - formData.data.competenceXPTotal = 0; - formData.competenceByCategory = Misc.classify( - formData.itemsByType.competence, - item => item.data.categorie, - item => { - let archetypeKey = (item.data.niveau_archetype < 0) ? 0 : item.data.niveau_archetype; - if (formData.data.comptageArchetype[archetypeKey] == undefined) { - formData.data.comptageArchetype[archetypeKey] = { "niveau": archetypeKey, "nombreMax": 0, "nombre": 0 }; - } - formData.data.comptageArchetype[archetypeKey].nombre = (formData.data.comptageArchetype[archetypeKey]?.nombre ?? 0) + 1; //Comptage archetype - item.data.xpNext = RdDItemCompetence.getCompetenceNextXp(item.data.niveau); - item.data.isLevelUp = item.data.xp >= item.data.xpNext; // Flag de niveau à MAJ - //this.actor.checkCompetenceXP(item.name); // Petite vérification experience - item.data.showCompetence = !formData.data.showCompNiveauBase || (Number(item.data.niveau) != Number(RdDItemCompetence.getLevelCategory(item.data.categorie))); - // Ignorer les compétences 'troncs' à ce stade - formData.data.competenceXPTotal += RdDItemCompetence.computeCompetenceXPCost(item); - return item; - }); - formData.data.competenceXPTotal -= RdDItemCompetence.computeEconomieCompetenceTroncXP(formData.itemsByType.competence); + formData.options.isGM = game.user.isGM; + + // la taille est la taille: on ne peut pas l'utiliser pour un jet + formData.data.carac.taille.isTaille = true; + + if (this.actor.data.type == 'creature') return formData; // Shortcut + + // toujours avoir une liste d'armes (pour mettre esquive et corps à corps) + formData.itemsByType.arme = formData.itemsByType.arme ?? []; + + formData.competenceByCategory = Misc.classify(formData.data.competences, item => item.data.categorie); + + formData.calc = { + comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.data.competences), + competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.data.competences), + caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute), + // Mise à jour de l'encombrement total et du prix de l'équipement + encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), + prixTotalEquipement: await this.actor.computePrixTotalEquipement(), + surprise: RdDBonus.find(this.actor.getSurprise(false)).descr, + fatigue: { + malus: RdDUtility.calculMalusFatigue(formData.data.sante.fatigue.value, formData.data.sante.endurance.max), + html: "" + RdDUtility.makeHTMLfatigueMatrix(formData.data.sante.fatigue.value, formData.data.sante.endurance.max).html() + "
    " + }, + resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), + }; + formData.calc.surEncombrementMessage = (formData.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : ""; + + formData.data.competences.forEach(item => { + item.visible = !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item); + RdDItemCompetence.levelUp(item); + }); + + Object.values(formData.data.carac).forEach(c => { + RdDCarac.levelUp(c); + }); - // Compute current carac sum - let sum = 0; - for (let caracName in formData.data.carac) { - let currentCarac = formData.data.carac[caracName]; - if (!currentCarac.derivee) { - sum += parseInt(currentCarac.value); - } - currentCarac.xpNext = RdDUtility.getCaracNextXp(currentCarac.value); - currentCarac.isLevelUp = (currentCarac.xp >= currentCarac.xpNext); - } - sum += (formData.data.beaute >= 0) ? (formData.data.beaute - 10) : 0; - formData.data.caracSum = sum; // Force empty arme, at least for Esquive if (formData.itemsByType.arme == undefined) formData.itemsByType.arme = []; @@ -112,14 +128,9 @@ export class RdDActorSheet extends ActorSheet { formData.data.blessures.resume = this.actor.computeResumeBlessure(formData.data.blessures); // Mise à jour de l'encombrement total et du prix de l'équipement - this.actor.computeEncombrementTotalEtMalusArmure(); - this.actor.computePrixTotalEquipement(); // Common data formData.data.competenceByCategory = formData.competenceByCategory; - formData.data.encTotal = this.actor.encTotal; - formData.data.prixTotalEquipement = this.actor.prixTotalEquipement; - formData.data.surprise = RdDBonus.find(this.actor.getSurprise(false)).descr; formData.data.isGM = game.user.isGM; formData.ajustementsConditions = CONFIG.RDD.ajustementsConditions; formData.difficultesLibres = CONFIG.RDD.difficultesLibres; @@ -135,13 +146,16 @@ export class RdDActorSheet extends ActorSheet { formData.data.rencontres = duplicate(formData.data.reve.rencontre.list); formData.data.caseSpeciales = formData.itemsByType['casetmr']; RdDUtility.buildArbreDeConteneur(this, formData); - formData.data.surEncombrementMessage = (formData.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : ""; formData.data.vehiculesList = this.actor.buildVehiculesList(); formData.data.monturesList = this.actor.buildMonturesList(); formData.data.suivantsList = this.actor.buildSuivantsList(); return formData; } + isCompetenceAffichable(competence) { + return !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(competence); + } + /* -------------------------------------------- */ async _onDrop(event) { let toSuper = await RdDUtility.processItemDropEvent(this, event); diff --git a/module/actor-vehicule-sheet.js b/module/actor-vehicule-sheet.js index be5f4f19..e9cfc46e 100644 --- a/module/actor-vehicule-sheet.js +++ b/module/actor-vehicule-sheet.js @@ -33,7 +33,7 @@ export class RdDActorVehiculeSheet extends ActorSheet { } /* -------------------------------------------- */ - getData() { + async getData() { let formData = super.getData(); formData.itemsByType = Misc.classify(formData.items); @@ -41,9 +41,12 @@ export class RdDActorVehiculeSheet extends ActorSheet { RdDUtility.filterItemsPerTypeForSheet(formData); RdDUtility.buildArbreDeConteneur(this, formData); - this.actor.computeEncombrementTotalEtMalusArmure(); - formData.data.isGM = game.user.isGM; - formData.data.surEncombrementMessage = (this.encTotal > formData.capacite_encombrement) ? "Sur-Encombrement!" : ""; + formData.options.isGM = game.user.isGM; + + formData.calc ={ + encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), + } + formData.calc.surEncombrementMessage = formData.calc.encTotal > formData.data.capacite_encombrement ? "Sur-Encombrement!" : "", console.log("DATA", formData); diff --git a/module/actor.js b/module/actor.js index ce68b6a4..d7ac680c 100644 --- a/module/actor.js +++ b/module/actor.js @@ -25,6 +25,7 @@ import { TMRRencontres } from "./tmr-rencontres.js"; import { Poetique } from "./poetique.js"; import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; import { Draconique } from "./tmr/draconique.js"; +import { RdDCarac } from "./rdd-carac.js"; /* -------------------------------------------- */ @@ -139,7 +140,7 @@ export class RdDActor extends Actor { */ async _prepareCharacterData(actorData) { // Initialize empty items - RdDUtility.computeCarac(actorData.data); + RdDCarac.computeCarac(actorData.data); this.computeEncombrementTotalEtMalusArmure(); this.computePrixTotalEquipement(); this.computeEtatGeneral(); @@ -736,7 +737,7 @@ export class RdDActor extends Actor { let comp = this.getCompetence(compName); if (comp) { let troncList = RdDItemCompetence.isTronc(compName); - let nouveauNiveau = compValue ?? RdDItemCompetence.getLevelCategory(comp.data.categorie); + let nouveauNiveau = compValue ?? RdDItemCompetence.getNiveauBase(comp.data.categorie); if (troncList) { let message = "Vous avez modifié une compétence 'tronc'. Vérifiez que les compétences suivantes évoluent ensemble jusqu'au niveau 0 : "; for (let troncName of troncList) { @@ -1015,6 +1016,7 @@ export class RdDActor extends Actor { malusArmureData.value = newMalusArmure; await this.update({ "data.attributs.malusarmure": malusArmureData }); } + return this.encTotal; } /* -------------------------------------------- */ @@ -1032,6 +1034,7 @@ export class RdDActor extends Actor { } // Mise à jour valeur totale de l'équipement this.prixTotalEquipement = prixTotalEquipement; + return prixTotalEquipement; } /* -------------------------------------------- */ @@ -1310,7 +1313,7 @@ export class RdDActor extends Actor { if (this.isEntiteCauchemar()) { return 0; } - return RdDUtility.calculSConst(this.data.data.carac.constitution.value); + return RdDCarac.calculSConst(this.data.data.carac.constitution.value); } /* -------------------------------------------- */ @@ -1716,7 +1719,7 @@ export class RdDActor extends Actor { async checkCaracXP(caracName) { let carac = this.data.data.carac[caracName]; if (carac && carac.xp > 0) { - let xpNeeded = RdDUtility.getCaracNextXp(carac.value + 1); + let xpNeeded = RdDCarac.getCaracNextXp(carac.value + 1); if (carac.xp >= xpNeeded) { carac = duplicate(carac); carac.value = Number(carac.value) + 1; diff --git a/module/item-competence.js b/module/item-competence.js index 2820001a..2f947f17 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -1,9 +1,23 @@ - const competenceTroncs = [["Esquive", "Dague", "Corps à corps"], ["Epée à 1 main", "Epée à 2 mains", "Hache à 1 main", "Hache à 2 mains", "Lance", "Masse à 1 main", "Masse à 2 mains"]]; const competence_xp_par_niveau = [5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 30, 30, 40, 40, 60, 60, 100, 100, 100, 100, 100, 100, 100, 100, 100]; const competence_niveau_max = competence_xp_par_niveau.length - 10; +/* -------------------------------------------- */ +const limitesArchetypes = [ + { "niveau": 0, "nombreMax": 100, "nombre": 0 }, + { "niveau": 1, "nombreMax": 10, "nombre": 0 }, + { "niveau": 2, "nombreMax": 9, "nombre": 0 }, + { "niveau": 3, "nombreMax": 8, "nombre": 0 }, + { "niveau": 4, "nombreMax": 7, "nombre": 0 }, + { "niveau": 5, "nombreMax": 6, "nombre": 0 }, + { "niveau": 6, "nombreMax": 5, "nombre": 0 }, + { "niveau": 7, "nombreMax": 4, "nombre": 0 }, + { "niveau": 8, "nombreMax": 3, "nombre": 0 }, + { "niveau": 9, "nombreMax": 2, "nombre": 0 }, + { "niveau": 10, "nombreMax": 1, "nombre": 0 }, + { "niveau": 11, "nombreMax": 1, "nombre": 0 } +]; /* -------------------------------------------- */ const categorieCompetences = { @@ -35,10 +49,10 @@ export class RdDItemCompetence extends Item { static getCategorieCompetences() { return categorieCompetences; } - static getLevelCategory(category) { + static getNiveauBase(category) { return categorieCompetences[category].level; } - static getLabelCategory(category) { + static getLabelCategorie(category) { return categorieCompetences[category].label; } @@ -77,6 +91,44 @@ export class RdDItemCompetence extends Item { } return false; } + + /* -------------------------------------------- */ + static computeTotalXP(competences) { + const total = competences.map(c => RdDItemCompetence.computeXP(c)) + .reduce((a, b) => a + b, 0); + const economieTronc = RdDItemCompetence.computeEconomieXPTronc(competences); + return total - economieTronc; + } + + /* -------------------------------------------- */ + static computeXP(competence) { + const factor = competence.name.includes('Thanatos') ? 2 : 1; // Thanatos compte double ! + const xpNiveau = RdDItemCompetence.computeDeltaXP(competence.data.base, competence.data.niveau ?? competence.data.base); + const xp = competence.data.xp ?? 0; + const xpSort = competence.data.xp_sort ?? 0; + return factor * (xpNiveau + xp) + xpSort; + } + + /* -------------------------------------------- */ + static computeEconomieXPTronc(competences) { + return competenceTroncs.map( + list => list.map(name => RdDItemCompetence.findCompetence(competences, name)) + // calcul du coût xp jusqu'au niveau 0 maximum + .map(it => RdDItemCompetence.computeDeltaXP(it?.data.base ?? -11, Math.min(it?.data.niveau ?? -11, 0))) + .sort((a, b) => b - a) // tri descendant + .splice(0, 1) // ignorer le coût xp le plus élevé + .reduce((a, b) => a + b, 0) + ).reduce((a, b) => a + b, 0); + } + + /* -------------------------------------------- */ + static computeDeltaXP(from, to) { + RdDItemCompetence._valideNiveau(from); + RdDItemCompetence._valideNiveau(to); + return competence_xp_cumul[to] - competence_xp_cumul[from]; + } + + /* -------------------------------------------- */ static computeCompetenceXPCost(competence) { let xp = RdDItemCompetence.getDeltaXp(competence.data.base, competence.data.niveau ?? competence.data.base); @@ -100,6 +152,20 @@ export class RdDItemCompetence extends Item { return economie; } + static levelUp(item) { + item.data.xpNext = RdDItemCompetence.getCompetenceNextXp(item.data.niveau); + item.data.isLevelUp = item.data.xp >= item.data.xpNext; + } + + static isVisible(item) { + return Number(item.data.niveau) != RdDItemCompetence.getNiveauBase(item.data.categorie); + } + + /* -------------------------------------------- */ + static isNiveauBase(item) { + return Number(item.data.niveau) == RdDItemCompetence.getNiveauBase(item.data.categorie); + } + /* -------------------------------------------- */ static findCompetence(list, name) { name = name.toLowerCase(); @@ -127,8 +193,24 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static _valideNiveau(niveau){ if (niveau < -11 || niveau > competence_niveau_max) { - console.warn("Niveau en dehors des niveaux de compétences: [-11, " + competence_niveau_max + "]", niveau) + console.warn(`Niveau ${niveau} en dehors des niveaux de compétences: [-11, ${competence_niveau_max} ]`); } } + + /* -------------------------------------------- */ + static computeResumeArchetype(competences) { + const archetype = RdDItemCompetence.getLimitesArchetypes(); + competences.forEach(item => { + let niveau = (item.data.niveau_archetype < 0) ? 0 : item.data.niveau_archetype; + archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 }; + archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1; + }); + return archetype; + } + /* -------------------------------------------- */ + static getLimitesArchetypes() { + return duplicate(limitesArchetypes); + } + } \ No newline at end of file diff --git a/module/item-sheet.js b/module/item-sheet.js index 904e4f6e..1808ec81 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -111,7 +111,7 @@ export class RdDItemSheet extends ItemSheet { async _onClickSelectCategorie(event) { event.preventDefault(); - let level = RdDItemCompetence.getLevelCategory(event.currentTarget.value); + let level = RdDItemCompetence.getNiveauBase(event.currentTarget.value); this.object.data.data.base = level; $("#base").val( level ); } diff --git a/module/rdd-carac.js b/module/rdd-carac.js index 337212b2..516b4f9f 100644 --- a/module/rdd-carac.js +++ b/module/rdd-carac.js @@ -1,4 +1,41 @@ import { Grammar } from "./grammar.js"; +import { RdDUtility } from "./rdd-utility.js"; + +const tableCaracDerivee = { + // xp: coût pour passer du niveau inférieur à ce niveau + 1: { xp: 3, poids: "moins de 1kg", plusdom: -5, sconst: 0.5, sust: 0.1 }, + 2: { xp: 3, poids: "1-5", plusdom: -4, sconst: 0.5, sust: 0.3 }, + 3: { xp: 4, poids: "6-10", plusdom: -3, sconst: 1, sust: 0.5, beaute: 'hideux' }, + 4: { xp: 4, poids: "11-20", plusdom: -3, sconst: 1, sust: 1, beaute: 'repoussant' }, + 5: { xp: 5, poids: "21-30", plusdom: -2, sconst: 1, sust: 1, beaute: 'franchement très laid' }, + 6: { xp: 5, poids: "31-40", plusdom: -1, sconst: 2, sust: 2, beaute: 'laid' }, + 7: { xp: 6, poids: "41-50", plusdom: -1, sconst: 2, sust: 2, beaute: 'très désavantagé' }, + 8: { xp: 6, poids: "51-60", plusdom: 0, sconst: 2, sust: 2, beaute: 'désavantagé' }, + 9: { xp: 7, poids: "61-65", plusdom: 0, sconst: 3, sust: 2, beaute: 'pas terrible' }, + 10: { xp: 7, poids: "66-70", plusdom: 0, sconst: 3, sust: 3, beaute: 'commun' }, + 11: { xp: 8, poids: "71-75", plusdom: 0, sconst: 3, sust: 3, beaute: 'pas mal' }, + 12: { xp: 8, poids: "76-80", plusdom: +1, sconst: 4, sust: 3, beaute: 'avantagé' }, + 13: { xp: 9, poids: "81-90", plusdom: +1, sconst: 4, sust: 3, beaute: 'mignon' }, + 14: { xp: 9, poids: "91-100", plusdom: +2, sconst: 4, sust: 4, beaute: 'beau' }, + 15: { xp: 10, poids: "101-110", plusdom: +2, sconst: 5, sust: 4, beaute: 'très beau' }, + 16: { xp: 20, poids: "111-120", plusdom: +3, sconst: 5, sust: 4, beaute: 'éblouissant' }, + 17: { xp: 30, poids: "121-131", plusdom: +3, sconst: 5, sust: 5 }, + 18: { xp: 40, poids: "131-141", plusdom: +4, sconst: 6, sust: 5 }, + 19: { xp: 50, poids: "141-150", plusdom: +4, sconst: 6, sust: 5 }, + 20: { xp: 60, poids: "151-160", plusdom: +4, sconst: 6, sust: 6 }, + 21: { xp: 70, poids: "161-180", plusdom: +5, sconst: 7, sust: 6 }, + 22: { xp: 80, poids: "181-200", plusdom: +5, sconst: 7, sust: 7 }, + 23: { xp: 90, poids: "201-300", plusdom: +6, sconst: 7, sust: 8 }, + 24: { xp: 100, poids: "301-400", plusdom: +6, sconst: 8, sust: 9 }, + 25: { xp: 110, poids: "401-500", plusdom: +7, sconst: 8, sust: 10 }, + 26: { xp: 120, poids: "501-600", plusdom: +7, sconst: 8, sust: 11 }, + 27: { xp: 130, poids: "601-700", plusdom: +8, sconst: 9, sust: 12 }, + 28: { xp: 140, poids: "701-800", plusdom: +8, sconst: 9, sust: 13 }, + 29: { xp: 150, poids: "801-900", plusdom: +9, sconst: 9, sust: 14 }, + 30: { xp: 160, poids: "901-1000", plusdom: +9, sconst: 10, sust: 15 }, + 31: { xp: 170, poids: "1001-1500", plusdom: +10, sconst: 10, sust: 16 }, + 32: { xp: 180, poids: "1501-2000", plusdom: +11, sconst: 10, sust: 17 } +}; export class RdDCarac { @@ -21,6 +58,37 @@ export class RdDCarac { (RdDCarac.isReve(selectedCarac) && !competence); } + + static computeTotal(carac, beaute = undefined) { + const total = Object.values(carac).filter(c => !c.derivee) + .map(it => parseInt(it.value)) + .reduce((a, b) => a + b, 0); + const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0); + return total + beauteSuperieur10; + } + + static levelUp(it) { + it.xpNext = RdDCarac.getCaracNextXp(it.value); + it.isLevelUp = (it.xp >= it.xpNext); + } + + /* -------------------------------------------- */ + static calculSConst(constitution) { + return Number(tableCaracDerivee[Number(constitution)].sconst); + } + + /* -------------------------------------------- */ + static getCaracNextXp(value) { + const nextValue = Number(value) + 1; + // xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1 + return RdDCarac.getCaracXp(nextValue); + } + + static getCaracXp(targetValue) { + return tableCaracDerivee[targetValue]?.xp ?? 200; + } + + /** * L’appel à la chance n’est possible que pour recommencer les jets d’actions physiques : * tous les jets de combat, de FORCE, d’AGILITÉ, de DEXTÉRITÉ, de Dérobée, d’APPARENCE, @@ -29,4 +97,38 @@ export class RdDCarac { static isActionPhysique(selectedCarac) { return Grammar.toLowerCaseNoAccent(selectedCarac?.label).match(/(apparence|force|agilite|dexterite|vue|ouie|odorat|empathie|melee|tir|lancer|derobee)/); } + + /* -------------------------------------------- */ + static computeCarac(data) { + data.carac.force.value = Math.min(data.carac.force.value, parseInt(data.carac.taille.value) + 4); + + data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2); + let bonusDomKey = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2); + bonusDomKey = Math.min(Math.max(bonusDomKey, 0), 32); // Clamp de securite + + let tailleData = tableCaracDerivee[bonusDomKey]; + data.attributs.plusdom.value = tailleData.plusdom; + + data.attributs.sconst.value = RdDCarac.calculSConst(data.carac.constitution.value); + data.attributs.sust.value = tableCaracDerivee[Number(data.carac.taille.value)].sust; + + data.attributs.encombrement.value = (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2; + data.carac.melee.value = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.agilite.value)) / 2); + data.carac.tir.value = Math.floor((parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2); + data.carac.lancer.value = Math.floor((parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2); + + data.sante.vie.max = Math.ceil((parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) / 2); + + data.sante.vie.value = Math.min(data.sante.vie.value, data.sante.vie.max) + data.sante.endurance.max = Math.max(parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value)); + data.sante.endurance.value = Math.min(data.sante.endurance.value, data.sante.endurance.max); + data.sante.fatigue.max = data.sante.endurance.max * 2; + data.sante.fatigue.value = Math.min(data.sante.fatigue.value, data.sante.fatigue.max); + + //Compteurs + data.reve.reve.max = data.carac.reve.value; + data.compteurs.chance.max = data.carac.chance.value; + } + + } diff --git a/module/rdd-commands.js b/module/rdd-commands.js index 3c01d0a2..317b62bf 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -3,6 +3,7 @@ import { DeDraconique } from "./de-draconique.js"; import { RdDItemCompetence } from "./item-competence.js"; import { Misc } from "./misc.js"; +import { RdDCarac } from "./rdd-carac.js"; import { RdDDice } from "./rdd-dice.js"; import { RdDNameGen } from "./rdd-namegen.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; @@ -266,7 +267,7 @@ export class RdDCommands { getCoutXpCarac(msg, params) { if (params && params.length == 1) { let to = Number(params[0]); - RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDUtility.getCaracXp(to)}`); + RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`); } else { return false; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 979b74b8..939c2d4c 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -5,22 +5,6 @@ import { RdDCombat } from "./rdd-combat.js"; import { Misc } from "./misc.js"; import { Grammar } from "./grammar.js"; -/* -------------------------------------------- */ -const limitesArchetypes = [ - { "niveau": 0, "nombreMax": 100, "nombre": 0 }, - { "niveau": 1, "nombreMax": 10, "nombre": 0 }, - { "niveau": 2, "nombreMax": 9, "nombre": 0 }, - { "niveau": 3, "nombreMax": 8, "nombre": 0 }, - { "niveau": 4, "nombreMax": 7, "nombre": 0 }, - { "niveau": 5, "nombreMax": 6, "nombre": 0 }, - { "niveau": 6, "nombreMax": 5, "nombre": 0 }, - { "niveau": 7, "nombreMax": 4, "nombre": 0 }, - { "niveau": 8, "nombreMax": 3, "nombre": 0 }, - { "niveau": 9, "nombreMax": 2, "nombre": 0 }, - { "niveau": 10, "nombreMax": 1, "nombre": 0 }, - { "niveau": 11, "nombreMax": 1, "nombre": 0 } -]; - /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; @@ -28,42 +12,6 @@ const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]; const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10]; const ajustementsEncaissement = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25]; -const tableCaracDerivee = { - // xp: coût pour passer du niveau inférieur à ce niveau - 1: { xp: 3, poids: "moins de 1kg", plusdom: -5, sconst: 0.5, sust: 0.1 }, - 2: { xp: 3, poids: "1-5", plusdom: -4, sconst: 0.5, sust: 0.3 }, - 3: { xp: 4, poids: "6-10", plusdom: -3, sconst: 1, sust: 0.5, beaute: 'hideux' }, - 4: { xp: 4, poids: "11-20", plusdom: -3, sconst: 1, sust: 1, beaute: 'repoussant' }, - 5: { xp: 5, poids: "21-30", plusdom: -2, sconst: 1, sust: 1, beaute: 'franchement très laid' }, - 6: { xp: 5, poids: "31-40", plusdom: -1, sconst: 2, sust: 2, beaute: 'laid' }, - 7: { xp: 6, poids: "41-50", plusdom: -1, sconst: 2, sust: 2, beaute: 'très désavantagé' }, - 8: { xp: 6, poids: "51-60", plusdom: 0, sconst: 2, sust: 2, beaute: 'désavantagé' }, - 9: { xp: 7, poids: "61-65", plusdom: 0, sconst: 3, sust: 2, beaute: 'pas terrible' }, - 10: { xp: 7, poids: "66-70", plusdom: 0, sconst: 3, sust: 3, beaute: 'commun' }, - 11: { xp: 8, poids: "71-75", plusdom: 0, sconst: 3, sust: 3, beaute: 'pas mal' }, - 12: { xp: 8, poids: "76-80", plusdom: +1, sconst: 4, sust: 3, beaute: 'avantagé' }, - 13: { xp: 9, poids: "81-90", plusdom: +1, sconst: 4, sust: 3, beaute: 'mignon' }, - 14: { xp: 9, poids: "91-100", plusdom: +2, sconst: 4, sust: 4, beaute: 'beau' }, - 15: { xp: 10, poids: "101-110", plusdom: +2, sconst: 5, sust: 4, beaute: 'très beau' }, - 16: { xp: 20, poids: "111-120", plusdom: +3, sconst: 5, sust: 4, beaute: 'éblouissant' }, - 17: { xp: 30, poids: "121-131", plusdom: +3, sconst: 5, sust: 5 }, - 18: { xp: 40, poids: "131-141", plusdom: +4, sconst: 6, sust: 5 }, - 19: { xp: 50, poids: "141-150", plusdom: +4, sconst: 6, sust: 5 }, - 20: { xp: 60, poids: "151-160", plusdom: +4, sconst: 6, sust: 6 }, - 21: { xp: 70, poids: "161-180", plusdom: +5, sconst: 7, sust: 6 }, - 22: { xp: 80, poids: "181-200", plusdom: +5, sconst: 7, sust: 7 }, - 23: { xp: 90, poids: "201-300", plusdom: +6, sconst: 7, sust: 8 }, - 24: { xp: 100, poids: "301-400", plusdom: +6, sconst: 8, sust: 9 }, - 25: { xp: 110, poids: "401-500", plusdom: +7, sconst: 8, sust: 10 }, - 26: { xp: 120, poids: "501-600", plusdom: +7, sconst: 8, sust: 11 }, - 27: { xp: 130, poids: "601-700", plusdom: +8, sconst: 9, sust: 12 }, - 28: { xp: 140, poids: "701-800", plusdom: +8, sconst: 9, sust: 13 }, - 29: { xp: 150, poids: "801-900", plusdom: +9, sconst: 9, sust: 14 }, - 30: { xp: 160, poids: "901-1000", plusdom: +9, sconst: 10, sust: 15 }, - 31: { xp: 170, poids: "1001-1500", plusdom: +10, sconst: 10, sust: 16 }, - 32: { xp: 180, poids: "1501-2000", plusdom: +11, sconst: 10, sust: 17 } -} - /* -------------------------------------------- */ function _buildAllSegmentsFatigue(max) { const cycle = [5, 2, 4, 1, 3, 0]; @@ -243,10 +191,6 @@ export class RdDUtility { return loadTemplates(templatePaths); } - /* -------------------------------------------- */ - static getLimitesArchetypes() { - return duplicate(limitesArchetypes); - } /* -------------------------------------------- */ static checkNull(items) { @@ -312,6 +256,7 @@ export class RdDUtility { .concat(formData.data.potions) .concat(formData.data.herbes) .concat(formData.data.ingredients); + formData.data.competences = (formData.itemsByType.competence??[]).concat(formData.itemsByType.competencecreature??[]); } /* -------------------------------------------- */ @@ -410,53 +355,6 @@ export class RdDUtility { return definitionsBlessures; } - /* -------------------------------------------- */ - static getCaracNextXp(value) { - const nextValue = Number(value) + 1; - // xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1 - return RdDUtility.getCaracXp(nextValue); - } - - static getCaracXp(targetValue) { - return tableCaracDerivee[targetValue]?.xp ?? 200; - } - - /* -------------------------------------------- */ - static computeCarac(data) { - data.carac.force.value = Math.min(data.carac.force.value, parseInt(data.carac.taille.value) + 4); - - data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2); - let bonusDomKey = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2); - bonusDomKey = Math.min(Math.max(bonusDomKey, 0), 32); // Clamp de securite - - let tailleData = tableCaracDerivee[bonusDomKey]; - data.attributs.plusdom.value = tailleData.plusdom; - - data.attributs.sconst.value = RdDUtility.calculSConst(data.carac.constitution.value); - data.attributs.sust.value = tableCaracDerivee[Number(data.carac.taille.value)].sust; - - data.attributs.encombrement.value = (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2; - data.carac.melee.value = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.agilite.value)) / 2); - data.carac.tir.value = Math.floor((parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2); - data.carac.lancer.value = Math.floor((parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2); - - data.sante.vie.max = Math.ceil((parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) / 2); - - data.sante.vie.value = Math.min(data.sante.vie.value, data.sante.vie.max) - data.sante.endurance.max = Math.max(parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value)); - data.sante.endurance.value = Math.min(data.sante.endurance.value, data.sante.endurance.max); - data.sante.fatigue.max = data.sante.endurance.max * 2; - data.sante.fatigue.value = Math.min(data.sante.fatigue.value, data.sante.fatigue.max); - - //Compteurs - data.reve.reve.max = data.carac.reve.value; - data.compteurs.chance.max = data.carac.chance.value; - } - - static calculSConst(constitution) { - return Number(tableCaracDerivee[Number(constitution)].sconst); - } - /* -------------------------------------------- */ static getSegmentsFatigue(maxEnd) { maxEnd = Math.max(maxEnd, 1); diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index 1901d9eb..599c23a8 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -15,17 +15,17 @@
    - {{data.blessures.resume}} + {{calc.resumeBlessures}}
    - {{#if data.surprise}}{{data.surprise}}! {{/if}} + {{#if calc.surprise}}{{calc.surprise}}! {{/if}} {{#if actor.effects}} {{#each actor.effects as |effect key|}} {{effect.label}} {{/each}} - {{#if data.isGM}} + {{#if options.isGM}} (enlever tout) {{/if}} {{else}} @@ -199,9 +199,9 @@ {{!-- Equipment Tab --}}
    - Encombrement total/max : {{numberFormat data.encTotal decimals=1}} / {{data.attributs.encombrement.value}} {{data.surEncombrementMessage}} - + Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} {{calc.surEncombrementMessage}} - Créer un objet - {{#if data.isGM}} + {{#if options.isGM}} - Vider tout les conteneurs {{/if}}
      diff --git a/templates/actor-entite-sheet.html b/templates/actor-entite-sheet.html index 1f03d5cd..907935df 100644 --- a/templates/actor-entite-sheet.html +++ b/templates/actor-entite-sheet.html @@ -75,14 +75,11 @@
    • {{comp.name}} - - -
      diff --git a/templates/actor-sheet-competence-partial.html b/templates/actor-sheet-competence-partial.html index e69de29b..7d938044 100644 --- a/templates/actor-sheet-competence-partial.html +++ b/templates/actor-sheet-competence-partial.html @@ -0,0 +1,31 @@ +{{#if visible}} +{{#if data.isLevelUp}} +
    • + {{else}} +
    • + {{/if}} + + {{#if data.isLevelUp}} + + + Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}} + + {{name}} + {{else}} + {{name}} + {{/if}} + + + {{#if (eq data.categorie 'draconic')}} + + {{/if}} +
      + + +
      + {{#if @root.options.montrerArchetype}} + + {{/if}} +
    • +{{/if}} \ No newline at end of file diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index e96e8512..0a23c621 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -29,7 +29,7 @@
    - Malus de fatigue : {{data.fatigue.malus}} - {{{data.fatigue.html}}} + Malus de fatigue : {{calc.fatigue.malus}} + {{{calc.fatigue.html}}} - {{data.blessures.resume}} + {{calc.resumeBlessures}}
    {{data.compteurs.etat.label}}: {{data.compteurs.etat.value}} {{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}
    - {{#if data.surprise}}{{data.surprise}}! {{/if}} + {{#if calc.surprise}}{{calc.surprise}}! {{/if}} {{#if actor.effects}} {{#each actor.effects as |effect key|}} {{effect.label}} {{/each}} - {{#if data.isGM}} + {{#if options.isGM}} (enlever tout) {{/if}} {{else}} @@ -112,8 +112,8 @@
    blocker/débloquer{{#if data.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}} + src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer" + >{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}
      {{#each data.carac as |carac key|}} {{#if carac.isLevelUp}} @@ -123,7 +123,7 @@ {{/if}} {{#if carac.isTaille}} {{carac.label}} - +
    @@ -156,7 +156,7 @@
    • Beauté : - +
    • {{#each data.attributs as |attr key|}} @@ -217,49 +217,25 @@
      blocker/débloquer{{#if data.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}} + src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer" + >{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}} filter/montrer tout{{#if data.showCompNiveauBase}}Montrer tout{{else}}Filtrer{{/if}} + src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.showCompNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout" + >{{#if options.showCompNiveauBase}}Montrer tout{{else}}Filtrer{{/if}} filter/montrer l'archétype{{#if data.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}} + src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.montrerArchetype}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer l'archétype" + >{{#if options.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}}
      + +
      - Compétences de base + Compétences générales
        {{#each data.competenceByCategory.generale as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
      • - {{else}} -
      • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
        - - -
        - {{#if ../data.montrerArchetype}} - - {{/if}} -
      • - {{/if}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
      @@ -268,174 +244,45 @@
        {{#each data.competenceByCategory.particuliere as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
      • - {{else}} -
      • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
        - - -
        - {{#if ../data.montrerArchetype}} - - {{/if}} -
      • - {{/if}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
      -
      + +
      Compétences Spécialisées -
      -
        - {{#each data.competenceByCategory.specialisee as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
      • - {{else}} -
      • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
        - - -
        - {{#if ../data.montrerArchetype}} - - {{/if}} -
      • - {{/if}} +
      +
        + {{#each data.competenceByCategory.specialisee as |comp key|}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}} -
      -
      +
    +
    - Compétences de Mêlée + Compétences de Mêlée
      {{#each data.competenceByCategory.melee as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
    • - {{else}} -
    • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
      - - -
      - {{#if ../data.montrerArchetype}} - - {{/if}} -
    • - {{/if}} - {{/each}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} + {{/each}}
    - +
    - Compétences de Tir + Compétences de Tir
      {{#each data.competenceByCategory.tir as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
    • - {{else}} -
    • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
      - - -
      - {{#if ../data.montrerArchetype}} - - {{/if}} -
    • - {{/if}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
    - +
    - Compétences de Lancer + Compétences de Lancer
      - {{#each data.competenceByCategory.lancer as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
    • - {{else}} -
    • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
      - - -
      - {{#if ../data.montrerArchetype}} - - {{/if}} -
    • - {{/if}} + {{#each data.competenceByCategory.lancer as |comp key|}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
    @@ -444,33 +291,7 @@
      {{#each data.competenceByCategory.connaissance as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
    • - {{else}} -
    • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - -
      - - -
      - {{#if ../data.montrerArchetype}} - - {{/if}} -
    • - {{/if}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
    @@ -479,44 +300,17 @@
      {{#each data.competenceByCategory.draconic as |comp key|}} - {{#if data.showCompetence}} - {{#if comp.data.isLevelUp}} -
    • - {{else}} -
    • - {{/if}} - - {{#if comp.data.isLevelUp}} - - - Vous pouvez dépenser {{comp.data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{comp.name}} - - {{comp.name}} - {{else}} - {{comp.name}} - {{/if}} - - - -
      - - -
      - {{#if ../data.montrerArchetype}} - - {{/if}} -
    • - {{/if}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{/each}}
    • Total XP compétences - {{data.competenceXPTotal}} + {{calc.competenceXPTotal}}
    • - {{#if data.montrerArchetype}} - {{#each data.comptageArchetype as |archetype key|}} + {{#if options.montrerArchetype}} + {{#each calc.comptageArchetype as |archetype key|}}
    • @@ -749,7 +543,7 @@
    • Position en TMR : - {{#if data.isGM}} + {{#if options.isGM}} {{else}} {{data.reve.tmrpos.coord}} @@ -759,7 +553,7 @@
    • Seuil de Rêve : - {{#if data.isGM}} + {{#if options.isGM}} {{else}} {{data.reve.seuil.value}} @@ -769,7 +563,7 @@
    • Refoulement : - {{#if data.isGM}} + {{#if options.isGM}} {{else}} {{data.reve.refoulement.value}} @@ -920,12 +714,12 @@

      Equipement porté

      - Encombrement total/max : {{numberFormat data.encTotal decimals=1}} / {{data.attributs.encombrement.value}} {{data.surEncombrementMessage}} - - Estimation de l'équipement : {{numberFormat data.prixTotalEquipement decimals=2}} Sols + Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} {{calc.surEncombrementMessage}} - + Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols
      Créer un objet - {{#if data.isGM}} + {{#if options.isGM}} - Vider tout les conteneurs {{/if}}
      diff --git a/templates/actor-vehicule-sheet.html b/templates/actor-vehicule-sheet.html index 4b7bfcde..b63c3391 100644 --- a/templates/actor-vehicule-sheet.html +++ b/templates/actor-vehicule-sheet.html @@ -68,9 +68,9 @@ {{!-- Equipment Tab --}}
      - Encombrement total/max : {{numberFormat data.encTotal decimals=1}} / {{data.capacite_encombrement}} {{data.surEncombrementMessage}} - + Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} {{calc.surEncombrementMessage}} - Créer un objet - {{#if data.isGM}} + {{#if options.isGM}} - Vider tout les conteneurs {{/if}}
        diff --git a/templates/editor-notes-mj.html b/templates/editor-notes-mj.html index 54566eb1..c37d5b91 100644 --- a/templates/editor-notes-mj.html +++ b/templates/editor-notes-mj.html @@ -1,4 +1,4 @@ -{{#if data.isGM}} +{{#if options.isGM}}

        Notes du MJ :

        {{editor content=data.notesmj target="data.notesmj" button=true owner=owner editable=editable}} From 0b3b1c66bdd0f19b566b084e7f83bc6b46f65ee8 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 17 Mar 2021 01:26:43 +0100 Subject: [PATCH 7/7] =?UTF-8?q?Pos=C3=A9=20par=20terre=20est=20maintenant?= =?UTF-8?q?=20global?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - accessible à tous les joueurs - lié au token des personnages Ceci permet aux joueurs d'utiliser ce "véhicule" pour échanger des objets --- packs/vehicules.db | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packs/vehicules.db b/packs/vehicules.db index f458efb6..1a4ff269 100644 --- a/packs/vehicules.db +++ b/packs/vehicules.db @@ -5,5 +5,5 @@ {"_id":"RFOYL8HBUxd32DXS","name":"Galère","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"vehicule","data":{"categorie":"Bateau","resistance":36,"structure":14,"vitesse":"2/2/1","bonus":"(12)/+12/+16","manoeuvrabilite":"0/-4/-6","equipage":10,"capacite_encombrement":300,"description":"Description ...","notesmj":"Notes du MJ"},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/galere.webp","token":{"flags":{},"name":"Galère","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/galere_token.webp","tint":"","width":14,"height":14,"scale":1,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"RFOYL8HBUxd32DXS","actorLink":false,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]} {"_id":"TDpSn7GawJ1LCHp7","name":"Charette","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"vehicule","data":{"categorie":"Chariot","resistance":16,"structure":8,"vitesse":"","bonus":"","manoeuvrabilite":"","equipage":1,"capacite_encombrement":100,"description":"Description ...","notesmj":"Notes du MJ"},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/charette.webp","token":{"flags":{},"name":"Charette","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/charette_token.webp","tint":"","width":3,"height":3,"scale":1.1,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"TDpSn7GawJ1LCHp7","actorLink":false,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]} {"_id":"ZiyRDzz3gGzlpLIc","name":"Barque","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"vehicule","data":{"categorie":"Barque","resistance":20,"structure":10,"vitesse":"3/2/1","bonus":"(4)/+4/+6","manoeuvrabilite":"0/0/-4","equipage":4,"capacite_encombrement":100,"description":"Description ...","notesmj":"Notes du MJ"},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/barque.webp","token":{"flags":{},"name":"Barque","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/barque_token.webp","tint":"","width":6,"height":6,"scale":1,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"ZiyRDzz3gGzlpLIc","actorLink":false,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]} -{"_id":"gM77co80kmpVsYg6","name":"Posé par terre","permission":{"default":0,"Q2G6GTdrotKzYGUC":3},"type":"vehicule","data":{"categorie":"Autre","resistance":0,"structure":0,"vitesse":"","bonus":"","manoeuvrabilite":"","equipage":0,"capacite_encombrement":100,"description":"

        Déposer ici les objets que vous voulez échanger avec d'autres joueurs

        ","notesmj":""},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.png","token":{"flags":{},"name":"Posé par terre","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.png","tint":"","width":1,"height":1,"scale":1,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"gM77co80kmpVsYg6","actorLink":false,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]} +{"_id":"gM77co80kmpVsYg6","name":"Posé par terre","permission":{"default":0,"Q2G6GTdrotKzYGUC":3},"type":"vehicule","data":{"categorie":"Autre","resistance":0,"structure":0,"vitesse":"","bonus":"","manoeuvrabilite":"","equipage":0,"capacite_encombrement":100,"description":"

        Déposer ici les objets que vous voulez échanger avec d'autres joueurs

        ","notesmj":""},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.png","token":{"flags":{},"name":"Posé par terre","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.png","tint":"","width":1,"height":1,"scale":1,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"gM77co80kmpVsYg6","actorLink":true,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]} {"_id":"idyDmDWYpQ4Eppen","name":"Chariot","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"vehicule","data":{"categorie":"Chariot","resistance":20,"structure":10,"vitesse":"","bonus":"","manoeuvrabilite":"","equipage":1,"capacite_encombrement":150,"description":"Description ...","notesmj":"Notes du MJ"},"sort":100001,"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/chariot.webp","token":{"flags":{},"name":"Chariot","displayName":0,"img":"systems/foundryvtt-reve-de-dragon/icons/vehicules/chariot_token.webp","tint":"","width":4,"height":4,"scale":1.4,"mirrorX":false,"mirrorY":false,"lockRotation":false,"rotation":0,"vision":false,"dimSight":0,"brightSight":0,"dimLight":0,"brightLight":0,"sightAngle":360,"lightAngle":360,"lightColor":"","lightAlpha":1,"lightAnimation":{"type":"","speed":5,"intensity":5},"actorId":"idyDmDWYpQ4Eppen","actorLink":false,"disposition":0,"displayBars":0,"bar1":{"attribute":""},"bar2":{"attribute":""},"randomImg":false},"items":[],"effects":[]}