Beispiel #1
0
        public static void SetMountPrevention(Mobile mob, IMount mount, BlockMountType type, TimeSpan duration)
        {
            if (mob == null)
            {
                return;
            }

            DateTime   expiration = DateTime.UtcNow + duration;
            BlockEntry entry      = null;

            if (m_Table.ContainsKey(mob))
            {
                entry = m_Table[mob];
            }

            if (entry != null)
            {
                entry.m_Type       = type;
                entry.m_Expiration = expiration;
            }
            else
            {
                m_Table[mob] = entry = new BlockEntry(mob, mount, type, expiration);
            }

            BuffInfo.AddBuff(mob, new BuffInfo(BuffIcon.DismountPrevention, 1075635, 1075636, duration, mob));
        }
Beispiel #2
0
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (!dismounted.Mounted)
            {
                return;
            }

            if (dismounted is ChaosDragoonElite)
            {
                dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
            }

            IMount mount = dismounted.Mount;

            if (mount != null)
            {
                mount.Rider = null;
                BaseMount.SetMountPrevention(dismounted, blockmounttype, delay);

                if (message)
                {
                    dismounted.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
                }
            }
            else if (dismounted.Flying)
            {
                if (!OnFlightPath(dismounted))
                {
                    dismounted.Flying = false;
                    dismounted.Freeze(TimeSpan.FromSeconds(1));
                    dismounted.Animate(61, 10, 1, true, false, 0);
                }
            }
        }
Beispiel #3
0
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (!dismounted.Mounted)
            {
                return;
            }

            /* Era -Fraz
             * if (dismounted is ChaosDragoonElite)
             * {
             *  dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
             * }
             */

            IMount mount = dismounted.Mount;

            if (mount != null)
            {
                mount.Rider = null;
                BaseMount.SetMountPrevention(dismounted, blockmounttype, delay);

                if (message)
                {
                    dismounted.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
                }
            }
        }
Beispiel #4
0
 public BlockEntry(Mobile m, IMount mount, BlockMountType type, DateTime expiration)
 {
     m_Mobile     = m;
     m_Mount      = mount;
     m_Type       = type;
     m_Expiration = expiration;
 }
Beispiel #5
0
        public static void SetMountBlock(
            this Mobile m,
            BlockMountType type,
            TimeSpan duration,
            bool dismount,
            Mobile f = null)
        {
            if (m == null)
            {
                return;
            }

            if (dismount && m.Mounted)
            {
                m.Mount.Rider = null;
            }

            if (m is PlayerMobile && _PlayerMountBlock != null)
            {
                _PlayerMountBlock.Invoke(m, new object[] { type, duration, dismount });
                return;
            }

            if (_BaseMountBlock != null)
            {
                _BaseMountBlock.Invoke(null, new object[] { m, type, duration });
            }
        }
Beispiel #6
0
        public static bool CheckMountAllowed(Mobile mob, bool message)
        {
            BlockMountType type = GetMountPrevention(mob);

            if (type == BlockMountType.None)
            {
                return(true);
            }

            if (message)
            {
                switch (type)
                {
                case BlockMountType.Dazed:
                {
                    mob.SendLocalizedMessage(1040024);                               // You are still too dazed from being knocked off your mount to ride!
                    break;
                }

                case BlockMountType.BolaRecovery:
                {
                    mob.SendLocalizedMessage(1062910);                               // You cannot mount while recovering from a bola throw.
                    break;
                }

                case BlockMountType.DismountRecovery:
                {
                    mob.SendLocalizedMessage(1070859);                               // You cannot mount while recovering from a dismount special maneuver.
                    break;
                }
                }
            }

            return(false);
        }
