-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathshared_filters.lua
More file actions
26 lines (21 loc) · 843 Bytes
/
shared_filters.lua
File metadata and controls
26 lines (21 loc) · 843 Bytes
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
-- Created by romain-p
-- see updates on http://github.com/romain-p
if not shared_filters then
shared_filters = true
-- Return true if a given unit health is under a given percent
function HealthIsUnder(unit, percent)
return (((100 * UnitHealth(unit) / UnitHealthMax(unit))) < percent)
end
-- Return true if the whole units have health > x
function HealthNotUnder(units, percent)
for _, unit in ipairs(units) do
if UnitExists(unit) and HealthIsUnder(unit, percent) then
return false
end
end
return true
end
-- Check if the whole party members have their life upper 40%
filter_party_health = function() HealthNotUnder(Party, 40) end
filter_party_health_60 = function() HealthNotUnder(Party, 60) end
end