diff --git a/module/actor.js b/module/actor.js
index 0b0ed72f..60f112d8 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -3841,32 +3841,21 @@ export class RdDActor extends Actor {
potionData.supprimer = true;
if (potionData.data.magique) {
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
- });
// Gestion de la résistance:
- let rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
- potionData.reveResultDice = rolled.roll;
- potionData.scoreReve = rolled.score;
- potionData.reussiteReve = false;
- if (!rolled.isSuccess) {
+ potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potionData.rolled.isEchec) {
await this.reveActuelIncDec(-1);
potionData.guerisonData = await this.buildPotionGuerisonList(potionData.data.puissance);
potionData.guerisonMinutes = potionData.guerisonData.pointsConsommes * 5;
- potionData.reussiteReve = true;
}
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-soin.html`, potionData)
- });
- } else {
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-soin.html`, potionData)
- });
+ }
+ if (!potionData.data.magique || potionData.rolled.isSuccess) {
this.bonusRecuperationPotion = potionData.data.herbeBonus;
}
+ ChatMessage.create({
+ whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
+ });
}
/* -------------------------------------------- */
@@ -3875,22 +3864,14 @@ export class RdDActor extends Actor {
potionData.supprimer = true;
if (potionData.data.magique) {
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
- });
// Gestion de la résistance:
- let rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
- potionData.reveResultDice = rolled.roll;
- potionData.scoreReve = rolled.score;
- potionData.reussiteReve = false;
- if (!rolled.isSuccess) {
+ potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potionData.rolled.isEchec) {
await this.reveActuelIncDec(-1);
let fatigueActuelle = this.getFatigueActuelle();
potionData.caseFatigueReel = Math.min(fatigueActuelle, potionData.data.puissance);
potionData.guerisonDureeUnite = (potionData.data.reposalchimique) ? "rounds" : "minutes";
potionData.guerisonDureeValue = (potionData.data.reposalchimique) ? potionData.caseFatigueReel : potionData.caseFatigueReel * 5;
- potionData.reussiteReve = true;
potionData.aphasiePermanente = false;
if (potionData.data.reposalchimique) {
let chanceAphasie = await RdDDice.rollTotal("1d100");
@@ -3900,17 +3881,14 @@ export class RdDActor extends Actor {
}
await this.santeIncDec("fatigue", -potionData.caseFatigueReel);
}
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-repos.html`, potionData)
- });
- } else {
- ChatMessage.create({
- whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-repos.html`, potionData)
- });
+ }
+ if (!potionData.data.magique || potionData.rolled.isSuccess) {
this.bonusRepos = potionData.data.herbeBonus;
}
+ ChatMessage.create({
+ whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
+ });
}
/* -------------------------------------------- */
dialogFabriquerPotion(herbe) {
@@ -3938,10 +3916,9 @@ export class RdDActor extends Actor {
let newQuantite = herbeData.data.quantite - herbeData.nbBrins;
let messageData = {
alias: this.name,
- categorie: herbeData.data.categorie,
- herbe: herbeData.name,
- nbBrinsPotion: herbeData.nbBrins,
- nbBrinsReste: newQuantite
+ nbBrinsReste: newQuantite,
+ potion: newPotion,
+ herbe: herbeData
}
this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins);
@@ -3949,7 +3926,6 @@ export class RdDActor extends Actor {
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData)
});
-
}
/* -------------------------------------------- */
@@ -3964,6 +3940,13 @@ export class RdDActor extends Actor {
async consommerPotionGenerique(potionData) {
potionData.alias = this.name;
+ if (potionData.data.magique) {
+ // Gestion de la résistance:
+ potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potionData.rolled.isEchec) {
+ await this.reveActuelIncDec(-1);
+ }
+ }
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData)
diff --git a/templates/chat-appliquer-potion-repos.html b/templates/chat-appliquer-potion-repos.html
deleted file mode 100644
index 23fdd89d..00000000
--- a/templates/chat-appliquer-potion-repos.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-