diff --git a/modules/vadentis-actor.js b/modules/vadentis-actor.js
index b7d7834..f3fa7fa 100644
--- a/modules/vadentis-actor.js
+++ b/modules/vadentis-actor.js
@@ -205,8 +205,12 @@ export class VadentisActor extends Actor {
alias: this.name,
img: "systems/foundryvtt-vadentis/images/icons/tchat_dégâts_infligés.webp",
title: `${this.name} encaisse des dégâts !`,
- msg: `${this.name} vient de perdre ${damageValue} Points de Vie. Ses Points de Vie actuels sont désormais de ${newValue}.`
+ msg: `${this.name} encaisse ${damageValue} dégâts !`
}
+ if ( game.user.isGM) {
+ msgData.msg += `
Ses Points de Vie actuels sont désormais de ${newValue}.`;
+ }
+
ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
@@ -298,12 +302,13 @@ export class VadentisActor extends Actor {
let msgData = {
alias: this.name,
img: competence.img,
+ rollMode: game.settings.get("core", "rollMode"),
title: `Compétence ${competence.name}`
}
let statValue = competence.data.base + competence.data.malus + competence.data.bonus;
let formulaFull = this.buildTexteFormula( competence.data );
- let myRoll = await VadentisUtility.processRoll("1d20+"+statValue );
+ let myRoll = await VadentisUtility.processRoll("1d20+"+statValue, msgData.rollMode );
msgData.msg = `${formulaFull} => ${myRoll.total}`;
if (myRoll.results[0] == 1 ) { // Critique ?
@@ -315,8 +320,12 @@ export class VadentisActor extends Actor {
msgData.msg += `
C'est une réussite critique !`;
}
+ if (["gmroll", "blindroll"].includes(msgData.rollMode)) msgData["whisper"] = ChatMessage.getWhisperRecipients("GM").map(u => u.id);
+ if (msgData.rollMode === "blindroll") msgData["blind"] = true;
+ else if (msgData.rollMode === "selfroll") msgData["whisper"] = [game.user];
+
ChatMessage.create({
- //whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
+ whisper: msgData["whisper"],
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
});
} else {
@@ -365,6 +374,15 @@ export class VadentisActor extends Actor {
this.genericRoll( stat, magieName );
}
+ /* -------------------------------------------- */
+ async decrementeMunition( arme ) {
+ let armeTir = this.data.items.find( item => item.type == 'tir' && item.name == arme.name);
+ if (armeTir) {
+ let newMunition = armeTir.data.munition - 1;
+ await this.updateOwnedItem( { _id: armeTir._id, 'data.munition': newMunition } );
+ }
+ }
+
/* -------------------------------------------- */
rollArme(armeId) {
let target = VadentisUtility.getTarget();
@@ -372,6 +390,10 @@ export class VadentisActor extends Actor {
if ( target ) {
let arme = this.data.items.find( item => (item.type == 'armecc' || item.type == 'tir') && item._id == armeId);
if (arme) {
+ if ( arme == 'tir' && arme.data.munition <= 0 ) {
+ ui.notifications.warn("Vous n'avez plus de munitions avec cette arme.");
+ return;
+ }
let combatData = {
attackerActorId: this._id,
targetActorId: target.actor._id,
diff --git a/modules/vadentis-utility.js b/modules/vadentis-utility.js
index 253acc8..4855fca 100644
--- a/modules/vadentis-utility.js
+++ b/modules/vadentis-utility.js
@@ -72,7 +72,7 @@ export class VadentisUtility extends Entity {
}
/* -------------------------------------------- */
- static async processRoll( formula ) {
+ static async processRoll( formula, rollMode ) {
let myRoll = new Roll(formula);
myRoll.evaluate();
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
@@ -102,6 +102,11 @@ export class VadentisUtility extends Entity {
let degats = `normaux : ${combatData.arme.data.damage}`;
let formula = combatData.arme.data.damage.toLowerCase();
msgData.msg = `${attacker.name} a réussi son attaque sur ${defender.name} (${formulaFull} => ${myRoll.total} / ${defense}) !
Les dégâts sont ${degats}.`;
+
+ if ( combatData.arme.type == 'tir') {
+ attacker.decrementeMunition(combatData.arme);
+ msgData.msg += `
C'est un tir, les munitions de l'attaquant ont été décrémentées`;
+ }
if ( myRoll.results[0] >= combatData.arme.data.valuecritical ) {
degats = `critiques : ${combatData.arme.data.criticaldamage}`;
diff --git a/system.json b/system.json
index 9496d21..5fc74ed 100644
--- a/system.json
+++ b/system.json
@@ -2,11 +2,11 @@
"name": "foundryvtt-vadentis",
"title": "Vadentis",
"description": "Système Vadentis pour FoundryVTT",
- "version": "0.1.1",
+ "version": "0.1.2",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",
- "templateVersion": 15,
+ "templateVersion": 16,
"author": "Uberwald",
"esmodules": [ "modules/vadentis-main.js" ],
"styles": ["styles/simple.css"],
diff --git a/template.json b/template.json
index 6faa4c8..ee5fa76 100644
--- a/template.json
+++ b/template.json
@@ -109,6 +109,7 @@
"damagecritical": ""
},
"equipcommun": {
+ "quantite": 1,
"equipee": false,
"description": "",
"enc": 0,
@@ -146,6 +147,7 @@
"base": 0,
"bonus": 0,
"malus": 0,
+ "competencerole": false,
"description": ""
},
"armecc": {
@@ -159,7 +161,7 @@
"type": "",
"damage": "",
"criticaldamage": "",
- "munition": "",
+ "munition": 0,
"distance": "",
"valuecritical": 20,
"templates": [ "equipcommun" ]
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 09ac31a..a555ba8 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -194,6 +194,7 @@