Average damage taken within time period
Hello,
I am trying to calculate an average damage taken within last 5 secs. The reason for that is I have a Blood DK. The new Death Strike ability can heal me by 20% of amount of damage taken within last 5 secs. That's what it says. So I would like to do an extra progress bar in Weak Aura 2. Right after I start combat, the bar should start progressing from 0% to 100% and would have text stating an approximation of amount of healing calculated from average damage taken. After using Death Strike, I would like the progress bar to get empty and begin to fill up (like progress bar) up to 100% within 5 secs when Death Strike has been used. Also, if I use DS withing the period of 5 secs, the bar should get empty and start progressing again. The main problem I have is I don't know which event I should look for. Is it COPMBAT_LOG_UNFILTERED or anything that triggers when my health bar is reduced? |
UNIT_HEALTH http://wowprogramming.com/docs/events/UNIT_HEALTH
(or UNIT_HEALTH_FREQUENT) Also, what would the 100% be of? |
Quote:
It's just a thing with a progress bar which would increase from 0% (Ds is used) to 100% (5 secs passed). 100 % would mean I would potentially benefit from Death Strike in maximal way. Also, I'd prefer progress bars from icons. |
I don't think Death Strike cuts you off from healing already given. If you DS 2 seconds after a DS, both will still give healing based on the 5 seconds of previous damage, even if you were already healed based on the overlapping 3 seconds.
|
I'm also pretty sure (I don't play a DK, but the tooltip wording seems pretty clear, especially considering how other abilities with similar wording work or have worked) that it's a sliding 5-second window. It doesn't reset to zero every 5 seconds. It just keeps a rolling record of all the damage you take, so that at any given moment, it can calculate how much damage you took between "now" and "5 seconds before now".
That said, UNIT_HEALTH isn't what you want here, because not every health change -- not even every health reduction -- is due to taking damage. You'd need to watch COMBAT_LOG_EVENT_UNFILTERED for all the damage sub-events: SWING_DAMAGE (melee auto attacks), RANGE_DAMAGE (ranged auto attacks), SPELL_DAMAGE (non-dot spells), SPELL_PERIODIC_DAMAGE (dots), and ENVIRONMENTAL_DAMAGE (falling, lava, etc) if that counts. In all of those cases, the target's GUID is arg8 (match it against the player's GUID to detect damage you took) and the amount of damage taken is arg15. Not tested at all, and not related to WeakAuras, but may give you an idea of what kind of code is needed: lua Code:
Then at any given moment the amount of healing you'll get from Heart Strike can be calculated as: lua Code:
|
Thanks very much for the responses. I also appreciate the example code. It will definitely help me to kick off. Thanks
PS. I wasn't sure about Death Strike. I considered that it would be a moving 5 secs window but I was not sure about it. Thanks. |
All times are GMT -6. The time now is 05:10 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI