forked from public/foundryvtt-reve-de-dragon
#191 - Ajout de la commande stress
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user