mirror of
https://github.com/EQMacEmu/quests
synced 2026-08-21 00:23:04 -04:00
25 lines
616 B
Lua
25 lines
616 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
|