Posting this once again for feedback.
1) I have no way to test it (No lock)
2) is the logic correct?
This is a slightly edited version of what Bu came up with for me. (Thanks Bu!)
Symbiosis - Warlock > Feral - Soul Swap
PHP Code:
local unit1 = UnitExists("target")
local unit2 = UnitExists("focus")
local EnemyHP = 100 * UnitHealth("target") / UnitHealthMax("target")
if unit1 and unit2 then
-- If the current target has rake or rip we do nothing.
if (UnitDebuffID("target",1822) or UnitDebuffID("target",1079)) then
return false
elseif UnitBuffID("player", SSBUFFID) then
CastSpellByName(GetSpellInfo(SS), "target")
return true
end
-- If the current focus has rake or rip, health check on target, check debuff on focus, check cd on Soul Swap,
-- check that current target is not focus target, then cast SS and set target to new focus
if EnemyHP > 20
and (UnitDebuffID("focus",1822)
or UnitDebuffID("focus",1079))
and GetSpellCooldown(110810) == 0 and unit1 then -- **checking that current target is NOT focus**
CastSpellByName(GetSpellInfo(110810), "target") -- Changed this to target as your checking focus for debuff to SS to target
FocusUnit("target")
return true
end
end
Thanks much!
-GB