Beispiel #7
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!defender.Mounted && !defender.Flying && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(defender))
            {
                attacker.SendLocalizedMessage(1060848); // This attack only works on mounted targets
                ClearCurrentAbility(attacker);
                return;
            }

            if (!this.Validate(attacker) || !this.CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 5);

            if (!attacker.Mounted)
            {
                BlockMountType type  = BlockMountType.RidingSwipe;
                IMount         mount = defender.Mount;

                if (defender.Flying)
                {
                    type = BlockMountType.RidingSwipeFlying;
                }
                else if (mount is EtherealMount)
                {
                    type = BlockMountType.RidingSwipeEthereal;
                }

                Server.Items.Dismount.DoDismount(attacker, defender, mount, 10, type);

                if (mount is Mobile)
                {
                    AOS.Damage((Mobile)mount, attacker, amount, 100, 0, 0, 0, 0);
                }

                defender.PlaySound(0x140);
                defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist);
            }
            else
            {
                AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);

                if (Server.Items.ParalyzingBlow.IsImmune(defender)) //Does it still do damage?
                {
                    attacker.SendLocalizedMessage(1070804);         // Your target resists paralysis.
                    defender.SendLocalizedMessage(1070813);         // You resist paralysis.
                }
                else
                {
                    defender.Paralyze(TimeSpan.FromSeconds(3.0));
                    Server.Items.ParalyzingBlow.BeginImmunity(defender, Server.Items.ParalyzingBlow.FreezeDelayDuration);
                }
            }
        }
Beispiel #8
0
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (!dismounted.Mounted && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(dismounted) && !dismounted.Flying)
            {
                return;
            }

            if (dismounted is ChaosDragoonElite)
            {
                dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
            }

            IMount mount = dismounted.Mount;
            Mobile m     = null;

            if (mount != null)
            {
                mount.Rider = null;

                if (message)
                {
                    dismounted.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
                }
                if (mount is Mobile)
                {
                    m = (Mobile)mount;
                }
            }
            else if (Core.ML && Spells.Ninjitsu.AnimalForm.UnderTransformation(dismounted))
            {
                Spells.Ninjitsu.AnimalForm.RemoveContext(dismounted, true);
            }
            else if (dismounted.Flying)
            {
                if (!OnFlightPath(dismounted))
                {
                    dismounted.Flying = false;
                    dismounted.Freeze(TimeSpan.FromSeconds(1));
                    dismounted.Animate(AnimationType.Land, 0);
                    BuffInfo.RemoveBuff(dismounted, BuffIcon.Fly);

                    m = dismounted;
                }
            }
            else
            {
                return;
            }

            if (delay != TimeSpan.MinValue)
            {
                SetMountPrevention(dismounted, m, blockmounttype, delay);
            }
        }
Beispiel #9
0
        public static bool CheckMountAllowed(Mobile mob, BaseMount mount, bool message, bool flying)
        {
            BlockMountType type = GetMountPrevention(mob, mount);

            if (type == BlockMountType.None)
            {
                return(true);
            }

            if (message && mob.NetState != null)
            {
                switch (type)
                {
                case BlockMountType.RidingSwipeEthereal:
                case BlockMountType.Dazed:
                {
                    mob.PrivateOverheadMessage(MessageType.Regular, 0x3B2, flying ? 1112457 : 1040024, mob.NetState);
                    // You are still too dazed from being knocked off your mount to ride!
                    break;
                }

                case BlockMountType.BolaRecovery:
                {
                    mob.PrivateOverheadMessage(MessageType.Regular, 0x3B2, flying ? 1112455 : 1062910, mob.NetState);
                    // You cannot mount while recovering from a bola throw.
                    break;
                }

                case BlockMountType.RidingSwipe:
                {
                    mob.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1062934, mob.NetState);
                    // You must heal your mount before riding it.
                    break;
                }

                case BlockMountType.RidingSwipeFlying:
                {
                    mob.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1112454, mob.NetState);
                    // You must heal your mount before riding it.
                    break;
                }

                case BlockMountType.DismountRecovery:
                {
                    mob.PrivateOverheadMessage(MessageType.Regular, 0x3B2, flying ? 1112456 : 1070859, mob.NetState);
                    // You cannot mount while recovering from a dismount special maneuver.
                    break;
                }
                }
            }

            return(false);
        }
