Log crossbow heals + Fix wrong heal on damage #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
shock mentioned to me that TFTrue doesn't seem to be logging crossbow heals, and it was also reported in issue #57.
It turns out that the player_healed event does log crossbow heals, but we don't handle this event when tftrue_logs_includebuffs is enabled. In that case, we need to use the crossbow_heal event. I tested that it works in various scenarios. Assume that the arrow can do 100 hp healing, and that we are healing a soldier:
Additionally, I stumbled upon a different problem: The player_healonhit event is triggered for the patient when they are healed by an arrow. This is a problem because we store the heal value in m_uiLastHealOnHit, and log it the next time they do damage, as if they were responsible for healing themselves (like when using the Black Box).
However, according to my tests, the crossbow_heal event is fired after the player_healonhit event, so we can simply overwrite that value with 0, preventing it from being logged at the next damage event.
Note that this bug is present regardless of tftrue_logs_includebuffs, so we have to always overwrite it.