Fix message sur-encombrement
This commit is contained in:
parent
db0f8e50d2
commit
009ec47709
@ -33,8 +33,8 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
|
||||
caracTotal: RdDCarac.computeTotal(formData.data.carac),
|
||||
resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures),
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
}
|
||||
formData.calc.surEncombrementMessage = (formData.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : "";
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData);
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
|
||||
|
@ -75,8 +75,8 @@ export class RdDActorSheet extends ActorSheet {
|
||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
|
||||
fatigue: RdDUtility.calculFatigueHtml(formData.data.sante.fatigue.value, formData.data.sante.endurance.max),
|
||||
resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
};
|
||||
formData.calc.surEncombrementMessage = (formData.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : "";
|
||||
|
||||
formData.competences.forEach(item => {
|
||||
item.visible = this.options.cherchercompetence
|
||||
@ -136,7 +136,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.actor.addSubacteur(dragData.id || dragData.data._id);
|
||||
super._onDropActor(event, dragData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDropItem(event, dragData) {
|
||||
const callSuper = await this.actor.processDropItem(RdDSheetUtility.extractItemDropParameters(event, dragData, this.actor, this.objetVersConteneur));
|
||||
|
@ -58,10 +58,10 @@ export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
|
||||
formData.options.isGM = game.user.isGM;
|
||||
|
||||
formData.calc ={
|
||||
formData.calc = {
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
}
|
||||
formData.calc.surEncombrementMessage = formData.calc.encTotal > formData.data.capacite_encombrement ? "Sur-Encombrement!" : "",
|
||||
|
||||
console.log("DATA", formData);
|
||||
|
||||
|
@ -308,10 +308,6 @@ export class RdDActor extends Actor {
|
||||
return Math.floor(Misc.templateData(this).prixTotalEquipement ?? 0);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSurenc() {
|
||||
return Misc.templateData(this).compteurs.surenc?.value ?? 0;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getCompetence(idOrName, options = {}) {
|
||||
return RdDItemCompetence.findCompetence(this.data.items, idOrName, options);
|
||||
@ -1294,6 +1290,9 @@ export class RdDActor extends Actor {
|
||||
computeMalusSurEncombrement() {
|
||||
return Math.min(0, this.getEncombrementMax() - Math.ceil(Number(this.getEncTotal())));
|
||||
}
|
||||
getMessageSurEncombrement(){
|
||||
return this.computeMalusSurEncombrement() <0 ? "Sur-Encombrement!" : "";
|
||||
}
|
||||
|
||||
getEncombrementMax() {
|
||||
return (this.data.type == 'vehicule')
|
||||
|
@ -51,7 +51,7 @@ export class RdDRoll extends Dialog {
|
||||
diffLibre: rollData.competence?.data.default_diffLibre ?? 0,
|
||||
malusArmureValue: actor.getMalusArmure(),
|
||||
surencMalusFlag: actor.isPersonnage() ? (actorData.data.compteurs.surenc.value < 0) : false,
|
||||
surencMalusValue: actor.getSurenc(),
|
||||
surencMalusValue: actor.computeMalusSurEncombrement(),
|
||||
useMalusSurenc: false,
|
||||
useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
|
||||
perteMoralEchec: false, /* Pour l'affichage dans le chat */
|
||||
|
@ -71,7 +71,7 @@ export const referenceAjustements = {
|
||||
isVisible: (rollData, actor) => rollData.useMalusSurenc,
|
||||
isUsed: (rollData, actor) => rollData.useMalusSurenc,
|
||||
getLabel: (rollData, actor) => 'Sur-encombrement',
|
||||
getValue: (rollData, actor) => actor.getSurenc()
|
||||
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
|
||||
},
|
||||
moral: {
|
||||
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.useMoral,
|
||||
|
Loading…
Reference in New Issue
Block a user