Beispiel #10
0
    public static void DoDismount(Mobile attacker, Mobile defender, TimeSpan delay, BlockMountType type = BlockMountType.Dazed)
    {
        attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount!

        if (attacker.Mounted)
        {
            defender.SendLocalizedMessage(1062315); // You fall off your mount!
        }
        else
        {
            defender.SendLocalizedMessage(1060083); // You fall off of your mount and take damage!
        }

        defender.PlaySound(0x140);
        defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist);

        if (defender is PlayerMobile mobile)
        {
            if (AnimalForm.UnderTransformation(mobile))
            {
                mobile.SendLocalizedMessage(1114066, attacker.Name); // ~1_NAME~ knocked you out of animal form!
            }
            else if (defender.Flying)
            {
                defender.SendLocalizedMessage(1113590, attacker.Name); // You have been grounded by ~1_NAME~!
            }
            else if (mobile.Mounted)
            {
                mobile.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
            }

            mobile.SetMountBlock(type, delay, true);
        }
        else
        {
            defender.Mount.Rider = null;
        }

        if (attacker is PlayerMobile playerMobile)
        {
            playerMobile.SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true);
        }
        else if (Core.ML && attacker is BaseCreature {
            ControlMaster : PlayerMobile pm
        })
Beispiel #11
0
        public static bool CheckFlyingAllowed(Mobile mob, bool message)
        {
            if (mob.Region != null && !mob.Region.AllowFlying(mob))
            {
                mob.SendMessage("You may not fly here.");
                return(false);
            }

            BlockMountType type = BaseMount.GetMountPrevention(mob);

            if (type == BlockMountType.None)
            {
                return(true);
            }

            if (message)
            {
                switch (type)
                {
                case BlockMountType.Dazed:
                {
                    mob.SendLocalizedMessage(1112457);                                       // You are still too dazed to fly.
                    break;
                }

                case BlockMountType.BolaRecovery:
                {
                    mob.SendLocalizedMessage(1112455);                                       // You cannot fly while recovering from a bola throw.
                    break;
                }

                case BlockMountType.DismountRecovery:
                {
                    mob.SendLocalizedMessage(1112456);                                       // You cannot fly while recovering from a dismount maneuver.
                    break;
                }
                }
            }

            return(false);
        }
Beispiel #12
0
        public static void SetMountPrevention(Mobile mob, BlockMountType type, TimeSpan duration)
        {
            if (mob == null)
            {
                return;
            }

            DateTime expiration = DateTime.Now + duration;

            BlockEntry entry = m_Table[mob] as BlockEntry;

            if (entry != null)
            {
                entry.m_Type       = type;
                entry.m_Expiration = expiration;
            }
            else
            {
                m_Table[mob] = entry = new BlockEntry(type, expiration);
            }
        }
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (!dismounted.Mounted)
            {
                return;
            }

            if (dismounted is ChaosDragoonElite)
            {
                dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
            }

            IMount mount = dismounted.Mount;

            if (mount != null)
            {
                mount.Rider = null;
                BaseMount.SetMountPrevention(dismounted, blockmounttype, delay);

                if (message)
                {
                    dismounted.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
                }
                BuffInfo.AddBuff(dismounted, new BuffInfo(BuffIcon.DismountPrevention, 1075635, 1075636, delay, dismounted));
            }
            else if (dismounted.Flying)
            {
                if (!OnFlightPath(dismounted))
                {
                    dismounted.Flying = false;
                    dismounted.Freeze(TimeSpan.FromSeconds(1));
                    dismounted.Animate(61, 10, 1, true, false, 0);
                }
            }
            else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(dismounted))
            {
                Spells.Ninjitsu.AnimalForm.RemoveContext(dismounted, true);
            }
        }
Beispiel #14
0
            public MountBlock(TimeSpan duration, BlockMountType type, Mobile mobile)
            {
                m_Type = type;

                m_Timer = Timer.DelayCall(duration, new TimerStateCallback<Mobile>(RemoveBlock), mobile);
            }
