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

#### Bluetime

Level 2
Hello Guys,
How to do amplifying health/mana regeneration based on current health/mana regeneration points by hardcoded or by GUI method?
Thanks

e.g.
10 health regeneration x 20% regeneration amplification = 12 health regeneration

#### Dr Super Good

Spell Reviewer
Level 60
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.

#### Bluetime

Level 2
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

#### Dr Super Good

Spell Reviewer
Level 60
I already get the algorithm on how to amplify health/mana regeneration

Something like this:
Problem is that does not factor in damage dealt during that interval. One would likely need a damage detection system to apply measurement corrections when possible.

#### Bluetime

Level 2
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

#### axleion

Level 9
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.

#### Bluetime

Level 2
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

Replies
22
Views
1K
Replies
17
Views
1K
Replies
2
Views
488
[General] Creating New Stats
Replies
1
Views
230
Replies
20
Views
1K