Organisation du rappel de blessures

This commit is contained in:
Vincent Vandemeulebrouck 2020-12-05 02:22:37 +01:00
parent 247079b2bb
commit 424b616891
7 changed files with 38 additions and 31 deletions

View File

@ -42,9 +42,8 @@ export class RdDActorCreatureSheet extends ActorSheet {
data.data.caracSum = sum;
data.data.carac.taille.isTaille = true; // To avoid button link;
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
data.data.blessures.resume = this.actor.computeResumeBlessure(data.data.blessures);
data.data.isGM = game.user.isGM;
data.data.competencecreature = data.itemsByType["competencecreature"];

View File

@ -41,9 +41,9 @@ export class RdDActorHumanoideSheet extends ActorSheet {
data.data.caracSum = sum;
data.data.carac.taille.isTaille = true; // To avoid button link;
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
data.data.carac.chance.isChance = true; // Ajouter chance actuelle et utiliser;
data.data.compteurs.chance.isChance = true;
data.data.blessures.resume = this.actor.computeResumeBlessure(data.data.blessures);
data.data.competencecreature = data.itemsByType["competencecreature"];
data.data.isGM = game.user.isGM;

View File

@ -90,9 +90,9 @@ export class RdDActorSheet extends ActorSheet {
this.armesList = duplicate(data.data.combat);
data.data.carac.taille.isTaille = true; // To avoid button link;
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
data.data.carac.chance.isChance = true; // Ajouter chance actuelle et utiliser;
data.data.compteurs.chance.isChance = true;
data.data.blessures.resume = this.actor.computeResumeBlessure(data.data.blessures);
// Mise à jour de l'encombrement total
this.actor.computeEncombrementTotalEtMalusArmure();

View File

@ -862,6 +862,33 @@ export class RdDActor extends Actor {
}
}
computeResumeBlessure(blessures = this.data.data.blessures) {
let nbLegeres = this.countBlessures(blessures.legeres.liste );
let nbGraves = this.countBlessures(blessures.graves.liste );
let nbCritiques = this.countBlessures(blessures.critiques.liste );
let resume = "Blessures:";
if (nbCritiques > 0 || nbGraves > 0 || nbLegeres > 0) {
if (nbLegeres > 0) {
resume += " " + nbLegeres + " légères";
}
if (nbGraves > 0) {
if (nbLegeres > 0)
resume += ",";
resume += " " + nbGraves + " graves";
}
if (nbCritiques > 0) {
if (nbGraves > 0 || nbLegeres > 0)
resume += ",";
resume += " une CRITIQUE !";
}
}
else {
resume += " aucune";
}
return resume;
}
/* -------------------------------------------- */
computeEtatGeneral( )
{

View File

@ -7,9 +7,7 @@
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
<div class="flexrow">
<div class="flexrow">
<div class="flex-group-center">Blessures légères : {{data.nbLegeres}}</div>
<div class="flex-group-center">Blessures graves : {{data.nbGraves}}</div>
<div class="flex-group-center">Blessure critique : {{data.nbCritiques}}</div>
<span>{{data.blessures.resume}}</span>
</div>
</div>
</div>

View File

@ -7,9 +7,7 @@
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
<div class="flexrow">
<div class="flexrow">
<div class="flex-group-center">Blessures légères : {{data.nbLegeres}}</div>
<div class="flex-group-center">Blessures graves : {{data.nbGraves}}</div>
<div class="flex-group-center">Blessure critique : {{data.nbCritiques}}</div>
<span>{{data.blessures.resume}}</span>
</div>
</div>
</div>

View File

@ -70,22 +70,7 @@
<span class="tooltip">Malus de fatigue : {{data.fatigue.malus}}
<span class="tooltiptext">{{{data.fatigue.html}}}</span>
</span>
<span>
{{#if data.nbLegeres}}
Blessures: {{data.nbLegeres}} légères
{{#if data.nbGraves}}, {{data.nbGraves}} graves{{/if}}
{{#if data.nbCritiques}}, une CRITIQUE !{{/if}}
{{else}}
{{#if data.nbGraves}}
Blessures:{{data.nbGraves}} graves
{{#if data.nbCritiques}}et une CRITIQUE !{{data.nbCritiques}}{{/if}}
{{else}}
{{#if data.nbCritiques}}une CRITIQUE !{{data.nbCritiques}}
{{else}}Aucune blessure
{{/if}}
{{/if}}
{{/if}}
</span>
<span>{{data.blessures.resume}}</span>
</div>
</div>
</div>