From 738c0737ca0e9faecce4566e4c41065682518324 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Nov 2021 23:33:52 +0100 Subject: [PATCH 1/4] Fix: sur-encombrement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le sur-encombrement apparaissait dès 11.1 sur 12 --- module/actor.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/module/actor.js b/module/actor.js index daa139dc..bafcf877 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1246,8 +1246,8 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - detectSurEncombrement() { - return Math.max(0, Math.ceil(Number(this.encTotal) - this.getEncombrementMax())); + computeMalusSurEncombrement() { + return Math.min(0, this.getEncombrementMax() - Math.ceil(Number(this.getEncTotal()))); } getEncombrementMax() { @@ -1335,23 +1335,24 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ computeEtatGeneral() { const actorData = Misc.data(this); + const tplData = Misc.templateData(this); // Pas d'état général pour les entités forçage à 0 if (this.data.type == 'entite') { - actorData.data.compteurs.etat.value = 0; + tplData.compteurs.etat.value = 0; return; } // Pour les autres - let state = - (actorData.data.sante.vie.max - actorData.data.sante.vie.value); - if (ReglesOptionelles.isUsing("appliquer-fatigue") && actorData.data.sante.fatigue) { - state += RdDUtility.currentFatigueMalus(actorData.data.sante.fatigue.value, actorData.data.sante.endurance.max); + let state = Math.min(tplData.sante.vie.value - tplData.sante.vie.max, 0); + if (ReglesOptionelles.isUsing("appliquer-fatigue") && tplData.sante.fatigue) { + state += RdDUtility.currentFatigueMalus(tplData.sante.fatigue.value, tplData.sante.endurance.max); } // Ajout de l'éthylisme - state += Math.min(0, (actorData.data.compteurs.ethylisme?.value ?? 0)); + state += Math.min(0, (tplData.compteurs.ethylisme?.value ?? 0)); - actorData.data.compteurs.etat.value = state; - if (actorData.data.compteurs?.surenc) { - actorData.data.compteurs.surenc.value = - this.detectSurEncombrement(); + tplData.compteurs.etat.value = state; + if (tplData.compteurs?.surenc) { + tplData.compteurs.surenc.value = this.computeMalusSurEncombrement(); } } From 4a6786f220bb74920dfbd88b17a494868b645e66 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Nov 2021 23:35:01 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Mise=20=C3=A0=20jour=20du=20malus=20armure?= =?UTF-8?q?=20m=C3=AAme=20pour=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/actor.js b/module/actor.js index bafcf877..192acc6e 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1288,7 +1288,7 @@ export class RdDActor extends Actor { .map(it => it.data.malus ?? 0) .reduce(Misc.sum(), 0); // Mise à jour éventuelle du malus armure - if (newMalusArmure && Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) { + if (Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) { await this.updateAttributeValue("malusarmure", newMalusArmure); } return newMalusArmure; From f225c071ac948df40a22cfedf1f804ce964012c7 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 5 Nov 2021 00:42:44 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Am=C3=A9lioration=20dialogue=20achat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/dialog-item-achat.js | 4 ++-- styles/img/ui/icon_echoppe.webp | Bin 0 -> 5318 bytes templates/dialog-item-achat.html | 30 ++++++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 styles/img/ui/icon_echoppe.webp diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index 0d9c9c90..b6b3f6ba 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -29,7 +29,7 @@ export class DialogItemAchat extends Dialog { constructor(html, vendeur, acheteur, venteData, chatMessageIdVente) { const isConsommable = venteData.item.type == 'nourritureboisson'; - let options = { classes: ["dialogachat"], width: 400, height: isConsommable ? 450 : 300, 'z-index': 99999 }; + let options = { classes: ["dialogachat"], width: 400, height: isConsommable ? 450 : 350, 'z-index': 99999 }; const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre"; const buttons = {}; @@ -39,7 +39,7 @@ export class DialogItemAchat extends Dialog { buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } }; buttons["decliner"] = { label: "Décliner", callback: it => { } }; let conf = { - title: actionAchat, + title: venteData.acheteur? venteData.acheteur.name + " - " + actionAchat : actionAchat, content: html, default: actionAchat, buttons: buttons diff --git a/styles/img/ui/icon_echoppe.webp b/styles/img/ui/icon_echoppe.webp new file mode 100644 index 0000000000000000000000000000000000000000..e547bf14c456b8d464cd37016179663346ac42df GIT binary patch literal 5318 zcmV;%6glfsNk&G#6aWBMMM6+kP&gp66aWBFq5z!%D)|BR0Y1@au285dvoWPJsS;os z31@Ej7MTCI|NY%sSl(TKs4wY7I4^F9W!5dME8~WL$#>oK&;6Ttk2@ag$F2|Y+KHaS zcvIFSERSeAQTnn#%gy*n{*J*3=s)-Yr&YHGN@i2J^(LQGj|Zlux`c?p@z%>&GZYia zYI0~FR*pz?!job>B9n@(wFHwaz?g-mdA2kT!&$_s4`m6S^k$jDLl< z+_IYB;#A<}tOST0mg)orYk=heP!{sp59Zq2z-SRQzNZ)(t-zeB#)U;0>w_64R_?%PMOVOS{|t9` zc2^hhisGzG1)?ag{7tZgmOjmKxG%I#is27xzlr20h@TfM!)_*ImvUPu8H|+`ODv3c z@hCwRg1m&(9$39Z=9qs-V|#h|a(aRPg%%qoDfwsed|Lt)PSm)KjqGsFdtQ4Sg@VXdMl!T)fJME zYGnfo&4O*Z(R5iHFloiMU@#b=_;~Wf7+{uc-BBdLN%4=r$Arc(^4-RTZIA}TZnJ8p z^;i3|8JP#cPi3nQX8@P-G(ey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NlP$+Z=3A77E}d0U=G|4hAjnA;7UtL5Xr z384w)_@VIdXr|$iRiYiX$bO`)fYLiUNzU%ugf^CJoA*gj&u+PP5>+-B<)oxDky z5qlzSsIKeddMtTrqL?J|w!MW|n3QBI1kkl8)tH`)J2x{?RnkEb zWo{--8I$UM^SXiM=|+FEA@{L4a==0F|2JR{3_*SC*IoL-5&xiRMvBEFL%)Up9NXW9 zT1fYJOdv9ZsgX(vEieE8mp^sX0(~SBXXpT1-u$h11X7q-XTy!)y7vs2Rs!27cAbt~ zSAD+V$JwG}IdZ-Dcih~ZR#~2L%|&)=7)vfm8qrKZ*_
- {{#if vendeur}} - {{vendeur.name}} - {{/if}} - {{item.name}} - {{!-- - {{#if acheteur}} - {{acheteur.name}} - {{/if}} - --}} +
+
+ {{#if vendeur}} + {{vendeur.name}} + {{else}} + Vendeur MJ + {{/if}} +
+
+
{{item.name}}
+
+
+ {{#if acheteur}} + {{acheteur.name}} + {{else}} + Acheteur MJ + {{/if}} +
+

{{#if isVente}}Acheter{{else}}Prendre{{/if}} {{#if vendeur}}à {{vendeur.name}}{{/if}}: @@ -83,4 +93,4 @@

{{/if}} - \ No newline at end of file + From 3097a2c148a6d2c155a2a79fee3cf49e7f30a628 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 7 Nov 2021 21:36:11 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Toujours=20afficher=20le=20r=C3=A9sultat=20?= =?UTF-8?q?des=20jets=20de=20moral?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/module/actor.js b/module/actor.js index 192acc6e..74fca890 100644 --- a/module/actor.js +++ b/module/actor.js @@ -475,7 +475,7 @@ export class RdDActor extends Actor { await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste); await this.update({ "data.blessures": blessures }); await this._recupererVie(message); - await this.jetDeMoral('neutre'); + await this._jetDeMoralChateauDormant(message); await this._recupereChance(); await this.transformerStress(); await this.retourSeuilDeReve(message); @@ -499,6 +499,11 @@ export class RdDActor extends Actor { await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance'); } + async _jetDeMoralChateauDormant(message) { + const jetMoral = await this._jetDeMoral('neutre'); + message.content += jetMoral.ajustement == 0 ? ' -- le moral reste stable' : ' -- le moral retourne vers 0'; + } + /* -------------------------------------------- */ async _recupererBlessures(message, type, liste, moindres) { if (!this.bonusRecuperationPotion) this.bonusRecuperationPotion = 0; @@ -1764,19 +1769,16 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async jetDeMoral(situation, messageReussi = undefined, messageManque = undefined) { - let jetMoral = await this._jetMoral(situation) - if (jetMoral.ajustement != 0) { - let defaultMessage = jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral"; - let finMessage = jetMoral.succes ? (messageReussi != undefined ? messageReussi : defaultMessage) : (messageManque != undefined ? messageManque : defaultMessage); - ChatMessage.create({ - whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), - content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${situation} (${jetMoral.jet}/${jetMoral.difficulte}).` - }); - } + const jetMoral = await this._jetDeMoral(situation); + const finMessage = (jetMoral.succes ? messageReussi : messageManque) ?? (jetMoral.ajustement == 0 ? "Vous gardez votre moral": jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral"); + ChatMessage.create({ + whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), + content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${situation} (${jetMoral.jet}/${jetMoral.difficulte}).` + }); return jetMoral.ajustement; } - async _jetMoral(situation) { + async _jetDeMoral(situation) { const moralActuel = Misc.toInt(Misc.templateData(this).compteurs.moral.value); const jet = await RdDDice.rollTotal("1d20", { showDice: true }); const difficulte = 10 + moralActuel; @@ -1969,7 +1971,7 @@ export class RdDActor extends Actor { ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte); if (!ethylisme.jet_moral) { - ethylismeData.jetMoral = await this._jetMoral('heureuse'); + ethylismeData.jetMoral = await this._jetDeMoral('heureuse'); if (ethylismeData.jetMoral.ajustement == 1) { ethylismeData.moralAlcool = 'heureux'; ethylisme.jet_moral = true;