public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; IPooledEnumerable eable = focus.GetMobilesInRange(8); foreach (Mobile m in eable) { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } eable.Free(); if (useGuard != null) { useGuard.Focus = focus; } else { m_GuardParams[0] = focus; Activator.CreateInstance(m_GuardType, m_GuardParams); } }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; foreach (Mobile m in focus.GetMobilesInRange(8)) { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } if (useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(m_GuardType, m_GuardParams); } catch {} } else { useGuard.Focus = focus; } }
public bool IsGuardCandidate(Mobile m) { if (m is BaseGuard || m is PlayerVendor || !m.Alive || m.AccessLevel > AccessLevel.Player || m.Blessed || !IsGuarded) { return(false); } IPooledEnumerable eable = m.GetMobilesInRange(10); foreach (Mobile check in eable) { BaseGuard guard = check as BaseGuard; if (guard != null && guard.Focus == m) { eable.Free(); return(false); } } eable.Free(); // add your 'reds in town' shards here: bool reds_in_town = Core.UOSP || Core.UOMO; return((reds_in_town ? false : m.Murderer) || m.Criminal); }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; Guilds.GuildType virtue = GetVirtueOwner(); Type guardType; if (focus is BaseGuard) { return; } GuardedRegion reg = (GuardedRegion)focus.Region.GetRegion(typeof(GuardedRegion)); if (reg != null) { switch (virtue) { case Server.Guilds.GuildType.Chaos: guardType = typeof(ChaosGuard); break; case Server.Guilds.GuildType.Order: guardType = typeof(OrderGuard); break; default: guardType = m_GuardType; break; } foreach (Mobile m in focus.GetMobilesInRange(8)) { if (m.GetType() == guardType && m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } if (useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(guardType, m_GuardParams); } catch { } } else { useGuard.Focus = focus; } } }
public override void _Ready() { follow = (PathFollow2D)FindNode("Follow"); baseGuard = (BaseGuard)FindNode("BaseGuard"); tween = (Tween)baseGuard.GetNode("Tween"); Events.levelFailed += OnLevelFailed; ForwardTween(); }
public override void MakeGuard(Mobile focus) { if (focus != null && !(focus.Region is GuardedRegion)) { return; } BaseGuard useGuard = null; bool alreadyAssigned = false; foreach (Mobile m in focus.GetMobilesInRange(12)) //Range preception { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } else if (g.Focus == focus) { alreadyAssigned = true; } } } if (!alreadyAssigned && useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(m_GuardType, m_GuardParams); } catch {} } else if (useGuard != null) { useGuard.Focus = focus; } if (focus.Hidden) { focus.RevealingAction(); focus.SendLocalizedMessage(500814); // You have been revealed! } }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; foreach (Mobile m in focus.GetMobilesInRange(10)) { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } if (useGuard == null) { Faction faction = null; Region region = focus.Region; if (region != null) { Town town = Town.FromRegion(region); if (town != null) { faction = town.Owner; } } try { Activator.CreateInstance(m_GuardType, new object[] { focus, faction }); } catch (Exception e) { Console.WriteLine(e.ToString()); } } else { useGuard.Focus = focus; } }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; IPooledEnumerable eable = focus.GetMobilesInRange(8); foreach (Mobile m in eable) { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } eable.Free(); if (useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(m_GuardType, m_GuardParams); } catch (Exception e) { Diagnostics.ExceptionLogging.LogException(e); } } else { useGuard.Focus = focus; } }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; IPooledEnumerable eable = focus.GetMobilesInRange(8); foreach (Mobile m in eable) { if (m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } eable.Free(); if (useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(m_GuardType, m_GuardParams); } catch (Exception ex) { Console.WriteLine("Failed to create guard: " + ex.Message); } } else { useGuard.Focus = focus; } }
public bool IsGuardCandidate(Mobile m) { if (m is BaseGuard || m is PlayerVendor || !m.Alive || m.AccessLevel > AccessLevel.Player || m.Blessed || !IsGuarded || m.Hidden) { return(false); } IPooledEnumerable eable = m.GetMobilesInRange(10); foreach (Mobile check in eable) { BaseGuard guard = check as BaseGuard; if (guard != null && guard.Focus == m) { eable.Free(); return(false); } } eable.Free(); return(m.Kills >= 5 || m.Criminal); }
public GuardAI(BaseCreature m) : base(m) { m_Guard = m as BaseGuard; }
public override void MakeGuard(Mobile focus) { if (IsDisabled()) { return; } if (PCsOnly && focus is BaseCreature && !(((BaseCreature)focus).Controled || ((BaseCreature)focus).Summoned)) { BaseGuard useGuard = null; foreach (Mobile m in focus.GetMobilesInRange(12)) { if (m is WeakWarriorGuard) { WeakWarriorGuard g = (WeakWarriorGuard)m; if ((g.Focus == null || !g.Focus.Alive || g.Focus.Deleted) && (useGuard == null || g.GetDistanceToSqrt(focus) < useGuard.GetDistanceToSqrt(focus)) ) { useGuard = g; } } } if (useGuard != null) { useGuard.Focus = focus; } } else { BaseGuard useGuard = null, curGuard = null; foreach (Mobile m in focus.GetMobilesInRange(10)) { if (m is BaseGuard && !(m is WeakWarriorGuard)) { BaseGuard g = (BaseGuard)m; if (g.Focus == focus) { curGuard = g; } else if ((g.Focus == null || !g.Focus.Alive || g.Focus.Deleted) && (useGuard == null || g.GetDistanceToSqrt(focus) < useGuard.GetDistanceToSqrt(focus)) ) { useGuard = g; } } } if (useGuard != null) { useGuard.Focus = focus; } else if (curGuard == null) { m_GuardParams[0] = focus; Activator.CreateInstance(m_GuardType, m_GuardParams); } } }