Provoke() public method

public Provoke ( Mobile master, Mobile target, bool bSuccess ) : void
master Mobile
target Mobile
bSuccess bool
return void
Beispiel #1
0
        public void Provoke(Mobile target)
        {
            if (target == null || Deleted || !Alive || m_NextProvoke > DateTime.UtcNow || 0.05 < Utility.RandomDouble())
            {
                return;
            }

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

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

                    c.Provoke(this, target, true);

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

            m_NextProvoke = DateTime.UtcNow + TimeSpan.FromSeconds(10);
        }
Beispiel #2
0
        public void DoProvocation()
        {
            DebugSay("I Provoke!");

            BaseCreature target = null;

            foreach (Mobile m in this.GetMobilesInRange(BaseInstrument.GetBardRange(this, SkillName.Provocation)))
            {
                if (m is BaseCreature)
                {
                    if (m != Combatant && m != this && IsProvokable(m as BaseCreature))
                    {
                        target = m as BaseCreature;
                        break;
                    }
                }
            }

            if (target != null)
            {
                double diff  = ((BaseInstrument.GetBaseDifficulty(target) + BaseInstrument.GetBaseDifficulty(Combatant)) * 0.5) - 5.0;
                double music = this.Skills[SkillName.Musicianship].Value;

                if (music > 100.0)
                {
                    diff -= (music - 100.0) * 0.5;
                }

                if (!this.CheckTargetSkill(SkillName.Provocation, Combatant, diff - 25.0, diff + 25.0))
                {
                    this.PlaySound(FailureSound);
                }
                else
                {
                    this.PlaySound(SuccessSound);
                    target.Provoke(this, Combatant, true);
                }
            }
            else
            {
                DebugSay("Nothing to provoke.");
            }
        }
        public bool UseProvocation()
        {
            if (!this.m_Mobile.UseSkill(SkillName.Provocation))
            {
                return(false);
            }
            else if (this.m_Mobile.Target != null)
            {
                this.m_Mobile.Target.Cancel(this.m_Mobile, TargetCancelType.Canceled);
            }

            Mobile target = this.m_Mobile.Combatant as Mobile;

            if (this.m_Mobile.Combatant is BaseCreature)
            {
                BaseCreature bc = this.m_Mobile.Combatant as BaseCreature;
                target = bc.GetMaster();

                if (target != null && bc.CanBeHarmful(target))
                {
                    if (this.m_Mobile.Debug)
                    {
                        this.m_Mobile.Say(1162, "Provocation: Pet to Master");
                    }

                    bc.Provoke(this.m_Mobile, target, true);
                    return(true);
                }
            }

            List <BaseCreature> list = new List <BaseCreature>();

            foreach (Mobile m in this.m_Mobile.GetMobilesInRange(5))
            {
                if (m != null && m is BaseCreature && m != this.m_Mobile)
                {
                    BaseCreature bc = m as BaseCreature;

                    if (this.m_Mobile.Controlled != bc.Controlled)
                    {
                        continue;
                    }

                    if (this.m_Mobile.Summoned != bc.Summoned)
                    {
                        continue;
                    }

                    list.Add(bc);
                }
            }

            if (list.Count == 0)
            {
                return(false);
            }

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].CanBeHarmful(target))
                {
                    if (this.m_Mobile.Debug)
                    {
                        this.m_Mobile.Say(1162, "Provocation: " + list[i].Name + " to " + target.Name);
                    }

                    list[i].Provoke(this.m_Mobile, target, true);
                    return(true);
                }
            }

            return(false);
        }