I meant only https://github.com/TrinityCore/TrinityCore/blob/4.3.4/src/server/game/AI/CoreAI/UnitAI.cpp#L128 - do not use this one.

https://github.com/TrinityCore/TrinityCore/blob/20004050bcd9396f504e3e33138b734d96de5238/src/server/game/AI/CoreAI/UnitAI.cpp#L178 is good (as are DoCastVictim/DoCastAOE)