Core/AI: Added new method for search friendly targets with certain entry and hp pct below a value

This commit is contained in:
hondacrx
2018-03-11 14:47:19 -04:00
parent 0775ef9c97
commit 5e571794bf
3 changed files with 36 additions and 47 deletions
+27
View File
@@ -1392,6 +1392,33 @@ namespace Game.Maps
ulong i_hp;
}
public class FriendlyBelowHpPctEntryInRange : ICheck<Unit>
{
public FriendlyBelowHpPctEntryInRange(Unit obj, uint entry, float range, byte pct, bool excludeSelf)
{
i_obj = obj;
i_entry = entry;
i_range = range;
i_pct = pct;
i_excludeSelf = excludeSelf;
}
public bool Invoke(Unit u)
{
if (i_excludeSelf && i_obj.GetGUID() == u.GetGUID())
return false;
if (u.GetEntry() == i_entry && u.IsAlive() && u.IsInCombat() && !i_obj.IsHostileTo(u) && i_obj.IsWithinDistInMap(u, i_range) && u.HealthBelowPct(i_pct))
return true;
return false;
}
Unit i_obj;
uint i_entry;
float i_range;
byte i_pct;
bool i_excludeSelf;
}
public class FriendlyCCedInRange : ICheck<Creature>
{
public FriendlyCCedInRange(Unit obj, float range)