Chapter 14: Page 276 - 'CombatTracker_OnEvent'
In this code section there is a minor typo and a logic error in the handling of the UNIT_COMBAT
event. In that code block we want to check the value of end_time - start_time
to ensure we don't divide by 0 in the next line. The code should read as follows:
total_time = math.max(end_time - start_time, 1)
This ensures that total_time
will be whichever value is greater, the amount of time that has passed, or 1.