Hey lua gods,
this ability works but creates an tainted code error with raidframe bla bla bla (i think you know what i mean). As you can see below i try some things to locate the source of evil ;P
It should go through my team - if a member (not me) has an enemy target -> cast Mindbender on it. Everytime executed this code creates a little error but works as intended. Can you help me?
Code:
if ( isSpellReady(123040) or isSpellReady(34433) ) and not BenButtonPushed then
local maxPower = UnitPowerMax("player")
if maxPower == 0 then
maxPower = 300000
end
local PlayerMana3 = 100 * ( UnitPower("player") / UnitPowerMax("player") )
if PlayerMana3 == nil then
PlayerMana3 = 100
end
-- use mindbender on cooldown on any enemy that has no cc on it that breaks
for i=1, #benMembers do
if UnitExists(benMembers[i].Unit.."target") == 1 then
local customTarget = benMembers[i].Unit.."target"
if customTarget ~= nil and not UnitIsUnit("player", benMembers[i].Unit) then
if UnitCanAttack("player",customTarget) == 1
and not UnitAffectedByAura(customTarget, "debuff_cc_dmg_break", 0.5, true)
and IsLineOfSight(customTarget, 2)
and PQR_UnitDistance("player",customTarget) < 40
and PlayerMana3 < 83 then
if benBenderTalent then
if PQR_SpellAvailable(123040) then
--PQR_DebugP("Mind Bender -> "..UnitName(customTarget))
CastSpellByName(GetSpellInfo(123040),customTarget)
return true
end
else
-- shadowfiend
if PQR_SpellAvailable(34433) then
PQR_DebugP("Shadow Fiend -> "..UnitName(customTarget))
CastSpellByName(GetSpellInfo(34433),customTarget)
return true
end
end
end
end
end
end
end