Repository navigation
Expand file tree
/
Copy pathdoubleTargeted.lua
More file actions
54 lines (46 loc) · 1.55 KB
/
Copy pathdoubleTargeted.lua
File metadata and controls
54 lines (46 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-- TSU: TRIGGER:1
function(allstates, event, ...)
if event ~= "TRIGGER" then
return false
end
local _, triggerStates = ...
local targets = {} -- unit GUIDs to number of tracked casts at them
local state = { ["numSpellsTargetedBy"] = 0 }
for _, triggerState in pairs(triggerStates) do
local destUnit = triggerState["destUnit"]
if destUnit ~= nil and UnitGroupRolesAssigned(destUnit) ~= "TANK" then
local destUnitGuid = UnitGUID(destUnit)
if destUnitGuid ~= nil then
targets[destUnitGuid] = (targets[destUnitGuid] or 0) + 1
if targets[destUnitGuid] > state["numSpellsTargetedBy"] then
state["numSpellsTargetedBy"] = targets[destUnitGuid]
state["unit"] = destUnit
state["icon"] = triggerState["icon"]
state["name"] = triggerState["spell"]
state["spellId"] = triggerState["spellId"]
end
end
end
end
if state["numSpellsTargetedBy"] >= 2 then
allstates[""] = state
state["stacks"] = state["numSpellsTargetedBy"]
state["show"] = true
state["changed"] = true
return true
else
local state = allstates[""]
if state == nil then
return false
end
state["show"] = false
state["changed"] = true
return true
end
end
-- custom variables
{
["stacks"] = true,
["numSpellsTargetedBy"] = "number",
["spellId"] = "number",
}