#1 gestion encombrement et malus associé
This commit is contained in:
parent
70abeb2c87
commit
021948bf6e
@ -103,6 +103,9 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
|
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
|
||||||
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
|
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
|
||||||
|
|
||||||
|
// Mise à jour de l'encombrement total
|
||||||
|
this.actor.computeEncombrementTotal();
|
||||||
|
|
||||||
// low is normal, this the base used to compute the grid.
|
// low is normal, this the base used to compute the grid.
|
||||||
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
||||||
data.data.materiel = this._checkNull(data.itemsByType['objet']);
|
data.data.materiel = this._checkNull(data.itemsByType['objet']);
|
||||||
@ -121,11 +124,10 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
data.data.tetes = this._checkNull(data.itemsByType['tete']);
|
data.data.tetes = this._checkNull(data.itemsByType['tete']);
|
||||||
data.data.objets = data.data.materiel.concat(data.data.armes).concat(data.data.armures).concat(data.data.munitions).concat(data.data.livres).concat(data.data.potions).concat(data.data.herbes).concat(data.data.ingredients);
|
data.data.objets = data.data.materiel.concat(data.data.armes).concat(data.data.armures).concat(data.data.munitions).concat(data.data.livres).concat(data.data.potions).concat(data.data.herbes).concat(data.data.ingredients);
|
||||||
data.data.competenceByCategory = data.competenceByCategory;
|
data.data.competenceByCategory = data.competenceByCategory;
|
||||||
|
data.data.encombrementTotal = this.actor.encombrementTotal;
|
||||||
data.data.isGM = game.user.isGM;
|
data.data.isGM = game.user.isGM;
|
||||||
data.bonusmalusTable = CONFIG.RDD.bonusmalus;
|
data.bonusmalusTable = CONFIG.RDD.bonusmalus;
|
||||||
|
|
||||||
this.actor.computeEncombrementTotal();
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ export class RdDActor extends Actor {
|
|||||||
const data = actorData.data;
|
const data = actorData.data;
|
||||||
const flags = actorData.flags;
|
const flags = actorData.flags;
|
||||||
|
|
||||||
|
// Dynamic computing fields
|
||||||
|
this.encombrementTotal = 0;
|
||||||
|
|
||||||
// Make separate methods for each Actor type (character, npc, etc.) to keep
|
// Make separate methods for each Actor type (character, npc, etc.) to keep
|
||||||
// things organized.
|
// things organized.
|
||||||
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
|
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
|
||||||
@ -80,6 +83,7 @@ export class RdDActor extends Actor {
|
|||||||
_prepareCharacterData(actorData) {
|
_prepareCharacterData(actorData) {
|
||||||
// Initialize empty items
|
// Initialize empty items
|
||||||
RdDUtility.computeCarac(actorData.data);
|
RdDUtility.computeCarac(actorData.data);
|
||||||
|
this.computeEncombrementTotal();
|
||||||
this.computeEtatGeneral();
|
this.computeEtatGeneral();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,6 +371,19 @@ export class RdDActor extends Actor {
|
|||||||
await this.update( {"data.compteurs": compteurs } );
|
await this.update( {"data.compteurs": compteurs } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
detectSurEncombrement( ) {
|
||||||
|
let diffEnc = Number(this.encombrementTotal) - Number(this.data.data.attributs.encombrement.value);
|
||||||
|
console.log("Sur enc", this.encombrementTotal, diffEnc);
|
||||||
|
if ( diffEnc > 0 ) { // Sur-encombrement
|
||||||
|
let malus = Math.round( diffEnc);
|
||||||
|
malus = (malus == 0) ? 1 : malus; // Always 1 at least
|
||||||
|
console.log("Sur enc malus", malus);
|
||||||
|
return malus;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeEncombrementTotal( ) {
|
computeEncombrementTotal( ) {
|
||||||
let totalEnc = 0;
|
let totalEnc = 0;
|
||||||
@ -375,7 +392,8 @@ export class RdDActor extends Actor {
|
|||||||
totalEnc += Number(item.data.encombrement);
|
totalEnc += Number(item.data.encombrement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Enc total : ", totalEnc);
|
this.encombrementTotal = totalEnc;
|
||||||
|
this.detectSurEncombrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -386,6 +404,7 @@ export class RdDActor extends Actor {
|
|||||||
state = state - (data.sante.vie.max - data.sante.vie.value);
|
state = state - (data.sante.vie.max - data.sante.vie.value);
|
||||||
if (data.sante.fatigue) // Creatures n'ont pas de fatigue
|
if (data.sante.fatigue) // Creatures n'ont pas de fatigue
|
||||||
state = state + RdDUtility.currentFatigueMalus(data.sante.fatigue.value, data.sante.endurance.max);
|
state = state + RdDUtility.currentFatigueMalus(data.sante.fatigue.value, data.sante.endurance.max);
|
||||||
|
state = state - this.detectSurEncombrement();
|
||||||
data.compteurs.etat.value = state;
|
data.compteurs.etat.value = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-reve-de-dragon",
|
"name": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"version": "0.9.30",
|
"version": "0.9.32",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 41,
|
"templateVersion": 41,
|
||||||
|
@ -421,6 +421,7 @@
|
|||||||
|
|
||||||
{{!-- Equipment Tab --}}
|
{{!-- Equipment Tab --}}
|
||||||
<div class="tab items" data-group="primary" data-tab="items">
|
<div class="tab items" data-group="primary" data-tab="items">
|
||||||
|
<span cass=item-name>Encombrement total/max : {{data.encombrementTotal}} / {{data.attributs.encombrement.value}}</span>
|
||||||
<ol class="item-list">
|
<ol class="item-list">
|
||||||
{{#each data.armes_seules as |item id|}}
|
{{#each data.armes_seules as |item id|}}
|
||||||
<li class="item flexrow" data-item-id="{{item._id}}">
|
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||||
|
Loading…
Reference in New Issue
Block a user