Amélioration de fenêtre de jets

- indication du type de dégâts
- affichage du moral avant l'icone d'appel au moral
- meilleur alignement des différentes options
This commit is contained in:
Vincent Vandemeulebrouck 2023-10-30 21:33:38 +01:00
parent 9d1fe6d8fd
commit 42567e7ca0
3 changed files with 52 additions and 45 deletions

View File

@ -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

View File

@ -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}`
}
}

View File

@ -1,13 +1,29 @@
<form class="skill-roll-dialog">
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<h2 class="dialog-roll-title"></h2>
<div class="grid grid-2col">
<div class="flex-group-left">
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<div class="flexrow">
<label>Caractéristique</label>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}}
<span>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}}
</span>
</div>
{{#if targetToken}}
<div class="flexrow">
<label>Cible:</label>
<label>
<img class="sheet-competence-img" src="{{targetToken.img}}" title="{{targetToken.name}}" />
{{targetToken.name}}
</label>
</div>
{{/if}}
{{#if ajustements.attaqueDefenseurSurpris.used}}
<div class="flexrow">
<label>{{ajustements.attaqueDefenseurSurpris.label}}</label>
</div>
{{/if}}
{{#if arme}}
{{#if attackerRoll}}
{{#if attackerRoll.tactique}}
@ -27,41 +43,28 @@
<div class="tooltiptext ttt-ajustements">
<div>
<strong>Charge</strong> : Les longueurs d'armes n'interviennent pas dans la charge, il faut gérer une initiative aléatoire dans ce cas.
<br><strong>Feinte</strong> : Vous devez avoir l'initative sur votre adversaire et y renoncer.
<br>
<strong>Feinte</strong> : Vous devez avoir l'initative sur votre adversaire et y renoncer.
</div>
</div>
</span>
</div>
{{/if}}
{{#if targetToken}}
<div class="flexrow">
Cible: {{targetToken.name}}
<img class="sheet-competence-img" src="{{targetToken.img}}" title="{{targetToken.name}}" />
</div>
{{/if}}
{{#if ajustements.attaqueDefenseurSurpris.used}}
<div class="flexrow">
<label>{{ajustements.attaqueDefenseurSurpris.label}}</label>
</div>
{{/if}}
{{#unless attackerRoll}}
<div class="flexrow">
<label>D&eacute;gats:</label>
{{#if (eq arme.system.mortalite 'non-mortel')}}
<label class="dmg-arme-actor"></label>
{{else if (eq arme.system.mortalite 'empoignade')}}
{{#if (eq arme.system.mortalite 'empoignade')}}
<label>Empoignade</label>
{{else}}
<span>
<input class="attribute-value" type="checkbox" name="motalite" {{#unless (eq mortalite 'mortel')}}checked{{/unless}} />
<label class="dmg-arme-actor"></label>
{{#unless (eq arme.system.mortalite 'non-mortel')}}
<input class="attribute-value check-mortalite" type="checkbox" name="mortalite" {{#unless (eq mortalite 'mortel')}}checked{{/unless}} />
{{/unless}}
<label class="dmg-arme-actor" name="dmg-arme-actor"></label> (<label class="arme-mortalite" name="arme-mortalite"></label>)
</span>
{{/if}}
</div>
{{/unless}}
{{/if}}
{{/if}}
<div class="flexrow"></div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
</div>
@ -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"}}
<div class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>