Beispiel #15
0
        public void SetMountBlock(BlockMountType type, TimeSpan duration, bool dismount)
        {
            if (dismount)
            {
                if (this.Mount != null)
                {
                    this.Mount.Rider = null;
                }
                else if (AnimalForm.UnderTransformation(this))
                {
                    AnimalForm.RemoveContext(this, true);
                }
            }

            if ((m_MountBlock == null) || !m_MountBlock.m_Timer.Running || (m_MountBlock.m_Timer.Next < (DateTime.UtcNow + duration)))
            {
                m_MountBlock = new MountBlock(duration, type, this);
            }
        }
		public void SetMountBlock(BlockMountType type, TimeSpan duration, bool dismount)
		{
			if (dismount)
			{
				BaseMount.Dismount(this, this, type, duration, false);
			}
			else
			{
				BaseMount.SetMountPrevention(this, type, duration);
			}
		}
Beispiel #17
0
        public static void DoDismount(Mobile attacker, Mobile defender, IMount mount, int delay, BlockMountType type = BlockMountType.Dazed)
        {
            attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount!

            if (defender is PlayerMobile)
            {
                if (Spells.Ninjitsu.AnimalForm.UnderTransformation(defender))
                {
                    defender.SendLocalizedMessage(1114066, attacker.Name); // ~1_NAME~ knocked you out of animal form!
                }
                else if (defender.Flying)
                {
                    defender.SendLocalizedMessage(1113590, attacker.Name); // You have been grounded by ~1_NAME~!
                }
                else if (defender.Mounted)
                {
                    defender.SendLocalizedMessage(1060083); // You fall off of your mount and take damage!
                }

                ((PlayerMobile)defender).SetMountBlock(type, TimeSpan.FromSeconds(delay), true);
            }
            else if (mount != null)
            {
                mount.Rider = null;
            }

            if (attacker is PlayerMobile)
            {
                ((PlayerMobile)attacker).SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(attacker.Weapon is BaseRanged ? 8 : 10), false);
            }
            else if (attacker is BaseCreature)
            {
                BaseCreature bc = attacker as BaseCreature;

                if (bc.ControlMaster is PlayerMobile)
                {
                    PlayerMobile pm = bc.ControlMaster as PlayerMobile;

                    pm.SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(delay), false);
                }
            }
        }
Beispiel #18
0
 public static void SetMountPrevention(Mobile mob, BlockMountType type, TimeSpan duration)
 {
     SetMountPrevention(mob, null, type, duration);
 }
Beispiel #19
0
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (!dismounted.Mounted)
                return;

            if (dismounted is ChaosDragoonElite)
            {
                dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
            }

            IMount mount = dismounted.Mount;

            if (mount != null)
            {
                mount.Rider = null;
                BaseMount.SetMountPrevention(dismounted, blockmounttype, delay);

                if (message)
                    dismounted.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
            }
            else if (dismounted.Flying)
            {
                if (!OnFlightPath(dismounted))
                {
                    dismounted.Flying = false;
                    dismounted.Freeze(TimeSpan.FromSeconds(1));
                    dismounted.Animate(61, 10, 1, true, false, 0);
                }
            }
            else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(dismounted))
            {
                Spells.Ninjitsu.AnimalForm.RemoveContext(dismounted, true);
            }
        }
Beispiel #20
0
 public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay)
 {
     Dismount(dismounter, dismounted, blockmounttype, TimeSpan.MinValue, true);
 }
Beispiel #21
0
 public static void Dismount(this Mobile m, BlockMountType type, Mobile f = null)
 {
     Dismount(m, type, TimeSpan.Zero, f);
 }
Beispiel #22
0
        public static void SetMountPrevention( Mobile mob, BlockMountType type, TimeSpan duration )
        {
            if( mob == null )
                return;

            DateTime expiration = DateTime.Now + duration;

            BlockEntry entry = m_Table[mob] as BlockEntry;

            if( entry != null )
            {
                entry.m_Type = type;
                entry.m_Expiration = expiration;
            }
            else
            {
                m_Table[mob] = entry = new BlockEntry(type, expiration);
            }
        }
