Add support for temporary changes to max hp
mpirnat opened this issue · 1 comments
Confusingly, spells like Aid https://www.dndbeyond.com/spells/aid don't add temporary hit points but instead temporarily up the hit point max and add actual, non-temporary hit points. A specter's Life Drain attack can temporarily reduce the hit point max. We need to support this too (since both of these just happened in game!).
We should add a temp_max_hp
attribute (or maybe max_hp_bonus
?) to combatants.
If we choose to track the hp delta, then this attribute can default to 0, with a minimum of 0. The max_hp
getter should return the sum of _max_hp
and temp_max_hp
. This will allow setting cur_hp
above the usual _max_hp
and instead up to the new limit.
If we choose instead to track the absolute override of max_hp, then this attribute should default to None. The max_hp
getter should instead return the temp_max_hp
value. This more easily accounts for reductions in max_hp so might be the way to go. Like the above approach, using the getter to do this allows the cur_hp
setter to Just Work™ as it has.
The temp_max_hp
should be emitted into the toml when saving player state, and should be reloaded when loading the party.
At the point where #71 is implemented, a long rest should optionally return the temp_max_hp
to 0 (or None) -- perhaps with a prompt for any characters where there's an override set.
We can optionally add a temp_max_hp
command to set the temp_max_hp
on a combatant, or we can lean on the existing alter
command which would already be able to do alter <combatant> temp_max_hp <value>
.
Decisions made to make life easy:
- Yeah, we're just setting an override of the
max_hp
. This hews closer to the game mechanics anyway. - I didn't add a command for setting/removing the
max_hp_override
, so for now this can be done using thealter
command. It can be removed by doingalter <combatant> max_hp_override None
. - If the value given to the
alter
command is"None"
, we turn that into a PythonNone
rather than the string. Sorry to anyone who wanted to doalter <combatant> name None
!