#191 - Ajout de la commande stress
This commit is contained in:
parent
04d631e2b4
commit
e35fafddf4
@ -868,10 +868,11 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateExperienceLog( mode, valeur, raison) {
|
||||
async updateExperienceLog( modeXP, valeurXP, raisonXP = 'Inconnue') {
|
||||
let d = new Date();
|
||||
console.log( modeXP, valeurXP, raisonXP);
|
||||
let expLog = duplicate( (Misc.templateData(this)).experiencelog );
|
||||
expLog.push( { mode: Misc.upperFirst(mode), valeur: valeur, raison: Misc.upperFirst(raison),
|
||||
expLog.push( { mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP),
|
||||
daterdd : game.system.rdd.calendrier.getDateFromIndex(), datereel: `${d.getDate()}/${d.getMonth()+1}/${d.getFullYear()}` } );
|
||||
await this.update({ [`data.experiencelog`]: expLog } );
|
||||
console.log("Add XP log", expLog);
|
||||
@ -881,7 +882,7 @@ export class RdDActor extends Actor {
|
||||
async updateCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {
|
||||
await this.update({ [`data.compteurs.${fieldName}.value`]: fieldValue });
|
||||
if ( fieldName == 'stress') {
|
||||
await this.updateExperienceLog('stress', raison, fieldValue);
|
||||
await this.updateExperienceLog('stress', fieldValue, raison);
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,7 +891,7 @@ export class RdDActor extends Actor {
|
||||
let oldValue = (Misc.templateData(this)).compteurs[fieldName].value;
|
||||
await this.update({ [`data.compteurs.${fieldName}.value`]: Number(oldValue) + Number(fieldValue) } );
|
||||
if ( fieldName == 'stress') {
|
||||
await this.updateExperienceLog('stress', raison, fieldValue);
|
||||
await this.updateExperienceLog('stress', fieldValue, raison );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1927,6 +1928,8 @@ export class RdDActor extends Actor {
|
||||
compteurs.dissolution.value = dissolution - perteDissolution;
|
||||
compteurs.exaltation.value = 0;
|
||||
await this.update({ "data.compteurs": compteurs });
|
||||
|
||||
this.updateExperienceLog( 'XP', stressRollData.xp, "Transformation du stress");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user