Server.Mobiles.PlayerMobile.SetMountBlock C# (CSharp) Method

SetMountBlock() public method

public SetMountBlock ( BlockMountType type, TimeSpan duration, bool dismount ) : void
type BlockMountType
duration TimeSpan
dismount bool
return void
        public void SetMountBlock(BlockMountType type, TimeSpan duration, bool dismount)
        {
            if (dismount)
            {
                if (this.Mount != null)
                {
                    this.Mount.Rider = null;
                }
            }

            if ((m_MountBlock == null) || !m_MountBlock.m_Timer.Running || (m_MountBlock.m_Timer.Next < (DateTime.UtcNow + duration)))
            {
                m_MountBlock = new MountBlock(duration, type, this);
            }
        }

Usage Example

示例#1
0
        public void DoDismount()
        {
            List <Mobile> targets = new List <Mobile>();

            IPooledEnumerable eable = GetMobilesInRange(12);

            foreach (Mobile mob in eable)
            {
                if (!CanBeHarmful(mob) || mob == this)
                {
                    continue;
                }

                if (mob is BaseCreature && (((BaseCreature)mob).Controlled || ((BaseCreature)mob).Summoned || ((BaseCreature)mob).Team != Team))
                {
                    targets.Add(mob);
                }
                else if (mob is PlayerMobile && mob.Alive)
                {
                    targets.Add(mob);
                }
            }
            eable.Free();

            PlaySound(0x2F3);
            for (int i = 0; i < targets.Count; ++i)
            {
                Mobile m = targets[i];

                if (m != null && !m.Deleted && m is PlayerMobile)
                {
                    PlayerMobile pm = m as PlayerMobile;

                    if (pm != null && (pm.Mounted || pm.Flying))
                    {
                        pm.SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(10), true);
                    }
                }

                double damage = m.Hits * 0.6;
                if (damage < 10.0)
                {
                    damage = 10.0;
                }
                else if (damage > 75.0)
                {
                    damage = 75.0;
                }

                DoHarmful(m);
                AOS.Damage(m, this, (int)damage, 100, 0, 0, 0, 0);
                if (m.Alive && m.Body.IsHuman && !m.Mounted)
                {
                    m.Animate(20, 7, 1, true, false, 0);
                }
            }


            m_NextDismount = DateTime.UtcNow + TimeSpan.FromMinutes(2);
        }
All Usage Examples Of Server.Mobiles.PlayerMobile::SetMountBlock