#171 - Gestion potion de soins (WIP)

This commit is contained in:
sladecraven 2021-04-04 23:07:13 +02:00
parent 9cc73e971d
commit dc48f08203

View File

@ -348,6 +348,7 @@ export class RdDActor extends Actor {
await this._recupereChance(); await this._recupereChance();
await this.transformerStress(); await this.transformerStress();
await this.retourSeuilDeReve(message); await this.retourSeuilDeReve(message);
this.bonusRecuperationPotion= 0; // Reset potion
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`; message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
ChatMessage.create(message); ChatMessage.create(message);
} }
@ -363,12 +364,13 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _recupererBlessures(message, type, liste, moindres) { async _recupererBlessures(message, type, liste, moindres) {
if (!this.bonusRecuperationPotion) this.bonusRecuperationPotion = 0;
let count = 0; let count = 0;
const definitions = RdDUtility.getDefinitionsBlessures(); const definitions = RdDUtility.getDefinitionsBlessures();
let definition = definitions.find(d => d.type == type); let definition = definitions.find(d => d.type == type);
for (let blessure of liste) { for (let blessure of liste) {
if (blessure.jours >= definition.facteur) { if (blessure.jours >= definition.facteur) {
let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets), message); let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets)+this.bonusRecuperationPotion, message);
blessure.soins_complets = 0; blessure.soins_complets = 0;
if (rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) { if (rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) {
message.content += ` -- une blessure ${type} cicatrise`; message.content += ` -- une blessure ${type} cicatrise`;
@ -3085,6 +3087,7 @@ export class RdDActor extends Actor {
let pvManquants = myData.sante.vie.max - myData.sante.vie.value; let pvManquants = myData.sante.vie.max - myData.sante.vie.value;
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2 )); let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2 ));
pointsGuerison -= pvSoignees*2;
guerisonData.list.push( pvSoignees + " Points de Vie soignés"); guerisonData.list.push( pvSoignees + " Points de Vie soignés");
await this.santeIncDec('vie', +pvSoignees, false); await this.santeIncDec('vie', +pvSoignees, false);
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison; guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
@ -3094,9 +3097,10 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async consommerPotionSoin(potionData) { async consommerPotionSoin(potionData) {
potionData.alias = this.name;
if (potionData.data.categorie.includes('Enchante')) { if (potionData.data.categorie.includes('Enchante')) {
potionData.pointsGuerison = RdDHerbes.calculePointsGuerison( potionData.data); potionData.pointsGuerison = RdDHerbes.calculePointsGuerison( potionData.data);
potionData.alias = this.name;
potionData.enchanteTexte = "enchantée"; potionData.enchanteTexte = "enchantée";
potionData.isEnchante = true; potionData.isEnchante = true;
ChatMessage.create({ ChatMessage.create({
@ -3122,7 +3126,13 @@ export class RdDActor extends Actor {
}); });
} }
} else { } else {
potionData.enchanteTexte = "";
potionData.isEnchante = false;
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-soin.html`, potionData )
});
this.bonusRecuperationPotion = potionData.data.herbeBonus;
} }
} }