Originally Posted by flaicher
EDIT: (petclass == ("Wrathguard" or "Felguard")) fixed the problem
|
Actually, this doesn't work the way you think it does. The original line evaluated
petclass == "Wrathguard" first and if that was
false, it evaluated
"Felguard", which anything that isn't strictly
nil or
false evaluates to
true. This eventually made the condition to always evaluate to
true no matter what happened.
Your edit evaluates
"Wrathguard" or "Felguard" first because of the parenthesis. Both are true conditions, but because of how
or operates, it returns the first operand if it's a true condition. This makes the line always try to evaluate
petclass == "Wrathguard". Which isn't covering the Felguard condition.
To have the condition return correctly, you need to make the change highlighted below.
Code:
function()
local _, autocast = GetSpellAutocast(134477)
local petclass = UnitCreatureFamily("pet")
if (not autocast) and (petclass == "Felguard" or petclass == "Wrathguard") then
return true
end
end