diff --git a/module/actor.js b/module/actor.js index 3e556485..9eaf5cdc 100644 --- a/module/actor.js +++ b/module/actor.js @@ -872,6 +872,12 @@ export class RdDActor extends Actor { await this.update({ [`data.compteurs.${fieldName}.value`]: fieldValue }); } + /* -------------------------------------------- */ + async addCompteurValue(fieldName, fieldValue) { + let oldValue = (Misc.templateData(this)).compteurs[fieldName].value; + await this.update({ [`data.compteurs.${fieldName}.value`]: Number(oldValue) + Number(fieldValue) } ); + } + /* -------------------------------------------- */ async updateAttributeValue(fieldName, fieldValue) { await this.update({ [`data.attributs.${fieldName}.value`]: fieldValue }); @@ -1245,7 +1251,7 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ async cacheTMRetMessage() { - await this.reinsertionAleatoire(); + await this.reinsertionAleatoire("Action MJ"); await this.cacheTMR(); game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_tmr_move", data: { @@ -2877,7 +2883,6 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ refreshTMRView(tmrData) { - console.log("REFRESH !!!!"); if (this.currentTMR) { this.currentTMR.externalRefresh(tmrData) } diff --git a/module/rdd-commands.js b/module/rdd-commands.js index f7d5bb4c..cf4c2322 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -94,6 +94,14 @@ export class RdDCommands { descr: "Supprime les signes draconiques éphémères" }); + rddCommands.registerCommand({ + path: ["/stress"], func: (content, msg, params) => RdDUtility.distribuerStress(params[0], params[1], params[2]), + descr: `Distribue du stress aux personnages. Exemples: +
/stress 6 : Distribue 6 points des Stress à tout les personnages joueurs, sans raison renseignée +
/stress 6 Tigre : Distribue 6 points des Stress à tout les personnages joueurs, à cause d'un Tigre Vert +
/stress 6 Glou Paulo : Distribue 6 points de Stres à l'acteur connecté au joueur Paulo, à cause d'un Glou` + }); + game.system.rdd.commands = rddCommands; } } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 95f662fa..068efcb1 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -779,6 +779,28 @@ export class RdDUtility { } } + /*-------------------------------------------- */ + static distribuerStress( stressValue, raison = 'Inconnu', nomJoueur = undefined) { + if (game.user.isGM) { + if( nomJoueur == undefined) { + for (let actor of game.actors) { + if (actor.hasPlayerOwner) { + actor.addCompteurValue('stress', stressValue); + ui.notifications.info(`${actor.name} a reçu ${stressValue} points de Stress (raison : ${raison})`); + } + } + } else { + //console.log(stressValue, nomJoueur); + let joueur = game.users.find( user => user.name.toLowerCase() == nomJoueur.toLowerCase() ); + //console.log("Player", joueur, joueur.character ); + joueur.character.addCompteurValue('stress', stressValue); + ui.notifications.info(`${joueur.character.name} a reçu ${stressValue} points de Stress (raison : ${raison})`); + } + } else { + ui.notifications.warn("Seul le MJ est autorisé à utiliser la commande /stress"); + } + } + /*-------------------------------------------- */ static async onRenderChatMessage(app, html, msg) { // TODO diff --git a/system.json b/system.json index dacf2e41..d56d4fed 100644 --- a/system.json +++ b/system.json @@ -2,11 +2,11 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.4.4", + "version": "1.4.6", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "0.8.1", - "templateVersion": 114, + "templateVersion": 115, "author": "LeRatierBretonnien", "authors": [ { diff --git a/template.json b/template.json index a18b5589..d3cf2f3c 100644 --- a/template.json +++ b/template.json @@ -24,7 +24,8 @@ "sexe": "", "age": 0, "beaute": 10, - "main": "droitier" + "main": "droitier", + "experiencelog": [] }, "vehicule": { "categorie": "",