From fad29f9652ed447d1f660eb3ddba301d9d25e8d6 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 30 Oct 2023 19:08:34 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Jet=20de=20vie=20par=20les=20propri=C3=A9ta?= =?UTF-8?q?ires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les messages de tour sont séparés en deux: - un message pour tout le monde disant de qui c'est le tour - un message pour les propriétaires du token pour les informations de santé (jets de vie à faire, ...) Seul les propriétaires peuvent déclencher les jets de vie --- module/rdd-combat.js | 30 ++++++++++++------- module/rdd-utility.js | 3 +- templates/chat-actor-turn-acteur.hbs | 1 + ...summary.html => chat-actor-turn-sante.hbs} | 6 ++-- 4 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 templates/chat-actor-turn-acteur.hbs rename templates/{chat-actor-turn-summary.html => chat-actor-turn-sante.hbs} (74%) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index ee434acd..c0eea94c 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -75,7 +75,7 @@ export class RdDCombatManager extends Combat { } } } - + /************************************************************************************/ async rollInitiative(ids, formula = undefined, messageOptions = {}) { console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions); @@ -448,7 +448,7 @@ export class RdDCombat { if (Misc.isUniqueConnectedGM()) { let turn = combat.turns.find(t => t.token?.id == combat.current.tokenId); if (turn?.actor) { - RdDCombat.displayActorCombatStatus(combat, turn.actor); + RdDCombat.displayActorCombatStatus(combat, turn.actor, turn.token.id); // TODO Playaudio for player?? } } @@ -512,8 +512,12 @@ export class RdDCombat { /* -------------------------------------------- */ static _callJetDeVie(event) { let actorId = event.currentTarget.attributes['data-actorId'].value; - let actor = game.actors.get(actorId); - actor.jetVie(); + let tokenId = event.currentTarget.attributes['data-tokenId'].value; + let token = canvas.tokens.placeables.find(t => t.id == tokenId) + const actor = token?.actor ?? game.actors.get(actorId); + if (actor?.isOwner) { + actor.jetVie(); + } } /* -------------------------------------------- */ @@ -539,7 +543,7 @@ export class RdDCombat { } }); } - html.on("click", '#chat-jet-vie', event => { + html.on("click", 'a.chat-jet-vie', event => { event.preventDefault(); RdDCombat._callJetDeVie(event); }); @@ -1292,7 +1296,7 @@ export class RdDCombat { } /* -------------------------------------------- */ - static async displayActorCombatStatus(combat, actor) { + static async displayActorCombatStatus(combat, actor, tokenId) { let formData = { combatId: combat._id, alias: actor.name, @@ -1301,12 +1305,18 @@ export class RdDCombat { blessuresStatus: actor.computeResumeBlessure(), SConst: actor.getSConst(), actorId: actor.id, + tokenId: tokenId, isGrave: actor.countBlessures(it => it.isGrave()) > 0, isCritique: actor.countBlessures(it => it.isCritique()) > 0 } - - ChatUtility.createChatWithRollMode(actor.name, { - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, formData) + await ChatMessage.create({ + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-acteur.hbs`, formData), + alias: actor.name + }); + await ChatMessage.create({ + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs`, formData), + whisper: ChatUtility.getWhisperRecipientsAndGMs(actor.name), + alias: actor.name }); } -} +} \ No newline at end of file diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 703e3c87..b3b188a9 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -245,7 +245,8 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/chat-description.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html', - 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html', + 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-acteur.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html', diff --git a/templates/chat-actor-turn-acteur.hbs b/templates/chat-actor-turn-acteur.hbs new file mode 100644 index 00000000..ad174c7f --- /dev/null +++ b/templates/chat-actor-turn-acteur.hbs @@ -0,0 +1 @@ +

C'est au tour de {{alias}} !

diff --git a/templates/chat-actor-turn-summary.html b/templates/chat-actor-turn-sante.hbs similarity index 74% rename from templates/chat-actor-turn-summary.html rename to templates/chat-actor-turn-sante.hbs index b1509a66..30d80271 100644 --- a/templates/chat-actor-turn-summary.html +++ b/templates/chat-actor-turn-sante.hbs @@ -1,4 +1,4 @@ -

C'est au tour de {{alias}} !

+

Résumé de santé pour {{alias}}

