View Single Post
03-11-20, 05:23 AM   #1
FranekW
A Cyclonian
 
FranekW's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 44
Tracking debuffs on multiple units affected by AoE spells

Hello,

What would be the best way to track multiple targets affected by multiple AoE spells?

Each AoE spell applies the same debuff to all units within the area of effect e.g. Druid Feral's Thrash is a multitarget spell which doesn't need a valid single target but applies DoTs to all non-friendly units including invisible units. Similarly, Primal Wrath does the same with a different debuff.

I made a simple function with Thrash. It is logged by CLEU using subevents such as "SPELL_DAMAGE", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED", etc. I tried the following code:

Lua Code:
  1. -- spellID, sourceGUID etc. comes from CLEU
  2.  
  3. if sourceGUID ~= UnitGUID("player") then return end
  4.  
  5. -- Thrash spellID: 106830
  6. if subevent == "SPELL_CAST_SUCCESS" and spellID == 106830 then
  7.     local spellName = GetSpellInfo(spellID)
  8.     for i = 1,40 do
  9.         local unit = "nameplate"..i
  10.         if UnitExists(unit)
  11.                 and not UnitIsFriend("player", unit)
  12.                 and IsSpellInRange(spellName, unit) then
  13.             tinsert(auratable.targets, UnitGUID(unit))
  14.         end
  15.     end
  16.     ViragDevTool_AddData(auratable.targets, "Encounter"..encounter)
  17.     auratable.encounter = auratable.encounter + 1
  18. end

but the table auratable.targets is empty after each combat session.

I thought about catching the "UNIT_AURA" event and if a nameplate gains a debuff but having to test 40 units and checking 40 indices of possible debuff per unit each time I apply one of the AoE spells seems like a lot of loops to do.

Last edited by FranekW : 03-12-20 at 05:39 AM.
  Reply With Quote