[Spell] Health/Mana Regeneration Amplification based on current Health/Mana Regeneration Point

Dr Super Good

Spell Reviewer
Level 60
Joined
Jan 18, 2005
Messages
26,837
One needs to write a system to track how much health regeneration a unit has. One can then apply a modifier, which is not tracked by that system, to it possibly done by a periodic trigger.

If your map uses a predictable scaling system like the sort used in Heroes of the Storm, it should be fairly easy to compute the current health/mana regen rate from the scaling formula and then apply a periodic current health/mana adjustment to apply the extra regeneration.
 
Level 2
Joined
Jun 12, 2012
Messages
14
I already get the algorithm on how to amplify health/mana regeneration

Something like this:

Detecting Regeneration Value of Unit
Create a loop for 0.1 sec that checks the regeneration value of unit then

hp_diff = hp_curr - hp_prev
hp_prev = hp_curr

where:
  • hp_curr = the current health/mana of unit
  • hp_prev = the previous health/mana of unit
  • hp_diff = the difference between hp_curr and hp_prev that detects the regeneration value of health/mana of unit

Amplifying Regeneration Value of Unit
Create a loop for 0.1 sec that checks and amplifies the regeneration value of unit then

hp_amp = 0.30 // 30% regeneration factor
hp_diff = hp_curr - hp_prev
hp_curr = hp_curr + (hp_diff * hp_amp) // amplifies 30% regeneration value
hp_prev = hp_curr

where:
  • hp_curr = the current health/mana of unit
  • hp_prev = the previous health/mana of unit
  • hp_diff = the difference between hp_curr and hp_prev that detects the regeneration value of health/mana of unit
  • hp_amp = regeneration factor
 
Level 2
Joined
Jun 12, 2012
Messages
14
Adding line to check if difference between current and previous health/mana
if hp_prev > 0

Amplifying Regeneration Value of Unit
Create a loop for 0.1 sec that checks and amplifies the regeneration value of unit then
hp_amp = 0.30 // 30% regeneration factor
hp_diff = hp_curr - hp_prev
if hp_prev > 0 // checks the difference between current and previous health/mana

hp_curr = hp_curr + (hp_diff * hp_amp) // amplifies 30% regeneration value
hp_prev = hp_curr
where:
  • hp_curr = the current health/mana of unit
  • hp_prev = the previous health/mana of unit
  • hp_diff = the difference between hp_curr and hp_prev that detects the regeneration value of health/mana of unit
  • hp_amp = regeneration factor
 
Level 9
Joined
Dec 12, 2007
Messages
489
Adding line to check if difference between current and previous health/mana
if hp_prev > 0

Amplifying Regeneration Value of Unit
Create a loop for 0.1 sec that checks and amplifies the regeneration value of unit then
hp_amp = 0.30 // 30% regeneration factor
hp_diff = hp_curr - hp_prev
if hp_prev > 0 // checks the difference between current and previous health/mana

hp_curr = hp_curr + (hp_diff * hp_amp) // amplifies 30% regeneration value
hp_prev = hp_curr
where:
  • hp_curr = the current health/mana of unit
  • hp_prev = the previous health/mana of unit
  • hp_diff = the difference between hp_curr and hp_prev that detects the regeneration value of health/mana of unit
  • hp_amp = regeneration factor

you might mean
if hp_diff > 0 // checks the difference between current and previous health/mana
but what about instant heal? or enhanced regen through ability effect? consider Unholy Aura, Rejuvenation, or Holy Light in effect. you are checking change of hitpoint that can happen because of a lot of reasons.

then you will have to deal with what DSG said earlier
One can then apply a modifier, which is not tracked by that system, to it possibly done by a periodic trigger.

as simply amplifying heal like that will stack with itself on next iteration.
 
Level 2
Joined
Jun 12, 2012
Messages
14
Thanks for the correction Dark_Axl

Instant heal/enhanced regeneration is included to my regeneration amplification mechanic
like for example:

Normal Regeneration:
3 health per second

Regeneration with Amplification:
3 health per second + (3 health per second * 0.30)
3 health per second + 0.9 health per second = 3.9 total health

-----------------------------------------------------------------------------------
When allied unit cast instant healing spell to target unit that grants 200 health.

Regeneration when affected by Instant Healing Spell
3 health per second + 200 health = 203 total health

Regeneration with Amplification when affected by Instant Healing Spell
3 health per second + 200 health = 203 total health
203 total health + (203 total health * 0.30)
203 total health + 60.9 total health = 263.9 total health


Therefore amplification takes place after getting the difference between current and previous health
 
Top