fix: prevent duplicate cross-client defense dialog, clear bleed on heal
- Only send attackBoosted socket when attackerHandledBonus || attackerHasNonGMOwner (GM→player: hook handles it, no socket needed; PC→PC: socket needed) - Clear bleeding wounds when HP restored via token HUD heal buttons
This commit is contained in:
+12
-1
@@ -29,7 +29,7 @@ export default class LethalFantasyUtils {
|
||||
static setHookListeners() {
|
||||
|
||||
Hooks.on('renderTokenHUD', async (hud, html, token) => {
|
||||
if (html.querySelector(".lethal-hp-loss-hud")) return
|
||||
if (html.find(".lethal-hp-loss-hud").length) return
|
||||
// HP Loss Button (existing)
|
||||
const lossHPButton = await foundry.applications.handlebars.renderTemplate('systems/fvtt-lethal-fantasy/templates/loss-hp-hud.hbs', {})
|
||||
$(html).find('div.left').append(lossHPButton);
|
||||
@@ -99,6 +99,17 @@ export default class LethalFantasyUtils {
|
||||
log(tokenFull, token)
|
||||
let actor = tokenFull.actor;
|
||||
await actor.applyDamage(Number(hpGain)); // Positive value to add HP
|
||||
// Clear bleeding wounds on heal — regardless of heal amount, any
|
||||
// healing is enough to stop bleeding (field dressing / magic / rest).
|
||||
const wounds = foundry.utils.duplicate(actor.system.hp.wounds || [])
|
||||
const hadBleeding = wounds.some(w => w.description === "Bleeding")
|
||||
if (hadBleeding) {
|
||||
await actor.update({
|
||||
"system.hp.wounds": wounds.map(w =>
|
||||
w.description === "Bleeding" ? { value: 0, duration: 0 } : w
|
||||
)
|
||||
})
|
||||
}
|
||||
$(html).find('.hp-gain-wrap')[0].classList.remove('hp-gain-hud-active');
|
||||
$(html).find('.hp-gain-wrap')[0].classList.add('hp-gain-hud-disabled');
|
||||
$(html).find('.hp-gain-wrap')[1].classList.remove('hp-gain-hud-active');
|
||||
|
||||
Reference in New Issue
Block a user