示例#1
0
        public void Provoke(Mobile target)
        {
            if (target == null || this.Deleted || !this.Alive || this.m_NextProvoke > DateTime.Now || 0.05 < Utility.RandomDouble())
            {
                return;
            }

            foreach (Mobile m in this.GetMobilesInRange(this.RangePerception))
            {
                if (m is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)m;

                    if (c == this || c == target || c.Unprovokable || c.IsParagon || c.BardProvoked || c.IsStaff() || !c.CanBeHarmful(target))
                    {
                        continue;
                    }

                    c.Provoke(this, target, true);

                    if (target.Player)
                    {
                        target.SendLocalizedMessage(1072062); // You hear angry music, and start to fight.
                    }
                    this.PlaySound(0x58A);
                    break;
                }
            }

            this.m_NextProvoke = DateTime.Now + TimeSpan.FromSeconds(10);
        }