{{blessuresStatus}}
Son état général est de : {{etatGeneral}} {{#if isSonne}} et est sonné{{/if}}
{{#if isGrave}} @@ -6,5 +6,7 @@ {{/if}} {{#if isCritique}}
{{alias}} souffre d'une Blessure Critique : faites un - Jet de Vie.
+ Jet de Vie. {{/if}} \ No newline at end of file -- 2.35.3 From f5bd0f32f49bef586e8216f478e8116cc3c425bb Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 30 Oct 2023 19:42:56 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Fix:=20affichage=20de=20la=20gravit=C3=A9?= =?UTF-8?q?=20des=20blessures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le type de blessure est indiqué dans le résumé d'encaissement --- templates/chat-resultat-encaissement.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/chat-resultat-encaissement.html b/templates/chat-resultat-encaissement.html index 146bf264..275ca74b 100644 --- a/templates/chat-resultat-encaissement.html +++ b/templates/chat-resultat-encaissement.html @@ -26,7 +26,7 @@ {{#if (eq dmg.mortalite 'entiteincarnee')}}subit le coup {{else if mort}}vient de mourir {{else if blessure}} - {{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.system.labelGravite}} + {{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.system.label}} {{else}}subit une contusion {{~/if~}} {{else}}s'en sort sans une égratignure -- 2.35.3 From 9d1fe6d8fdca80206e355c719319db4d6738e469 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 30 Oct 2023 19:47:08 +0100 Subject: [PATCH 3/4] Version 11.0.28 --- changelog.md | 8 ++++++++ system.json | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index f299d1f8..d8da1bfd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,12 @@ # v11.0 +## v11.0.28 - les fractures de Khrachtchoum +- La gravité de la blessure est affichée dans le résumé de l'encaissement +- Lors du changement d'acteur pendant le round + - le message annonçant le joueur dont c'est le tour ne contient plus d'informations de santé + - un message avec les informations de santé est envoyé au Gardienn et au propriétaire du token.acteur + - le jet de vie est bien fait par le token si besoin + - seul les propriétaires peuvent faire les jets de vie + ## v11.0.27 - Khrachtchoum le méticuleux - le tooltip dans les TMR reste visible si on ne bouge pas la souris - le surencombrement n'affecte QUE les actions physiques diff --git a/system.json b/system.json index 69dc87f9..b0ff954c 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "11.0.27", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.27.zip", + "version": "11.0.28", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.28.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": { -- 2.35.3 From 42567e7ca08e8e7d1307f533a6940f92e848dc2a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 30 Oct 2023 21:33:38 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Am=C3=A9lioration=20de=20fen=C3=AAtre=20de?= =?UTF-8?q?=20jets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - indication du type de dégâts - affichage du moral avant l'icone d'appel au moral - meilleur alignement des différentes options --- changelog.md | 3 ++ module/rdd-roll.js | 42 +++++++++++----------- templates/dialog-roll-competence.html | 52 ++++++++++++++------------- 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/changelog.md b/changelog.md index d8da1bfd..1f36d362 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,9 @@ - un message avec les informations de santé est envoyé au Gardienn et au propriétaire du token.acteur - le jet de vie est bien fait par le token si besoin - seul les propriétaires peuvent faire les jets de vie +- Amélioration de la fenêtre de jets + - le type de dégâts pour les attaques est toujours affiché + - le moral est indiqué avant l'icone d'appel au moral ## v11.0.27 - Khrachtchoum le méticuleux - le tooltip dans les TMR reste visible si on ne bouge pas la souris diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 5925d076..9a36c884 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -22,7 +22,7 @@ export class RdDRoll extends Dialog { const html = await renderTemplate(dialogConfig.html, rollData); - let options = { classes: ["rdd-roll-dialog"], width: 600, height: 'fit-content', 'z-index': 99999, close: html => {} }; + let options = { classes: ["rdd-roll-dialog"], width: 650, height: 'fit-content', 'z-index': 99999, close: html => {} }; if (dialogConfig.close) { options.close = dialogConfig.close; } @@ -185,7 +185,7 @@ export class RdDRoll extends Dialog { console.log("RdDRollSelectDialog - Cout reve", ptreve); this.updateRollResult(html); }); - this.html.find("[name='mortalite']").change((event) => { + this.html.find("input.check-mortalite").change((event) => { this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel"; this.updateRollResult(html); }); @@ -289,34 +289,31 @@ export class RdDRoll extends Dialog { /* -------------------------------------------- */ async updateRollResult(html) { - let rollData = this.rollData; + const rollData = this.rollData; rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat()) rollData.caracValue = parseInt(rollData.selectedCarac.value) - rollData.mortalite = rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite ?? rollData.mortalite ?? 'mortel'; + rollData.dmg.mortalite = rollData.dmg.mortalite ?? 'mortel'; rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac); - let dmgText = Misc.toSignedString(rollData.dmg.total); - - switch (rollData.mortalite) { - case 'non-mortel': dmgText = `(${dmgText}) non-mortel`; break; - case 'empoignade': dmgText = `empoignade`; break; - } RollDataAjustements.calcul(rollData, this.actor); const resolutionTable = await RdDResolutionTable.buildHTMLTable(RdDResolutionTable.subTable(rollData.caracValue, rollData.finalLevel)) const adjustements = await this.buildAjustements(rollData); - + HtmlUtility.showControlWhen(this.html.find(".use-encTotal"), rollData.ajustements.encTotal.visible && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac)); HtmlUtility.showControlWhen(this.html.find(".use-surenc"), rollData.ajustements.surenc.visible && RdDCarac.isActionPhysique(rollData.selectedCarac)); HtmlUtility.showControlWhen(this.html.find(".utilisation-moral"), rollData.use.appelAuMoral); HtmlUtility.showControlWhen(this.html.find(".divAppelAuMoral"), rollData.use.appelAuMoral); - HtmlUtility.showControlWhen(this.html.find(".diffMoral"), rollData.ajustements.moralTotal.used); + // HtmlUtility.showControlWhen(this.html.find(".diffMoral"), rollData.ajustements.moral.used); // Mise à jour valeurs this.html.find(".dialog-roll-title").text(this._getTitle(rollData)); - this.html.find("[name='mortalite']").prop('checked', rollData.mortalite == 'non-mortel'); - this.html.find(".dmg-arme-actor").text(dmgText); + this.html.find("input.check-mortalite").prop('checked', rollData.dmg.mortalite == 'non-mortel'); + this.html.find("label.dmg-arme-actor").text(rollData.dmg.mortalite == 'empoignade'? 'empoignade': Misc.toSignedString(rollData.dmg.total) ); + this.html.find("label.arme-mortalite").text(rollData.dmg.mortalite); + // this.html.find("[name='dmg-arme-actor']").text(rollData.dmg.mortalite == 'empoignade'? 'empoignade': Misc.toSignedString(rollData.dmg.total) ); + // this.html.find("[name='arme-mortalite']").text(rollData.dmg.mortalite); this.html.find("div.placeholder-ajustements").empty().append(adjustements); this.html.find("div.placeholder-resolution").empty().append(resolutionTable) } @@ -334,16 +331,19 @@ export class RdDRoll extends Dialog { return carac; } const compName = rollData.competence.name; - if (rollData.draconicList && rollData.selectedSort) { - return compName + " - " + rollData.selectedSort.name; - } - // If a weapon is there, add it in the title const niveau = Misc.toSignedString(rollData.competence.system.niveau) if (compName == carac) { // cas des créatures - return carac + " Niveau " + niveau + return `${carac} Niveau ${niveau}` } - const armeTitle = (rollData.arme) ? " (" + rollData.arme.name + ") " : ""; - return carac + "/" + compName + armeTitle + " Niveau " + niveau + if (rollData.draconicList && rollData.selectedSort) { + // cas de lancer de sort + return `${rollData.competence.name} Niveau ${niveau} ${rollData.selectedSort.name}` + } + if (rollData.arme && rollData.arme.name != compName) { + // ajouter l'arme au titre si son nom n'est pas la compétence + return `${carac} / ${compName} (${rollData.arme.name}) Niveau ${niveau}` + } + return `${carac} / ${compName} Niveau ${niveau}` } } diff --git a/templates/dialog-roll-competence.html b/templates/dialog-roll-competence.html index ee2a475b..bc7ca235 100644 --- a/templates/dialog-roll-competence.html +++ b/templates/dialog-roll-competence.html @@ -1,13 +1,29 @@
+ {{competence.name}}

- {{competence.name}}
- {{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}} + + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}} +
+ {{#if targetToken}} +
+ + +
+ {{/if}} + {{#if ajustements.attaqueDefenseurSurpris.used}} +
+ +
+ {{/if}} {{#if arme}} {{#if attackerRoll}} {{#if attackerRoll.tactique}} @@ -27,41 +43,28 @@
Charge : Les longueurs d'armes n'interviennent pas dans la charge, il faut gérer une initiative aléatoire dans ce cas. -
Feinte : Vous devez avoir l'initative sur votre adversaire et y renoncer. +
+ Feinte : Vous devez avoir l'initative sur votre adversaire et y renoncer.
- {{/if}} - {{#if targetToken}} -
- Cible: {{targetToken.name}} - -
- {{/if}} - {{#if ajustements.attaqueDefenseurSurpris.used}} -
- -
- {{/if}} - - {{#unless attackerRoll}}
- {{#if (eq arme.system.mortalite 'non-mortel')}} - - {{else if (eq arme.system.mortalite 'empoignade')}} + {{#if (eq arme.system.mortalite 'empoignade')}} {{else}} - - + {{#unless (eq arme.system.mortalite 'non-mortel')}} + + {{/unless}} + () {{/if}}
- {{/unless}} + {{/if}} {{/if}} - +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
@@ -75,6 +78,7 @@ {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}} +
-- 2.35.3