Fix affichage Malus Armure
Le malus armure est correctement affiché dans l'onglet caractéristiques. Il n'est plus stocké dans l'acteur mais calculé.
This commit is contained in:
parent
1d8f4ebb88
commit
7eb1d9f838
@ -57,6 +57,7 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
|||||||
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
resumeBlessures: 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),
|
||||||
surEncombrementMessage: this.actor.getMessageSurEncombrement(),
|
surEncombrementMessage: this.actor.getMessageSurEncombrement(),
|
||||||
|
malusArmure: this.actor.getMalusArmure()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.timerRecherche = undefined;
|
this.timerRecherche = undefined;
|
||||||
|
@ -95,7 +95,6 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
this.computeIsHautRevant();
|
this.computeIsHautRevant();
|
||||||
await this.cleanupConteneurs();
|
await this.cleanupConteneurs();
|
||||||
await this.computeEncTotal();
|
await this.computeEncTotal();
|
||||||
await this.computeMalusArmure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -218,7 +217,12 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getMalusArmure() {
|
getMalusArmure() {
|
||||||
return Misc.toInt(this.system.attributs?.malusarmure?.value)
|
if (this.isPersonnage()) {
|
||||||
|
return this.itemTypes[TYPES.armure].filter(it => it.system.equipe)
|
||||||
|
.map(it => it.system.malus)
|
||||||
|
.reduce(Misc.sum(), 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1142,20 +1146,6 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async computeMalusArmure() {
|
|
||||||
if (this.isPersonnage()) {
|
|
||||||
const malusArmure = this.filterItems(it => it.type == 'armure' && it.system.equipe)
|
|
||||||
.map(it => it.system.malus ?? 0)
|
|
||||||
.reduce(Misc.sum(), 0);
|
|
||||||
// Mise à jour éventuelle du malus armure
|
|
||||||
if (this.system.attributs?.malusarmure?.value != malusArmure) {
|
|
||||||
await this.updateAttributeValue("malusarmure", malusArmure);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeResumeBlessure() {
|
computeResumeBlessure() {
|
||||||
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure')
|
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure')
|
||||||
|
@ -305,7 +305,6 @@ export class RdDRoll extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RollDataAjustements.calcul(rollData, this.actor);
|
RollDataAjustements.calcul(rollData, this.actor);
|
||||||
rollData.finalLevel = this._computeFinalLevel(rollData);
|
|
||||||
|
|
||||||
const resolutionTable = await RdDResolutionTable.buildHTMLTable(RdDResolutionTable.subTable(rollData.caracValue, rollData.finalLevel))
|
const resolutionTable = await RdDResolutionTable.buildHTMLTable(RdDResolutionTable.subTable(rollData.caracValue, rollData.finalLevel))
|
||||||
const adjustements = await this.buildAjustements(rollData);
|
const adjustements = await this.buildAjustements(rollData);
|
||||||
@ -330,30 +329,6 @@ export class RdDRoll extends Dialog {
|
|||||||
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html`, rollData);
|
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html`, rollData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
_computeFinalLevel(rollData) {
|
|
||||||
return RollDataAjustements.sum(rollData.ajustements);
|
|
||||||
}
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
_computeDiffCompetence(rollData) {
|
|
||||||
if (rollData.competence) {
|
|
||||||
return Misc.toInt(rollData.competence.system.niveau);
|
|
||||||
}
|
|
||||||
if (rollData.draconicList) {
|
|
||||||
return Misc.toInt(rollData.competence.system.niveau);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
_computeMalusArmure(rollData) {
|
|
||||||
let malusArmureValue = 0;
|
|
||||||
if (rollData.malusArmureValue && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) {
|
|
||||||
malusArmureValue = rollData.malusArmureValue;
|
|
||||||
}
|
|
||||||
return malusArmureValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_getTitle(rollData) {
|
_getTitle(rollData) {
|
||||||
const carac = rollData.selectedCarac.label;
|
const carac = rollData.selectedCarac.label;
|
||||||
|
@ -164,7 +164,7 @@ export class RollDataAjustements {
|
|||||||
descr: reference.getDescr && reference.getDescr(rollData, actor)
|
descr: reference.getDescr && reference.getDescr(rollData, actor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollData.finalLevel = RollDataAjustements.sum(rollData.ajustements);
|
rollData.finalLevel = RollDataAjustements.sum(rollData.ajustements)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -393,12 +393,6 @@
|
|||||||
"label": "Encombrement",
|
"label": "Encombrement",
|
||||||
"derivee": true
|
"derivee": true
|
||||||
},
|
},
|
||||||
"malusarmure": {
|
|
||||||
"type": "number",
|
|
||||||
"value": 0,
|
|
||||||
"label": "Malus Armure",
|
|
||||||
"derivee": true
|
|
||||||
},
|
|
||||||
"protection": {
|
"protection": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="caracteristique flexrow list-item" >
|
<li class="caracteristique flexrow list-item" >
|
||||||
<label class="carac-label">Malus armure</label>
|
<label class="carac-label">Malus armure</label>
|
||||||
<input class="derivee-value" type="number" disabled value="{{system.attributs.malusarmure.value}}" data-dtype="number"/>
|
<input class="derivee-value" type="number" disabled value="{{calc.malusArmure}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
<li class="caracteristique flexrow list-item">
|
<li class="caracteristique flexrow list-item">
|
||||||
<label class="carac-label" for="system.attributs.protection.value" >Protection naturelle</label>
|
<label class="carac-label" for="system.attributs.protection.value" >Protection naturelle</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user