projecteq-projecteqquests/lua_modules/mob_ext.lua
2017-04-10 17:36:01 -04:00

30 lines
824 B
Lua

function Mob:ForeachHateList(func, cond)
cond = cond or function(ent, hate, damage, frenzy) return true end;
local lst = self:GetHateList();
for ent in lst.entries do
local cv = cond(ent.ent, ent.hate, ent.damage, ent.frenzy);
if(cv) then
func(ent.ent, ent.hate, ent.damage, ent.frenzy);
end
end
end
function Mob:CountHateList(cond)
cond = cond or function(ent, hate, damage, frenzy) return true end;
local lst = self:GetHateList();
local ret = 0;
for ent in lst.entries do
local cv = cond(ent.ent, ent.hate, ent.damage, ent.frenzy);
if(cv) then
ret = ret + 1;
end
end
return ret;
end
function Mob:CastedSpellFinished(spell_id, target) -- note, we do have a server side function (not exported) called this too ...
self:SendBeginCast(spell_id, 0);
self:SpellFinished(spell_id, target);
end