private Mobile GetFocus(IPoint3D p, int range) { IPooledEnumerable eable = m_Creature.Map.GetMobilesInRange(new Point3D(p), range); Mobile focus = null; int dist = range; foreach (Mobile m in eable) { if (m_Creature.CanSee(m) && m_Creature.InLOS(m) && (m is DespiseCreature || m is DespiseBoss)) { DespiseCreature dc = m as DespiseCreature; if (m is DespiseBoss || dc.Orb == null && !dc.Controlled || dc.Alignment != m_Creature.Alignment) { int distance = (int)m_Creature.GetDistanceToSqrt(m); if (focus == null || distance < dist) { focus = m; dist = distance; } } } } eable.Free(); return(focus); }
private Mobile GetFocus(IPoint3D p, int range) { IPooledEnumerable eable = m_Creature.Map.GetMobilesInRange(new Point3D(p), range); Mobile focus = null; int dist = range; foreach (Mobile m in eable) { if (m is DespiseCreature) { DespiseCreature dc = m as DespiseCreature; if (dc.Orb == null && !dc.Controlled && dc.Alignment != Alignment.Neutral && dc.Alignment != m_Creature.Alignment) { int distance = (int)m_Creature.GetDistanceToSqrt(dc); if (focus == null || distance < dist) { focus = dc; dist = distance; } } } else if (m is DespiseBoss) { focus = m; break; } } eable.Free(); return(focus); }
public bool IsFollowing() { return((int)m_Pet.GetDistanceToSqrt(GetAnchorLocation()) > m_Pet.GetLeashLength() + 1 && m_Pet.ControlOrder == OrderType.Follow); }