From 095eed9da3922ccd6e36e02d779240b1f120a61f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 02:37:47 +0100 Subject: [PATCH 1/6] =?UTF-8?q?Fix:=20=C3=A9liminer=20le=20risque=20de=20j?= =?UTF-8?q?ets=20qui=20plante?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bloquait les rencontres en TMR. Quand un rollData ne contient pas les sous-noeuds pouvant être utilisés par les ajustements possibles, le jet de dés était perdu. Le calcul d'ajustements ajoute maintenant les noeuds use/ajustements s'ils ne sont pas fournis, pour éviter le risque. --- module/rolldata-ajustements.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 457c9153..df601186 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -64,19 +64,19 @@ export const referenceAjustements = { }, encTotal: { isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), - isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use.encTotal, + isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use?.encTotal, getLabel: (rollData, actor) => 'Encombrement total', getValue: (rollData, actor) => -actor.getEncTotal() }, surenc: { isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac) && actor.isSurenc(), - isUsed: (rollData, actor) => rollData.use?.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac), + isUsed: (rollData, actor) => rollData.use.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac), getLabel: (rollData, actor) => 'Sur-encombrement', getValue: (rollData, actor) => actor.computeMalusSurEncombrement() }, moral: { isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral, - isUsed: (rollData, actor) => rollData.use?.moral, + isUsed: (rollData, actor) => rollData.use.moral, getLabel: (rollData, actor) => 'Appel au moral', getValue: (rollData, actor) => 1 }, @@ -84,7 +84,7 @@ export const referenceAjustements = { isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac), isUsed: (rollData, actor) => rollData.use.coeur != undefined, getLabel: (rollData, actor) => 'Ajustement de cœur', - getValue: (rollData, actor) => -2 * (rollData.use.coeur?.coeur ?? 0) + getValue: (rollData, actor) => -2 * (rollData.use?.coeur?.coeur ?? 0) }, moralTotal: { isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac), @@ -141,7 +141,7 @@ export const referenceAjustements = { getLabel: (rollData, actor) => "Force de l'alcool: ", getValue: (rollData, actor) => rollData.forceAlcool, }, - ethylisme:{ + ethylisme: { isVisible: (rollData, actor) => rollData.ethylisme != undefined, isUsed: (rollData, actor) => rollData.ethylisme != undefined, getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme), @@ -159,7 +159,9 @@ export class RollDataAjustements { /* -------------------------------------------- */ static calcul(rollData, actor) { - rollData.ajustements = {}; + // s'assurer de la correction des infos rollData + mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false }) + for (var key in referenceAjustements) { const reference = referenceAjustements[key]; rollData.ajustements[key] = { From 8e41250f645ca5f9f8b579bbc5d0fa231d73a519 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 02:38:23 +0100 Subject: [PATCH 2/6] =?UTF-8?q?Affichage=20de=20c=C5=93ur=20dans=20les=20a?= =?UTF-8?q?justements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/chat-infojet.html | 2 +- templates/partial-roll-ajustements.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/chat-infojet.html b/templates/chat-infojet.html index bd50d908..44caa6dd 100644 --- a/templates/chat-infojet.html +++ b/templates/chat-infojet.html @@ -9,7 +9,7 @@ {{#if item.descr}} {{{item.descr}}} {{else}} - {{item.label}}: {{plusMoins item.value}} + {{{item.label}}}: {{plusMoins item.value}} {{/if}} {{/if}} diff --git a/templates/partial-roll-ajustements.html b/templates/partial-roll-ajustements.html index c77dbd49..2cec37c7 100644 --- a/templates/partial-roll-ajustements.html +++ b/templates/partial-roll-ajustements.html @@ -9,7 +9,7 @@ {{#if item.descr}} {{{item.descr}}} {{else}} - {{item.label}}: {{plusMoins item.value}} + {{{item.label}}}: {{plusMoins item.value}} {{/if}} {{/if}} From ab9a21f4025f8aea80e4130e78bbe36d60c243c5 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 02:38:57 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Utilisation=20de=20get=20plut=C3=B4t=20que?= =?UTF-8?q?=20find=20par=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-combat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 1458a16c..39f23ae2 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -515,7 +515,7 @@ export class RdDCombat { static _callJetDeVie(event) { let actorId = event.currentTarget.attributes['data-actorId'].value; let tokenId = event.currentTarget.attributes['data-tokenId'].value; - let token = canvas.tokens.placeables.find(t => t.id == tokenId) + let token = canvas.tokens.get(tokenId) const actor = token?.actor ?? game.actors.get(actorId); if (actor?.isOwner) { actor.jetDeVie(); From 5e140546ea9d7eda7f525daed9ee9f9353239b35 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 03:07:27 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Les=20tooltips=20de=20comp=C3=A9tences=20et?= =?UTF-8?q?=20l'exp=C3=A9rience?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Limitation du tooltip sur les compétences qui masquait les informations d'expérience --- templates/actor/competence.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/actor/competence.html b/templates/actor/competence.html index a90045f8..92cf7ec3 100644 --- a/templates/actor/competence.html +++ b/templates/actor/competence.html @@ -1,13 +1,13 @@ {{#unless system.isHidden}} -
  • - +
  • + {{name}} {{#if system.isLevelUp}} Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}} - + {{/if}} @@ -19,7 +19,7 @@ {{#if @root.options.vueDetaillee}} {{#unless system.isLevelUp}} Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}} @@ -28,7 +28,7 @@ {{/if}} {{#if (eq system.categorie 'draconic')}} {{/if}} {{#if @root.options.vueDetaillee}} From 62cc3fc96b858aee0fc22e824079400d265b6e57 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 04:00:17 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Correction=20de=20l'ajustement=20de=20lumin?= =?UTF-8?q?osit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On passe de la nuit début vaisseau au jour fin vaisseau --- module/misc.js | 4 ++++ module/time/rdd-timestamp.js | 46 +++++++++++++++++------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/module/misc.js b/module/misc.js index 354fef4d..10edee27 100644 --- a/module/misc.js +++ b/module/misc.js @@ -22,6 +22,10 @@ export class Misc { const isPositiveNumber = value != NaN && value > 0; return isPositiveNumber ? "+" + number : number } + + static modulo(n, m) { + return ((n % m) + m) % m; + } static sum() { return (a, b) => Number(a) + Number(b); diff --git a/module/time/rdd-timestamp.js b/module/time/rdd-timestamp.js index ad6f1948..eb8ea8e5 100644 --- a/module/time/rdd-timestamp.js +++ b/module/time/rdd-timestamp.js @@ -2,7 +2,6 @@ import { SHOW_DICE, SYSTEM_RDD } from "../constants.js"; import { Grammar } from "../grammar.js"; import { Misc } from "../misc.js"; import { RdDDice } from "../rdd-dice.js"; -import { AutoAdjustDarkness } from "./auto-adjust-darkness.js"; export const WORLD_TIMESTAMP_SETTING = "calendrier"; @@ -16,14 +15,14 @@ export const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PA const ROUNDS_PAR_MINUTE = 10; const DEFINITION_HEURES = [ - { key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps" , darkness: 0.7}, - { key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps" , darkness: 0.4}, - { key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps" , darkness: 0}, - { key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté" , darkness: 0}, + { key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps", darkness: 0.9 }, + { key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps", darkness: 0.1 }, + { key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps", darkness: 0 }, + { key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté", darkness: 0 }, { key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 }, - { key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0}, - { key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.4 }, - { key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.7 }, + { key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0 }, + { key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.1 }, + { key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.9 }, { key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 }, { key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 }, { key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 }, @@ -98,10 +97,10 @@ export class RdDTimestamp { */ static definition(signe) { if (signe == undefined) { - signe = 0; + signe = 0 } if (Number.isInteger(signe)) { - return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR]; + return DEFINITION_HEURES[Misc.modulo(signe, RDD_HEURES_PAR_JOUR)] } let definition = DEFINITION_HEURES.find(it => it.key == signe); if (!definition) { @@ -119,10 +118,7 @@ export class RdDTimestamp { } static ajustementAstrologiqueHeure(hn, nbAstral, heure) { - let ecart = (hn + nbAstral - heure) % RDD_HEURES_PAR_JOUR; - if (ecart < 0) { - ecart = (ecart + RDD_HEURES_PAR_JOUR) % RDD_HEURES_PAR_JOUR; - } + let ecart = Misc.modulo(hn + nbAstral - heure, RDD_HEURES_PAR_JOUR); switch (ecart) { case 0: return 4; case 4: case 8: return 2; @@ -158,11 +154,13 @@ export class RdDTimestamp { } static defHeure(heure) { - return DEFINITION_HEURES.find(it => (it.heure) == heure % RDD_HEURES_PAR_JOUR); + heure = Misc.modulo(heure, RDD_HEURES_PAR_JOUR); + return DEFINITION_HEURES.find(it => it.heure == heure) } + static findHeure(heure) { heure = Grammar.toLowerCaseNoAccentNoSpace(heure); - let parHeureOuLabel = DEFINITION_HEURES.filter(it => (it.heure) == parseInt(heure) % RDD_HEURES_PAR_JOUR || Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure); + let parHeureOuLabel = DEFINITION_HEURES.filter(it => Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure || it.heure == Misc.modulo(parseInt(heure), RDD_HEURES_PAR_JOUR)); if (parHeureOuLabel.length == 1) { return parHeureOuLabel[0]; } @@ -232,19 +230,19 @@ export class RdDTimestamp { } get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) } - get mois() { return Math.floor((this.indexDate % RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) } - get jour() { return (this.indexDate % RDD_JOURS_PAR_AN) % RDD_JOURS_PAR_MOIS } + get mois() { return Math.floor(Misc.modulo(this.indexDate, RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) } + get jour() { return Misc.modulo(Misc.modulo(this.indexDate, RDD_JOURS_PAR_AN), RDD_JOURS_PAR_MOIS) } get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) } - get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES } + get minute() { return Misc.modulo(this.indexMinute, RDD_MINUTES_PAR_HEURES) } get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) } get angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 } get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45 } get darkness() { - const darknessDebut = RdDTimestamp.definition(this.heure).darkness *100 - const darknessFin = RdDTimestamp.definition(this.heure + 1).darkness *100 + const darknessDebut = 100 * RdDTimestamp.definition(this.heure).darkness + const darknessFin = 100 * RdDTimestamp.definition(this.heure + 1).darkness const darknessMinute = Math.round((darknessFin - darknessDebut) * this.minute / RDD_MINUTES_PAR_HEURES); - return (darknessDebut + darknessMinute)/100 + return (darknessDebut + darknessMinute) / 100 } /** @@ -297,7 +295,7 @@ export class RdDTimestamp { const heure = this.heure + heures; return new RdDTimestamp({ indexDate: this.indexDate + Math.floor(heure / RDD_HEURES_PAR_JOUR), - indexMinute: this.indexMinute + (heure % RDD_HEURES_PAR_JOUR) * RDD_MINUTES_PAR_HEURES + indexMinute: this.indexMinute + Misc.modulo(heure, RDD_HEURES_PAR_JOUR) * RDD_MINUTES_PAR_HEURES }) } @@ -347,7 +345,7 @@ export class RdDTimestamp { return { jours: jours, heures: Math.floor(minutes / RDD_MINUTES_PAR_HEURES), - minutes: minutes % RDD_MINUTES_PAR_HEURES + minutes: Misc.modulo(minutes, RDD_MINUTES_PAR_HEURES) } } } \ No newline at end of file From eb097145794e6a68d735957a19753147f623722f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 04:03:53 +0100 Subject: [PATCH 6/6] Version 11.2.8 --- changelog.md | 5 +++++ system.json | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 70384690..a08f01fd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,9 @@ # 11.2 +## 11.2.8 - L'éclairage d'Akarlikarlikar +- l'ajustement de la lumière jour/nuit s'étale sur moins de temps (vaisseau et Lyre) +- les nouveaux tooltips ne masquent plus l'information d'expérience +- les jets de dés pour maîtriser les rencontres fonctionnent de nouveau + ## 11.2.7 - Les explications d'Akarlikarlikar - Ajout de tooltips sur la plupart des boutons, liens clickables, objets, tâches, ... - Fix: on peut de nouveau regarder l'inventaire avec les droits limités/observateur diff --git a/system.json b/system.json index a10866f6..23820357 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "11.2.7", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.7.zip", + "version": "11.2.8", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.8.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": {