Amélioration des potions

- effet de base en cas de résistance à potion magique
- un seul message de tchat
- affichage du résultat du jet de résistance
- utilisation des l'image de la potion
- fabrication avec image de l'herbe
This commit is contained in:
Vincent Vandemeulebrouck
2021-10-09 22:04:34 +02:00
parent 9a637be4e9
commit bf2ec639c8
7 changed files with 76 additions and 101 deletions

View File

@ -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)