Temporary HP buff implementation options
Temporarily adding extra HP to a unit can lead to weird interactions once the buff expires. What are some options this can be implemented and what gameplay do they lead to?
Temporary HP buff implementation options
In (RTS) games, game pieces (units, buildings, etc.) usually have a concept of health points that determines how much damage they can take before being destroyed. Each piece would have a current health value (HP) and a maximum health value (maxHP). When a piece takes damage, its HP is reduced and when HP reaches zero, the piece is destroyed.
To make the game more complex, there might be abilities or interactions that change the HP or maxHP of a piece. One of such interaction might be a temporary HP buff that adds extra HP to a piece for a limited time. This leads to an interesting problem - how much HP should the piece have after the buff expires?
Example scenario
Let's consider a simple example.
- Kat has 50/50 (HP/maxHP) and uses an ability to temporary increase maxHP by 50.
- Kat has 100/100 HP now (arguably the usual way to implement this).
- Kat takes 25 damage and now has 75/100 HP.
- The buff expires and Kat's maxHP is back to 50. What should Kat's HP be now?

Implementation options
Option 1: Keep the current HP
The first, rather straightforward option, is to keep the current HP when the buff expires (capped at the new maxHP). In the example, Kat would end up with 50/50.
This option is simple to implement and understand. It also makes the buff more impactful as it effectively heals the unit, if it takes less damage than the amount of HP the buff provides. Visually, it could be interpreted as the extra HP being used as a shield or buffer that absorbs up to 50 points of damage.

In game, this ability would be ideally used at the start of a fight so the temporary HP can absorb as much damage as possible while keeping the original HP intact.
Option 2: Remove the extra HP
The second option is to remove the same amount of HP that was given by the buff when it expires. In the example, Kat would end up with 25/50.
This might be a bit weird for the players as they would see a drop in HP when the buff expires (both absolute value and percentage-wise). If the game uses HP bars, it would be especially noticeable. Another quirk is that if the unit had less HP then the amount of the buff, it would be technically with negative HP. Depending on further implementation, this might trigger a sudden death of the unit, or leave it in a state where any additional damage would kill it.
Visually, this could be seen as the damage being implied to the original HP capacity and the buffed HP being there just to keep the unit alive for longer.

Gameplay-wise, such ability would be most effective when used just before the unit is about to die. This way most of the damage would go into the temporary HP and the unit would survive longer. Player would need to keep track of the duration of the buff and pull the unit back before it expires to prevent the easy kill when the unit ends up at 0 HP.
Option 3: Keep the percentage of HP
The third option is to keep the ratio of HP to maxHP the same after the buff expires. In the example, Kat would end up with 37.5/50.
This option is a compromise between the previous two. It keeps the HP drop when the buff expires, but it's not as drastic as in the second option. If the game uses HP bars that has constant width, the drop in HP would not be noticeable, since the percentage would stay the same.
This approach can be visualized as the damage being split (in the proportion of original maxHP : buff HP) into the original HP and the temporary HP.

With this implementation, the best time to use the ability would be when the unit is expected to receive a burst damage or when receiving fire from multiple units.
Conclusion
The choice of how to handle temporary HP buffs can have a significant impact on the gameplay and it should be considered when designing units and their abilities.
In Stormgate in particular, the implementation of Archangel's Avatar in 0.0.2 is really messy as the ability combines two components - a temporary HP buff and attack characteristics change. The HP buff uses the Option 2 which makes it ideal for last second saves, but the attack buff makes the ability more useful when used at the start of the fight. In the end, the ability feels bad to use since you lose on efficiency one way or another.