Ejemplo n.º 1
0
            protected override void OnTick()
            {
                if (!m_Owner.Deleted)
                {
                    m_Owner.Criminal = false;
                    m_Owner.Karma    = 0;
                    m_Owner.Fame     = 0;
                    m_Owner.Kills    = 0;
                    m_Owner.Stam     = m_Owner.StamMax;

                    Mobile target = m_Owner.Focus;

                    if (target != null)
                    {
                        if (!target.Deleted && target.Alive && m_Owner.CanBeHarmful(target))                             //Dead, deleted, or invul
                        {
                            if (m_Owner.Weapon is Fists)
                            {
                                m_Owner.Kill();
                            }
                            else
                            {
                                if (m_Owner.Combatant != target)
                                {
                                    m_Owner.Combatant = target;
                                }

                                TeleportTo(target);
                                target.BoltEffect(0);

                                if (target is BaseCreature)
                                {
                                    ((BaseCreature)target).NoKillAwards = true;
                                }

                                target.Damage(target.HitsMax, m_Owner);
                                target.LastKiller = m_Owner;
                                target.Kill();                                 // just in case, maybe Damage is overridden on some shard

                                if (target.Player)
                                {
                                    if (Faction.Find(target) != null)
                                    {
                                        Faction.ApplySkillLoss(target);
                                    }
                                }
                                else if (target.Corpse != null)
                                {
                                    target.Corpse.Delete();
                                }
                            }
                        }

                        m_Owner.Focus = null;
                    }
                }

                Stop();
            }
Ejemplo n.º 2
0
        public void HandlePlayerDeath(PlayerMobile victim)
        {
            VvVPlayerEntry ventry = GetPlayerEntry <VvVPlayerEntry>(victim);

            if (ventry != null && ventry.Active)
            {
                List <DamageEntry> list    = victim.DamageEntries.OrderBy(d => - d.DamageGiven).ToList();
                List <Mobile>      handled = new List <Mobile>();
                bool statloss = false;

                for (int i = 0; i < list.Count; i++)
                {
                    Mobile dam = list[i].Damager;

                    if (dam is BaseCreature && ((BaseCreature)dam).GetMaster() is PlayerMobile)
                    {
                        dam = ((BaseCreature)dam).GetMaster();
                    }

                    bool isEnemy = IsEnemy(victim, dam);

                    if (isEnemy && dam != null && Battle.IsInActiveBattle(dam, victim))
                    {
                        VvVPlayerEntry kentry = GetPlayerEntry <VvVPlayerEntry>(dam);

                        if (kentry != null && !handled.Contains(dam))
                        {
                            if (i == 0)
                            {
                                Battle.Update(ventry, kentry, UpdateType.Kill);
                            }
                            else
                            {
                                Battle.Update(ventry, kentry, UpdateType.Assist);
                            }

                            handled.Add(dam);
                        }
                    }

                    if (!statloss && isEnemy)
                    {
                        statloss = true;
                    }
                }

                if (statloss)
                {
                    Faction.ApplySkillLoss(victim);
                }

                ColUtility.Free(list);
                ColUtility.Free(handled);
            }
        }
Ejemplo n.º 3
0
            protected override void OnTick()
            {
                if (!m_Owner.Deleted)
                {
                    m_Owner.Criminal = false;
                    m_Owner.Kills    = 0;
                    m_Owner.Stam     = m_Owner.StamMax;

                    Mobile target = m_Owner.Focus;

                    if (m_Owner.Weapon is Fists)
                    {
                        m_Owner.Kill();
                    }
                    else if (target != null)
                    {
                        if (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target))
                        {
                            m_Owner.Focus = null;
                        }
                        else
                        {                        // <instakill>
                            if (m_Owner.Combatant != target)
                            {
                                m_Owner.Combatant = target;
                            }
                            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 overridden on some shard

                            if (target.Corpse != null && !target.Player)
                            {
                                target.Corpse.Delete();
                            }

                            if (target is PlayerMobile)
                            {
                                if (Faction.Find(target) != null)
                                {
                                    Faction.ApplySkillLoss(target);
                                }

                                if (Ethics.Player.Find(target) != null)
                                {
                                    Ethic.ApplySkillLoss(target);
                                }
                            }

                            m_Owner.Focus = null;
                        }                        // </instakill>

                        /*else if ( !m_Owner.InRange( target, 20 ) )
                         *      m_Owner.Focus = null;
                         * else if ( !m_Owner.InRange( target, 10 ) || !m_Owner.InLOS( target ) )
                         *      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!" );
                         * }*/
                    }

                    Stop();
                }
            }
Ejemplo n.º 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;
                }
                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 overridden on some shard

                    if (target.Corpse != null && !target.Player)
                    {
                        target.Corpse.Delete();
                    }

                    if (target is PlayerMobile && Faction.Find(target) != null)
                    {
                        Faction.ApplySkillLoss(target);
                    }

                    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 );
                 *              }
                 *      }
                 * }*/
            }