-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathambrain.lua
49 lines (37 loc) · 1 KB
/
ambrain.lua
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
-- init
aura_env.buffs = {
-- A map from spell ID to a numerical weight of how good the buff is. A
-- higher weight indicates a better buff.
[193356] = 3, -- Broadside
[193357] = 2, -- Ruthless Precision
[193358] = 1, -- Grand Melee
[193359] = 3, -- True Bearing
[199600] = 1, -- Buried Treasure
[199603] = 2 -- Skull and Crossbones
}
-- The minimum sum at which it's okay not to reroll.
aura_env.buffSumThreshold = 3
-- trigger: UNIT_AURA:player
function()
local sum = 0
for i=1,40 do
local spellId = select(10, UnitAura("player", i, "PLAYER|HELPFUL"))
if spellId == nil then
break
end
local weight = aura_env.buffs[spellId]
if weight ~= nil then
sum = sum + weight
if sum >= aura_env.buffSumThreshold then
-- Don't reroll.
return false
end
end
end
-- Reroll.
return true
end
-- untrigger
function()
return true
end