Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function xShieldSaves()
- if GetRaidRosterInfo(1) then
- for i=1,GetNumRaidMembers() do
- if healthPct("raid"..i) < .25 and xUnitInRange("raid"..i) and not buffed("Weakened Soul", "raid"..i) and IsAlive("raid"..i) then
- TargetUnit("raid"..i);
- CastSpellByName("Power Word: Shield")
- TargetLastTarget();
- local shieldname = UnitName("raid"..i)
- RunLine("/raid i put PWS on "..shieldname)
- return
- end
- end
- elseif GetNumPartyMembers() > 0 then
- for i=1,GetNumPartyMembers() do
- if (healthPct("party"..i) < 0.25) and not buffed("Weakened Soul", "party"..i) then
- TargetUnit("party"..i);
- CastSpellByName("Power Word: Shield")
- TargetLastTarget();
- local shieldname = UnitName("party"..i)
- RunLine("/raid i put PWS on "..shieldname)
- return
- end
- end
- end
- end
- --you call it with this:
- --[[--
- if not ImBusy() and spellReady("Power Word: Shield") and InCombat() then
- if (Shield_wait == nil or GetTime()-Shield_wait > 2.5) then
- Shield_wait = GetTime();
- xShieldSaves()
- end
- end
- --]]--
- --you prolly have the functions below already.
- function xUnitInRange(Unit)
- if CheckInteractDistance(Unit, 4) then
- return true;
- end
- return nil;
- end
- function healthPct(unit)
- local unit = unit or "player"
- return UnitHealth(unit) / UnitHealthMax(unit)
- end
- function IsAlive(id)
- if not id then return end
- if UnitName(id) and (not UnitIsDead(id) and UnitHealth(id)>1 and not UnitIsGhost(id) and UnitIsConnected(id)) then return true end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement