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