Affichage état & blessures
Les icônes d'effets sont affichées en premier. Affichage des contusions. Les blessures sont affichées en dernier, par gravité décroissante
This commit is contained in:
@@ -51,7 +51,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
|||||||
foundry.utils.mergeObject(formData.calc, {
|
foundry.utils.mergeObject(formData.calc, {
|
||||||
surenc: this.actor.computeMalusSurEncombrement(),
|
surenc: this.actor.computeMalusSurEncombrement(),
|
||||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
|
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
|
||||||
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
blessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
||||||
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
||||||
caracTotalXp: RdDCarac.computeTotalXp(this.actor.system.carac, this.actor.system.beaute),
|
caracTotalXp: RdDCarac.computeTotalXp(this.actor.system.carac, this.actor.system.beaute),
|
||||||
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
|
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
async remiseANeuf() { }
|
async remiseANeuf() { }
|
||||||
async ajoutExperience(rollData, hideChatMessage = 'show') { }
|
async ajoutExperience(rollData, hideChatMessage = 'show') { }
|
||||||
|
|
||||||
computeResumeBlessure() { }
|
computeResumeBlessure() { return []}
|
||||||
countBlessures(filter = it => !it.isContusion()) { return 0 }
|
countBlessures(filter = it => !it.isContusion()) { return 0 }
|
||||||
async santeIncDec(name, inc, isCritique) { }
|
async santeIncDec(name, inc, isCritique) { }
|
||||||
|
|
||||||
|
|||||||
@@ -79,36 +79,25 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
return Math.min(0, Math.floor(this.getEncombrementMax() - this.encTotal));
|
return Math.min(0, Math.floor(this.getEncombrementMax() - this.encTotal));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
countBlessures(filter) { return this.itemTypes[ITEM_TYPES.blessure].filter(filter).length }
|
||||||
isDead() { return this.system.sante.vie.value < -this.getSConst() }
|
isDead() { return this.system.sante.vie.value < -this.getSConst() }
|
||||||
|
|
||||||
nbBlessuresLegeres() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isLegere()).length }
|
|
||||||
nbBlessuresGraves() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isGrave()).length }
|
|
||||||
nbBlessuresCritiques() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isCritique()).length }
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeResumeBlessure() {
|
computeResumeBlessure() {
|
||||||
const nbLegeres = this.nbBlessuresLegeres()
|
function descBlessure(count, name) {
|
||||||
const nbGraves = this.nbBlessuresGraves()
|
return count > 0 ? [`${count} ${name}${count > 1 ? "s" : ""}`] : []
|
||||||
const nbCritiques = this.nbBlessuresCritiques()
|
}
|
||||||
|
|
||||||
if (nbLegeres + nbGraves + nbCritiques == 0) {
|
const nbContusions = this.countBlessures(it => it.isContusion())
|
||||||
return "Aucune blessure";
|
const nbLegeres = this.countBlessures(it => it.isLegere())
|
||||||
}
|
const nbGraves = this.countBlessures(it => it.isGrave())
|
||||||
let resume = "Blessures:";
|
const nbCritiques = this.countBlessures(it => it.isCritique())
|
||||||
if (nbLegeres > 0) {
|
return [
|
||||||
resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : "");
|
... (nbCritiques > 0 ? ['une CRITIQUE !'] : []),
|
||||||
}
|
...descBlessure(nbGraves, 'grave'),
|
||||||
if (nbGraves > 0) {
|
...descBlessure(nbLegeres, 'légère'),
|
||||||
if (nbLegeres > 0)
|
...descBlessure(nbContusions, 'contusion'),
|
||||||
resume += ",";
|
]
|
||||||
resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : "");
|
|
||||||
}
|
|
||||||
if (nbCritiques > 0) {
|
|
||||||
if (nbGraves > 0 || nbLegeres > 0)
|
|
||||||
resume += ",";
|
|
||||||
resume += " une CRITIQUE !";
|
|
||||||
}
|
|
||||||
return resume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blessuresASoigner() { return [] }
|
blessuresASoigner() { return [] }
|
||||||
@@ -307,12 +296,12 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
async changeItemEffects(item) {
|
async changeItemEffects(item) {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case ITEM_TYPES.blessure:
|
case ITEM_TYPES.blessure:
|
||||||
await this.changeStateBleeding();
|
await this.changeStateBleeding()
|
||||||
break;
|
break;
|
||||||
case ITEM_TYPES.maladie:
|
case ITEM_TYPES.maladie:
|
||||||
case ITEM_TYPES.poison:
|
case ITEM_TYPES.poison:
|
||||||
await this.changeStateMalade();
|
await this.changeStateMalade()
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,9 +360,9 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
|||||||
const jetDeVie = await RdDDice.roll("1d20");
|
const jetDeVie = await RdDDice.roll("1d20");
|
||||||
const sConst = this.getSConst();
|
const sConst = this.getSConst();
|
||||||
const vie = this.system.sante.vie.value;
|
const vie = this.system.sante.vie.value;
|
||||||
const isCritique = this.nbBlessuresCritiques() > 0;
|
const isCritique = this.countBlessures(it => it.isCritique()) > 0
|
||||||
const isGrave = this.nbBlessuresGraves();
|
const isGrave = this.countBlessures(it => it.isGrave())
|
||||||
const isEchecTotal = jetDeVie.total == 20;
|
const isEchecTotal = jetDeVie.total == 20
|
||||||
const isSuccess = jetDeVie.total == 1 || jetDeVie.total <= vie;
|
const isSuccess = jetDeVie.total == 1 || jetDeVie.total <= vie;
|
||||||
const perte = isSuccess ? 0 : 1 + (isEchecTotal ? vie + sConst : 0)
|
const perte = isSuccess ? 0 : 1 + (isEchecTotal ? vie + sConst : 0)
|
||||||
const prochainJet = (jetDeVie.total == 1 && vie > 0 ? 20 : 1) * (isCritique ? 1 : isGrave > 0 ? sConst : 0)
|
const prochainJet = (jetDeVie.total == 1 && vie > 0 ? 20 : 1) * (isCritique ? 1 : isGrave > 0 ? sConst : 0)
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ export class RdDActorExportSheet extends RdDActorSheet {
|
|||||||
formData.export = this.getMappingValues(formData.context, this.actor)
|
formData.export = this.getMappingValues(formData.context, this.actor)
|
||||||
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES_BASE)
|
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES_BASE)
|
||||||
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)
|
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)
|
||||||
const legeres = this.actor.nbBlessuresLegeres()
|
const legeres = this.actor.countBlessures(it => it.isLegere())
|
||||||
const graves = this.actor.nbBlessuresGraves()
|
const graves = this.actor.countBlessures(it => it.isGrave())
|
||||||
const critiques = this.actor.nbBlessuresCritiques()
|
const critiques = this.actor.countBlessures(it => it.isCritique())
|
||||||
formData.etat = {
|
formData.etat = {
|
||||||
surenc: this.actor.computeMalusSurEncombrement(),
|
surenc: this.actor.computeMalusSurEncombrement(),
|
||||||
fatigue: {
|
fatigue: {
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.hbs"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.hbs"}}
|
||||||
<div class="flex-group-left header-etats">
|
<div class="flex-group-left header-etats">
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
<span>{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.hbs"}}</span>
|
||||||
<span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span>
|
<span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span>
|
||||||
<span>{{calc.resumeBlessures}}</span>
|
{{#each calc.blessures as |blessure|}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.hbs"}}
|
<span>{{blessure}}</span>
|
||||||
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<div class="flex-group-left header-etats">
|
<div class="flex-group-left header-etats">
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
<div>{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.hbs"}} Enc: {{calc.surenc}}</div>
|
||||||
<div>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</div>
|
<div>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</div>
|
||||||
<div>Sur-encombrement: {{calc.surenc}}</div>
|
{{#each calc.blessures as |blessure|}}
|
||||||
<div>{{calc.resumeBlessures}}</div>
|
<div>{{blessure}}</div>
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.hbs"}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user