forked from public/foundryvtt-reve-de-dragon
Bugfixes
This commit is contained in:
@ -298,21 +298,12 @@ export class RdDActor extends Actor {
|
||||
let troncList = RdDUtility.isTronc( compName );
|
||||
let maxNiveau = compValue;
|
||||
if ( troncList ) {
|
||||
let troncCompValue = (compValue > 0) ? 0 : compValue; // Clamp it to 0
|
||||
let message = "Vous avez modifié une compétence 'tronc'. Vérifiez que les compétences suivantes évoluent ensemble jusqu'au niveau 0 : ";
|
||||
for(let troncName of troncList) {
|
||||
if ( troncName != compName) {
|
||||
console.log("Update competence tronc", troncName, compValue);
|
||||
let comp2 = RdDUtility.findCompetence( this.data.items, troncName);
|
||||
if (comp2.data.niveau > maxNiveau) maxNiveau = comp2.data.niveau;
|
||||
if ( comp2.data.niveau <= 0 && comp2.data.niveau < troncCompValue ) { // Update only of below 0
|
||||
const update = {_id: comp2._id, 'data.niveau': compValue };
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( compValue < maxNiveau) { // Manage case when someone set a value below
|
||||
compValue = (maxNiveau > 0) ? 0 : maxNiveau;
|
||||
message += "<br>" + troncName;
|
||||
}
|
||||
ChatMessage.create( { title : "Compétence Tron",
|
||||
content: message } );
|
||||
}
|
||||
const update = {_id: comp._id, 'data.niveau': maxNiveau };
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
|
@ -295,7 +295,7 @@ export class RdDUtility {
|
||||
data.carac.tir.value = Math.floor( (parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2);
|
||||
data.carac.lancer.value = Math.floor( (parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2);
|
||||
|
||||
data.sante.vie.max = Math.ceil( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value) /2 );
|
||||
data.sante.vie.max = Math.ceil( (parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) /2 );
|
||||
if ( data.sante.vie.value > data.sante.vie.max)
|
||||
data.sante.vie.value = data.sante.vie.max;
|
||||
let endurance = Math.max( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value) );
|
||||
|
Reference in New Issue
Block a user