Example #1
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                m_Owner.Criminal = false;
                m_Owner.Kills    = 0;
                m_Owner.Stam     = m_Owner.StamMax;

                Mobile target = m_Owner.Focus;

                if (target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target)))
                {
                    m_Owner.Focus = null;
                    Stop();
                    return;
                }
                else if (m_Owner.Weapon is Fists)
                {
                    m_Owner.Kill();
                    Stop();
                    return;
                }

                if (target != null && m_Owner.Combatant != target)
                {
                    m_Owner.Combatant = target;
                }

                if (target == null)
                {
                    Stop();
                }

                /*else
                 * {// <instakill>
                 *      TeleportTo( target );
                 *      target.BoltEffect( 0 );
                 *
                 *      if ( target is BaseCreature )
                 *              ((BaseCreature)target).NoKillAwards = true;
                 *
                 *      target.Damage( target.HitsMax, m_Owner );
                 *      target.Kill(); // just in case, maybe Damage is overriden on some shard
                 *
                 *      if ( target.Corpse != null && !target.Player )
                 *              target.Corpse.Delete();
                 *
                 *      m_Owner.Focus = null;
                 *      Stop();
                 * }// </instakill>*/
                else if (!m_Owner.InRange(target, 20))
                {
                    m_Owner.Focus = null;
                }

                /*else if ( !m_Owner.InRange( target, 10 ) || !m_Owner.InLOS( target ) )  // edited by Matt - make it possible to run away
                 * {
                 *      TeleportTo( target );
                 * }*/
                else if (!m_Owner.InRange(target, 1))
                {
                    if (!m_Owner.Move(m_Owner.GetDirectionTo(target) | Direction.Running))
                    {
                        TeleportTo(target);
                    }
                }
                else if (!m_Owner.CanSee(target))
                {
                    if (!m_Owner.UseSkill(SkillName.DetectHidden) && Utility.Random(50) == 0)
                    {
                        m_Owner.Say("Reveal!");
                    }
                }
            }