Beispiel #23
0
 public BlockEntry( BlockMountType type, DateTime expiration )
 {
     m_Type = type;
     m_Expiration = expiration;
 }
Beispiel #24
0
 public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay)
 {
     Dismount(dismounter, dismounted, blockmounttype, TimeSpan.FromSeconds(0), true);
 }
Beispiel #25
0
 public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay)
 {
     Dismount(dismounter, dismounted, blockmounttype, TimeSpan.FromSeconds(0), true);
 }
Beispiel #26
0
 public BlockEntry(BlockMountType type, DateTime expiration)
 {
     m_Type       = type;
     m_Expiration = expiration;
 }
Beispiel #27
0
        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);
            }
        }
Beispiel #28
0
        public static void Dismount(Mobile dismounter, Mobile dismounted, BlockMountType blockmounttype, TimeSpan delay, bool message)
        {
            if (Core.ML && AnimalForm.UnderTransformation(dismounted))
            {
                AnimalForm.RemoveContext(dismounted, true);
                if (dismounted.Player)
                {
                    dismounted.SendLocalizedMessage(1114066, dismounter.Name); // ~1_NAME~ knocked you out of animal form!
                }
            }
            else
            {
                if (!dismounted.Mounted)
                {
                    return;
                }

                if (dismounted is Neira || dismounted is ChaosDragoon || dismounted is ChaosDragoonElite)
                {
                    if (dismounter.Player)
                    {
                        dismounter.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount.
                    }
                    return;
                }

                IMount mount = dismounted.Mount;

                if (mount != null)
                {
                    if (dismounter is PlayerMobile)
                    {
                        dismounter.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount!
                        ((PlayerMobile)dismounter).SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(Core.TOL && dismounter.Weapon is BaseRanged ? 8 : 10), false);
                    }

                    mount.Rider = null;

                    new BaseMount.DespawnTimer(mount, TimeSpan.FromMinutes(1.0)).Start();
                    if (mount is Mobile newMob)
                    {
                        // if (dismounter.Aggressor) newMob.Aggressed = dismounter;
                        newMob?.Attack(dismounter);
                    }

                    if (message)
                    {
                        if (dismounted.Flying)
                        {
                            if (dismounted.Player)
                            {
                                dismounted.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113590, dismounter.Name); // You have been grounded by ~1_NAME~!
                            }
                            if (!BaseMount.OnFlightPath(dismounted))
                            {
                                dismounted.Flying = false;
                                dismounted.Freeze(TimeSpan.FromSeconds(1));
                                dismounted.Animate(AnimationType.Land, 0);
                                BuffInfo.RemoveBuff(dismounted, BuffIcon.Fly);
                            }
                        }
                        else
                        {
                            // defender.SendLocalizedMessage(1060083); // You fall off of your mount and take damage!
                            if (dismounted.Player)
                            {
                                dismounted.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1049623, dismounter.Name); // You have been knocked off of your mount by ~1_NAME~!
                            }
                        }
                    }

                    if (Core.ML)
                    {
                        if (dismounter is BaseCreature)
                        {
                            BaseCreature bc = dismounter as BaseCreature;

                            if (bc.ControlMaster is PlayerMobile)
                            {
                                PlayerMobile pm = bc.ControlMaster as PlayerMobile;
                                pm.SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(10.0), false);
                            }
                        }
                    }

                    if (delay != TimeSpan.MinValue)
                    {
                        BaseMount.SetMountPrevention(dismounted, mount, blockmounttype, delay);
                    }
                }
            }
        }
Beispiel #29
0
 public static void Dismount(this Mobile m, BlockMountType type, TimeSpan duration, Mobile f = null)
 {
     SetMountBlock(m, type, duration, true, f);
 }