Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make monster::heal actually return amount healed (#51183)
* Make monster::heal actually return amount healed It is assumed in multiple places, and stated in monster.h, that the monster::heal function returns the amount healed. Now it actually does. This came about via #17452, which was to prevent heal from returning a negative number; I see no way that it now can, but just in case I have put in a std::max( 0, hp - old_hp ). * Make recovering speed in on_load more sensible. As suggested by @eltank (not sure how to get github to properly credit them, and would like to know), make the healing/recovering of speed in monster::on_load() proportional to the monster's current hp, so that a fully healed monster also fully heals speed. Admittedly, it is rather weird that healing speed doesn't seem to take place elsewhere, as in while in the reality bubble. * Follow @eltank's advice re not being paranoid There really shouldn't be any way that it'll return negative now, and it would probably be better to have some chance of realizing this (via the negative return) if it did. * Round up proportional healing of speed; typo fix This probably doesn't matter, but make sure there's at least a bit of healing of speed each time. Also fix one typo (`type-> speed`). * Apply suggestions from code review Float/int conversions strike again! Co-authored-by: eltank <8000047+eltank@users.noreply.github.com> * Fix error (likely from Github). Applying a change suggested by @eltank on Github does not appear to have gone correctly. Fixing. Co-authored-by: actual-nh <actual-nh@users.noreply.github.com> Co-authored-by: eltank <8000047+eltank@users.noreply.github.com>
- Loading branch information