WFRP4e-FoundryVTT
WFRP4e-FoundryVTT copied to clipboard
Enhanced Healing Draught effect
Describe:
Hey, what do you think about the changes I made to Healing Draught? Can you consider use this changed code?
Source of current Healing Draught:
let wounds = this.actor.status.wounds
if (wounds.value == 0)
return ui.notifications.error("No effect at 0 Wounds")
ui.notifications.notify(`Healed ${this.actor.characteristics.t.bonus} Wounds`)
this.actor.modifyWounds(this.actor.characteristics.t.bonus)
Source of my suggestion to Healing Draught:
let wounds = this.actor.status.wounds.value;
let max = this.actor.status.wounds.max;
if (wounds === 0)
return ui.notifications.error("No effect at 0 Wounds, wasted a dose")
if (wounds === max)
return ui.notifications.error("No effect, Wounds were already max, wasted a dose")
let tbonus = this.actor.characteristics.t.bonus;
let missing = max - wounds;
let recovered = missing < tbonus ? missing : tbonus;
this.actor.modifyWounds(recovered);
return ui.notifications.notify(`Healed ${recovered} Wounds`);
What I do is:
Reminder that dose was used (in both codes has reduce quantity on use), and even when there is no effect display a notification that dose was wasted.
display notifications when wounds were already max
if (wounds === max)
return ui.notifications.error("No effect, Wounds were already max, wasted a dose")
If character has fewer missing Wounds (to max) than his Toughness bonus notifications will display the practical number of Wounds that are healed, not the amount of Toughness bonus. eg. When character has Toughness bonus = 2 and 9/10 Wounds then notifications display that heal 1 Wound not 2 (because in practice it actually heals 1 wound)
let tbonus = this.actor.characteristics.t.bonus;
let missing = max - wounds;
let recovered = missing < tbonus ? missing : tbonus;