heals event?

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
white_haired_uncle
Posts: 1310
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

heals event?

Post by white_haired_uncle »

I can't find an event that occurs on healing. Kind of surprising. I'd like to make a healer who takes "damage" when healing others. I've also thought about having "healing experience" where for example a shaman who heals N units or M amount of damage advances to druid (why would a unit on a path towards becoming a healer advance via combat?).

I guess I'd have to roll my own based on turn refresh? I don't like that, as I can't think of a good way to avoid double-healing.
Speak softly, and carry Doombringer.
User avatar
lhybrideur
Posts: 379
Joined: July 9th, 2019, 1:46 pm

Re: heals event?

Post by lhybrideur »

Healing experience exists in some mods, such as Hyperactive Novice Healers.
You could check them to see how it is implemented.
User avatar
Ravana
Forum Moderator
Posts: 3076
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: heals event?

Post by Ravana »

white_haired_uncle
Posts: 1310
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: heals event?

Post by white_haired_uncle »

Thank you both.
Doesn't that have the double healing issue? Looks to me like if you have a normal healer next to an injured unit and a sacrificial healer of the same side as the healer also next to that unit, said unit will be healed twice (8+12), once by the built-in healing that occurs before turn refresh and then once by turn refresh. I'm hoping to exploit the built-in behaviour where only one healer per side will heal a specific unit on any given turn.
Speak softly, and carry Doombringer.
User avatar
Ravana
Forum Moderator
Posts: 3076
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: heals event?

Post by Ravana »

There is no custom healing. Event only reduces hp.
white_haired_uncle
Posts: 1310
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: heals event?

Post by white_haired_uncle »

Okay, I see that now. But I still think it has basically the same problem. How do we know that THIS unit performed healing? We know it has the ability and it's next to one or more units that it could have healed but we don't know that this unit actually performed any healing.

I think there's a "need" for a heals event, assuming there's not already one I'm missing, I'm just trying to prove it to myself.
Speak softly, and carry Doombringer.
User avatar
Ravana
Forum Moderator
Posts: 3076
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: heals event?

Post by Ravana »

When iterating sacrificial_units then for each feeding_units exclude duplicate sacrificial_units-feeding_units pairs.
white_haired_uncle
Posts: 1310
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: heals event?

Post by white_haired_uncle »

So I looked into implementing this, and I think I get why it doesn't exist. There really is no "one" healer.

Basically, each unit is considered for healing being healed). Leaving aside poison/cure for the moment, everything (village/tile, self, other units) that could "heal" this unit, both positive and negative, is considered, with the largest positive and largest negative contributions selected and added to each other and the unit is "healed" by the sum. So you could have patient P healed -6 by unit U1 and +13 by unit U2. How would you call a heals event? Would you call it twice (I think so), once for each "healer", or once for only U2/+7?

Actually, I think I could make a case for both, so the "correct" behaviour would probably be to call [heal] with unit=patient, second_unit=max_healer, third_unit=max_harmer, heal_amount=13, harm_amount=6 and let the UMC author decide what to do with all that. And I suppose you even do this when heal_amount = harm_amount, even though there's no actual effect on the patient, as the author may want to use the information about what "could have happened". Maybe. Or not.

But even with all that figured out, and assuming you also deal with cure/poison, the healer/harmer would still simply be chosen as the first unit doing the most harm/help, which really isn't very realistic. So in the end, you almost might as well just leave it to the UMC author to take a look at the battlefield, assess the possibilities of what might have happened, and take the choice that makes the most sense to them.
Speak softly, and carry Doombringer.
Post Reply