GetMaster() public method

public GetMaster ( ) : Mobile
return Mobile
Esempio n. 1
0
        public override bool IsEnemy(Mobile m)
        {
            if (m.Player && ((PlayerMobile)m).Undead)
            {
                return(true);
            }

            if (m.Player || m is BaseVendor)
            {
                return(false);
            }

            if (m is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)m;

                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    return(IsEnemy(master));
                }
            }

            return(m.Karma < 0);
        }
Esempio n. 2
0
		public virtual bool OnSingleClick(Mobile m, BaseCreature target)
		{
			if (m == null || m.Deleted || target == null || target.Deleted)
			{
				return false;
			}

			if ((!DebugMode && m.AccessLevel >= AccessLevel.Counselor) || State == PvPBattleState.Internal || Hidden)
			{
				return true;
			}

			if (target is BaseMount && target.GetMaster() == m && Options.Restrictions.Pets.IsRestricted(target))
			{
				return false;
			}

			return true;
		}
Esempio n. 3
0
		public virtual bool OnDoubleClick(Mobile m, BaseCreature target)
		{
			if (m == null || m.Deleted || target == null || target.Deleted)
			{
				return false;
			}

			if ((!DebugMode && m.AccessLevel >= AccessLevel.Counselor) || State == PvPBattleState.Internal || Hidden)
			{
				return true;
			}

			if (target.GetMaster() == m)
			{
				if (target is BaseMount && !Options.Rules.CanMount)
				{
					m.SendMessage("You are not allowed to ride a mount in this battle.");
					return false;
				}

				if (Options.Restrictions.Pets.IsRestricted(target))
				{
					m.SendMessage("You can not use that in this battle.");
					return false;
				}
			}

			return true;
		}
Esempio n. 4
0
        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);
        }