Fix munition

This commit is contained in:
sladecraven 2021-04-23 20:40:59 +02:00
parent 131629fdb5
commit 0149f49e7c
3 changed files with 19 additions and 11 deletions

View File

@ -211,14 +211,19 @@ export class VadentisActor extends Actor {
title: `${this.name} encaisse des dégâts !`, title: `${this.name} encaisse des dégâts !`,
msg: `${this.name} encaisse ${damageValue} dégâts !` msg: `${this.name} encaisse ${damageValue} dégâts !`
} }
if ( game.user.isGM) {
msgData.msg += `<br>Ses Points de Vie actuels sont désormais de ${newValue}.`;
}
ChatMessage.create({ ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), //whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData) content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
}); });
if ( game.user.isGM) {
msgData.msg = `<br>Ses Points de Vie actuels sont désormais de ${newValue}.`;
ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients( 'GM'),
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
});
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -95,6 +95,12 @@ export class VadentisUtility extends Entity {
title: `${attacker.name} attaque ${defender.name}` title: `${attacker.name} attaque ${defender.name}`
} }
let tirMsg = "";
if ( combatData.arme.type == 'tir') {
attacker.decrementeMunition(combatData.arme);
tirMsg += `<br>C'est un tir, les munitions de l'attaquant ont été décrémentées`;
}
let formulaTouche = "1d20+"+attaque; let formulaTouche = "1d20+"+attaque;
let formulaFull = attacker.buildTexteFormula( attacker.data.data.combat.attaque ); let formulaFull = attacker.buildTexteFormula( attacker.data.data.combat.attaque );
let myRoll = await this.processRoll(formulaTouche); let myRoll = await this.processRoll(formulaTouche);
@ -103,11 +109,7 @@ export class VadentisUtility extends Entity {
let formula = combatData.arme.data.damage.toLowerCase(); let formula = combatData.arme.data.damage.toLowerCase();
msgData.msg = `${attacker.name} a réussi son attaque sur ${defender.name} (${formulaFull} => ${myRoll.total} / ${defense}) !<br> Les dégâts sont ${degats}.`; msgData.msg = `${attacker.name} a réussi son attaque sur ${defender.name} (${formulaFull} => ${myRoll.total} / ${defense}) !<br> Les dégâts sont ${degats}.`;
if ( combatData.arme.type == 'tir') { msgData.msg += tirMsg;
attacker.decrementeMunition(combatData.arme);
msgData.msg += `<br>C'est un tir, les munitions de l'attaquant ont été décrémentées`;
}
if ( myRoll.results[0] >= combatData.arme.data.valuecritical ) { if ( myRoll.results[0] >= combatData.arme.data.valuecritical ) {
degats = `critiques : ${combatData.arme.data.criticaldamage}`; degats = `critiques : ${combatData.arme.data.criticaldamage}`;
formula = combatData.arme.data.criticaldamage.toLowerCase(); formula = combatData.arme.data.criticaldamage.toLowerCase();
@ -126,6 +128,7 @@ export class VadentisUtility extends Entity {
} else { } else {
msgData.msg = `${attacker.name} a raté son attaque sur ${defender.name} (${myRoll.total} / ${defense}) !`; msgData.msg = `${attacker.name} a raté son attaque sur ${defender.name} (${myRoll.total} / ${defense}) !`;
} }
msgData.msg += tirMsg;
} }
ChatMessage.create({ ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), //whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-vadentis", "name": "foundryvtt-vadentis",
"title": "Vadentis", "title": "Vadentis",
"description": "Système Vadentis pour FoundryVTT", "description": "Système Vadentis pour FoundryVTT",
"version": "0.1.5", "version": "0.1.6",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9",