renommage countBlessures
This commit is contained in:
parent
6ccc5b8d1b
commit
f77a0bf20b
@ -42,9 +42,9 @@ export class RdDActorCreatureSheet extends ActorSheet {
|
|||||||
data.data.caracSum = sum;
|
data.data.caracSum = sum;
|
||||||
|
|
||||||
data.data.carac.taille.isTaille = true; // To avoid button link;
|
data.data.carac.taille.isTaille = true; // To avoid button link;
|
||||||
data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste );
|
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
|
||||||
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
|
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
|
||||||
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
|
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
|
||||||
|
|
||||||
data.data.competencecreature = data.itemsByType["competencecreature"];
|
data.data.competencecreature = data.itemsByType["competencecreature"];
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@ export class RdDActorHumanoideSheet extends ActorSheet {
|
|||||||
data.data.caracSum = sum;
|
data.data.caracSum = sum;
|
||||||
|
|
||||||
data.data.carac.taille.isTaille = true; // To avoid button link;
|
data.data.carac.taille.isTaille = true; // To avoid button link;
|
||||||
data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste );
|
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
|
||||||
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
|
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
|
||||||
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
|
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
|
||||||
data.data.competencecreature = data.itemsByType["competencecreature"];
|
data.data.competencecreature = data.itemsByType["competencecreature"];
|
||||||
|
|
||||||
RdDUtility.filterItemsPerTypeForSheet(data );
|
RdDUtility.filterItemsPerTypeForSheet(data );
|
||||||
|
@ -85,9 +85,9 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.data.carac.taille.isTaille = true; // To avoid button link;
|
data.data.carac.taille.isTaille = true; // To avoid button link;
|
||||||
data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste );
|
data.data.nbLegeres = this.actor.countBlessures(data.data.blessures.legeres.liste );
|
||||||
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
|
data.data.nbGraves = this.actor.countBlessures(data.data.blessures.graves.liste );
|
||||||
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
|
data.data.nbCritiques = this.actor.countBlessures(data.data.blessures.critiques.liste );
|
||||||
|
|
||||||
// Mise à jour de l'encombrement total
|
// Mise à jour de l'encombrement total
|
||||||
this.actor.computeEncombrementTotal();
|
this.actor.computeEncombrementTotal();
|
||||||
|
@ -762,13 +762,9 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
GetNumberBlessures( blessuresListe )
|
countBlessures( blessuresListe )
|
||||||
{
|
{
|
||||||
let nbB = 0;
|
return blessuresListe.filter(b => b.active).length
|
||||||
for ( let b of blessuresListe) {
|
|
||||||
nbB += ( b.active) ? 1 : 0;
|
|
||||||
}
|
|
||||||
return nbB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -817,8 +813,8 @@ export class RdDActor extends Actor {
|
|||||||
let blessures = this.data.data.blessures;
|
let blessures = this.data.data.blessures;
|
||||||
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
||||||
let maxEndVie = this.data.data.sante.endurance.max - (diffVie * 2);
|
let maxEndVie = this.data.data.sante.endurance.max - (diffVie * 2);
|
||||||
let nbGraves = this.GetNumberBlessures(blessures.graves.liste);
|
let nbGraves = this.countBlessures(blessures.graves.liste);
|
||||||
let nbCritiques = this.GetNumberBlessures(blessures.critiques.liste);
|
let nbCritiques = this.countBlessures(blessures.critiques.liste);
|
||||||
let maxEndGraves = Math.floor(this.data.data.sante.endurance.max / (2 * nbGraves));
|
let maxEndGraves = Math.floor(this.data.data.sante.endurance.max / (2 * nbGraves));
|
||||||
let maxEndCritiques = nbCritiques > 0 ? 1 : this.data.data.sante.endurance.max;
|
let maxEndCritiques = nbCritiques > 0 ? 1 : this.data.data.sante.endurance.max;
|
||||||
return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques));
|
return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques));
|
||||||
|
Loading…
Reference in New Issue
Block a user