I don't know if this has already been addressed, but if it has-- I missed it. There seems to be a problem with some of my LUA scripted mobs.. more specifically debuff spells that they cast. When my Mob casts a debuff, he tends to cast it on himself. This still happens regardless of what targeting function I am using.
For example:
function Mob_CleaveArmor(Unit, Event)
Unit:CastSpellOnTarget(34643, Unit:GetClosestPlayer())
end
This is the function that I am registering in one of my phases. Yet, when I enter the game to test my Mob, he merely casts this debuff on himself. I am not sure if this is an issue with the spell itself, or simply the function. I am led to believe, however, that it is a problem with the scripting. This is because when I taught the spell to my ingame character and cast it on a target, it worked flawlessly. It might also be worth mentioning that I am testing these Mobs on a single character, not a group. This error also occurs with some attacking moves, such as "Ice Claw".
TL;DR:
Mob casts damaging spells and debuffs on himself instead of designated target.. I'm wondering why-- and if there is a fix.