schlosrat / token-health

FoundryVTT module
5 stars 10 forks source link

fix for systems without temp hp #25

Closed ghost91- closed 3 years ago

ghost91- commented 3 years ago

Without this fix, the module does not work correctly when used with a system without temp hp. Whenever you would deduct hp from a token, the hit points are actually set to null. This is due to the fact that when there are no tempHP, the function getNewHP gets undefined as the corresponding parameter and tries to calculate Number(undefined), which is NaN. Then everything else based on this value also becomes NaN.

With this PR, there is a (correct) check if tempHP is null or undefined to circumvent this problem.

Additionally this adds corresponding test cases.

ghost91- commented 3 years ago

Hey @tonifisler are you still maintaining this module?

tonifisler commented 3 years ago

Hey @ghost91-! I am really sorry for the wait, I have a lot of other things on my mind with work these last months and haven't had the time to maintain the module. I will try to transfer it to the League so that it continues living!

schlosrat commented 3 years ago

Hi ghost91. I've taken over maintenance and development of this module from tonifisler. I believe the issue you've fixed is one I've also fixed. Please try the latest release (0.3.0) and see if that's working for you now. There are many other new features you may enjoy in the new versions too!