Пример #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>
            }
Пример #2
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 if (!(target.Region is Regions.GuardedRegion))
                {
                    m_Owner.Move(m_Owner.GetDirectionTo(target));
                }
                else if (!m_Owner.InRange(target, 1))
                {
                    TeleportTo(target);
                }
            }
Пример #3
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_Shooting = false;
                 *      m_Owner.Focus = null;
                 * }
                 * else if ( !m_Owner.InLOS( target ) )
                 * {
                 *      m_Shooting = false;
                 *      TeleportTo( target );
                 * }
                 * else if ( !m_Owner.CanSee( target ) )
                 * {
                 *      m_Shooting = false;
                 *
                 *      if ( !m_Owner.InRange( target, 2 ) )
                 *      {
                 *              if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
                 *                      TeleportTo( target );
                 *      }
                 *      else
                 *      {
                 *              if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 )
                 *                      m_Owner.Say( "Reveal!" );
                 *      }
                 * }
                 * else
                 * {
                 *      if ( m_Shooting && (TimeToSpare() || OutOfMaxDistance( target )) )
                 *              m_Shooting = false;
                 *      else if ( !m_Shooting && InMinDistance( target ) )
                 *              m_Shooting = true;
                 *
                 *      if ( !m_Shooting )
                 *      {
                 *              if ( m_Owner.InRange( target, 1 ) )
                 *              {
                 *                      if ( !m_Owner.Move( (Direction)(m_Owner.GetDirectionTo( target ) - 4) | Direction.Running ) && OutOfMaxDistance( target ) ) // Too close, move away
                 *                              TeleportTo( target );
                 *              }
                 *              else if ( !m_Owner.InRange( target, 2 ) )
                 *              {
                 *                      if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
                 *                              TeleportTo( target );
                 *              }
                 *      }
                 * }*/
            }
Пример #4
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;
                }

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

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

                else
                {
                    //wander around, kill and wait for timer to end
                    if ((m_Stage++ % 4) == 0 || !m_Owner.Move(m_Owner.Direction))
                    {
                        m_Owner.Direction = (Direction)Utility.Random(8);
                    }

                    //Time to talk
                    switch (Utility.Random(5))  //picks one of the following
                    {
                    case 0:
                    { m_Owner.Say("Whose life is it anyway?."); break; }

                    case 1:
                    { m_Owner.Say("It is the act of a madman to pursue impossibilities."); break; }

                    case 2:
                    { m_Owner.Say("Go, and do thou likewise."); break; }

                    case 3:
                    { m_Owner.Say("What stings is justice."); break; }

                    case 4:
                    { m_Owner.Say("Dig the well before you are thirsty."); break; }
                    }

                    //Stop fighting and wait for next attack
                    //m_Owner.Focus = null;
                    //Stop();
                    //return;
                }
            }
Пример #5
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;
                }

                //10OCT2007 InstaKill for Creatures ONLY *** START ***

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

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

                else
                {
                    //kill creatures only
                    if (target is BaseCreature)
                    {
                        target.BoltEffect(0);
                        //((BaseCreature)target).NoKillAwards = true;
                        target.Kill(); // just in case, maybe Damage is overriden on some shard
                        m_Owner.Focus = null;
                        m_TeleportTo  = false;
                        Stop();
                    }
                    else
                    {
                        //kill player if in a certian region
                        IPoint3D ip = m_Owner as IPoint3D;

                        if (ip != null)
                        {
                            Point3D p = new Point3D(ip);

                            Region reg = Region.Find(new Point3D(p), m_Owner.Map);

                            if (reg.Name == "SafeZone")
                            {
                                target.BoltEffect(0);
                                ((BaseCreature)target).NoKillAwards = true;
                                target.Kill(); // just in case, maybe Damage is overriden on some shard
                                m_Owner.Focus = null;
                                m_TeleportTo  = false;
                                Stop();
                            }
                            else
                            {
                                //Turn Off Guard
                                m_Owner.Focus = null;

                                //wander around and wait for timer to end
                                if ((m_Stage++ % 4) == 0 || !m_Owner.Move(m_Owner.Direction))
                                {
                                    m_Owner.Direction = (Direction)Utility.Random(8);
                                }

                                //Time to talk
                                switch (Utility.Random(5))  //picks one of the following
                                {
                                case 0:
                                { m_Owner.Say("Depend not on fortune, but on conduct."); break; }

                                case 1:
                                { m_Owner.Say("The appearance of right oft leads us wrong."); break; }

                                case 2:
                                { m_Owner.Say("To save time is to lengthen life."); break; }

                                case 3:
                                { m_Owner.Say("Rich gifts wax poor when givers prove unkind."); break; }

                                case 4:
                                { m_Owner.Say("Act the way you'd like to be and soon you'll be the way you act."); break; }
                                }
                            }
                        }
                    }

                    //    //if target is using his/her hands (don't know why this was important)
                    //    if (m_Owner.Weapon is Fists)
                    //    {
                    //        m_Owner.Say("I should have brought a weapon!");
                    //        m_Shooting = true;
                    //        return;
                    //    }

                    //    //if target is too far away, let him go
                    //    if (!m_Owner.InRange(target, 20))
                    //    {
                    //        m_Owner.Say("You hear the guard laughing at you");
                    //        m_Owner.Focus = null;
                    //        m_Shooting = false;
                    //        m_TeleportTo = false;
                    //        Stop();
                    //    }

                    //    //if target is not visiable, stop shooting
                    //    if (!m_Owner.CanSee(target) || !m_Owner.InLOS(target))
                    //    {
                    //        m_Shooting = false;
                    //    }

                    //    //if target is hiding, reveal him
                    //    if (!m_Owner.UseSkill(SkillName.DetectHidden) && Utility.Random(50) == 0)
                    //    {
                    //        m_Owner.Say("Reveal!");
                    //        m_Shooting = true;
                    //    }
                    //}
                }

                //{// <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_Shooting = false;
                //    m_Owner.Focus = null;
                //}
                //else if ( !m_Owner.InLOS( target ) )
                //{
                //    m_Shooting = false;
                //    TeleportTo( target );
                //}
                //else if ( !m_Owner.CanSee( target ) )
                //{
                //    m_Shooting = false;

                //    if ( !m_Owner.InRange( target, 2 ) )
                //    {
                //        if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
                //            TeleportTo( target );
                //    }
                //    else
                //    {
                //        if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 )
                //            m_Owner.Say( "Reveal!" );
                //    }
                //}
                //else
                //{
                //    if ( m_Shooting && (TimeToSpare() || OutOfMaxDistance( target )) )
                //        m_Shooting = false;
                //    else if ( !m_Shooting && InMinDistance( target ) )
                //        m_Shooting = true;

                //    if ( !m_Shooting )
                //    {
                //        if ( m_Owner.InRange( target, 1 ) )
                //        {
                //            if ( !m_Owner.Move( (Direction)(m_Owner.GetDirectionTo( target ) - 4) | Direction.Running ) && OutOfMaxDistance( target ) ) // Too close, move away
                //                TeleportTo( target );
                //        }
                //        else if ( !m_Owner.InRange( target, 2 ) )
                //        {
                //            if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
                //                TeleportTo( target );
                //        }
                //    }
                //}*/

                //10OCT2007 InstaKill for Creatures ONLY *** END   ***
            }