#191 - Ajout de la commande stress
This commit is contained in:
parent
7022c2134e
commit
3621a4e09d
@ -872,6 +872,12 @@ export class RdDActor extends Actor {
|
|||||||
await this.update({ [`data.compteurs.${fieldName}.value`]: fieldValue });
|
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) {
|
async updateAttributeValue(fieldName, fieldValue) {
|
||||||
await this.update({ [`data.attributs.${fieldName}.value`]: fieldValue });
|
await this.update({ [`data.attributs.${fieldName}.value`]: fieldValue });
|
||||||
@ -1245,7 +1251,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async cacheTMRetMessage() {
|
async cacheTMRetMessage() {
|
||||||
await this.reinsertionAleatoire();
|
await this.reinsertionAleatoire("Action MJ");
|
||||||
await this.cacheTMR();
|
await this.cacheTMR();
|
||||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||||
msg: "msg_tmr_move", data: {
|
msg: "msg_tmr_move", data: {
|
||||||
@ -2877,7 +2883,6 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
refreshTMRView(tmrData) {
|
refreshTMRView(tmrData) {
|
||||||
console.log("REFRESH !!!!");
|
|
||||||
if (this.currentTMR) {
|
if (this.currentTMR) {
|
||||||
this.currentTMR.externalRefresh(tmrData)
|
this.currentTMR.externalRefresh(tmrData)
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,14 @@ export class RdDCommands {
|
|||||||
descr: "Supprime les signes draconiques éphémères"
|
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:
|
||||||
|
<br><strong>/stress 6</strong> : Distribue 6 points des Stress à tout les personnages joueurs, sans raison renseignée
|
||||||
|
<br><strong>/stress 6 Tigre</strong> : Distribue 6 points des Stress à tout les personnages joueurs, à cause d'un Tigre Vert
|
||||||
|
<br><strong>/stress 6 Glou Paulo</strong> : Distribue 6 points de Stres à l'acteur connecté au joueur Paulo, à cause d'un Glou`
|
||||||
|
});
|
||||||
|
|
||||||
game.system.rdd.commands = rddCommands;
|
game.system.rdd.commands = rddCommands;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
static async onRenderChatMessage(app, html, msg) {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"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": "1.4.4",
|
"version": "1.4.6",
|
||||||
"manifestPlusVersion": "1.0.0",
|
"manifestPlusVersion": "1.0.0",
|
||||||
"minimumCoreVersion": "0.8.0",
|
"minimumCoreVersion": "0.8.0",
|
||||||
"compatibleCoreVersion": "0.8.1",
|
"compatibleCoreVersion": "0.8.1",
|
||||||
"templateVersion": 114,
|
"templateVersion": 115,
|
||||||
"author": "LeRatierBretonnien",
|
"author": "LeRatierBretonnien",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
"sexe": "",
|
"sexe": "",
|
||||||
"age": 0,
|
"age": 0,
|
||||||
"beaute": 10,
|
"beaute": 10,
|
||||||
"main": "droitier"
|
"main": "droitier",
|
||||||
|
"experiencelog": []
|
||||||
},
|
},
|
||||||
"vehicule": {
|
"vehicule": {
|
||||||
"categorie": "",
|
"categorie": "",
|
||||||
|
Loading…
Reference in New Issue
Block a user