Ejemplo n.º 1
0
        public static void EventSink_Movement(MovementEventArgs e)
        {
            var from = e.Mobile;

            if (!from.Alive || from.AccessLevel > AccessLevel.Player)
            {
                return;
            }

            if (!from.Player)
            {
                // Else it won't work on monsters.
                DeathStrike.AddStep(from);
                return;
            }

            var maxWeight  = GetMaxWeight(from) + OverloadAllowance;
            var overWeight = Mobile.BodyWeight + from.TotalWeight - maxWeight;

            if (overWeight > 0)
            {
                from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);

                if (from.Stam == 0)
                {
                    from.SendLocalizedMessage(
                        500109
                        ); // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            if (from.Stam * 100 / Math.Max(from.StamMax, 1) < 10)
            {
                --from.Stam;
            }

            if (from.Stam == 0)
            {
                from.SendLocalizedMessage(500110); // You are too fatigued to move.
                e.Blocked = true;
                return;
            }

            if (from is PlayerMobile pm)
            {
                var amt = pm.Mounted ? 48 : 16;

                if (++pm.StepsTaken % amt == 0)
                {
                    --pm.Stam;
                }
            }

            DeathStrike.AddStep(from);
        }
Ejemplo n.º 2
0
        public override bool CheckCast()
        {
            if (!base.CheckCast())
            {
                return(false);
            }

            if (!CheckExpansion(Caster))
            {
                Caster.SendLocalizedMessage(1063456);                   // You must upgrade to Samurai Empire in order to use that ability.

                return(false);
            }

            if (Caster.Skills[SkillName.Bushido].Value < RequiredSkill)
            {
                string args = String.Format("{0}\t{1}\t ", RequiredSkill.ToString("F1"), CastSkill.ToString());
                Caster.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(false);
            }
            else if (Caster.Mana < ScaleMana(RequiredMana))
            {
                Caster.SendLocalizedMessage(1060174, RequiredMana.ToString());                   // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
                return(false);
            }

            if (HonorableExecution.UnderEffect(Caster) || LightningStrike.UnderEffect(Caster) || MomentumStrike.UnderEffect(Caster))
            {
                return(true);
            }

            WeaponAbility ability = WeaponAbility.GetCurrentAbility(Caster);

            if (ability != null)
            {
                WeaponAbility.ClearCurrentAbility(Caster);
            }

            if (AnimalForm.UnderEffect(Caster))
            {
                if (this is HonorableExecution || this is LightningStrike || this is MomentumStrike)
                {
                    Caster.SendLocalizedMessage(1063024);                       // You cannot perform this special move right now.

                    return(false);
                }
            }

            if (FocusAttack.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0xF5, 0));

                FocusAttack.m_Table.Remove(Caster);

                BaseWeapon weapon = Caster.Weapon as BaseWeapon;

                if (weapon != null)
                {
                    FocusAttack.RemoveBonus(weapon);
                }
            }

            if (DeathStrike.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0xF6, 0));

                DeathStrike.m_Table.Remove(Caster);
            }

            if (KiAttack.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0xF8, 0));

                KiAttack.m_Table.Remove(Caster);
            }

            if (SurpriseAttack.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0xF9, 0));

                SurpriseAttack.m_Table.Remove(Caster);
            }

            if (Backstab.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0xFA, 0));

                Backstab.m_Table.Remove(Caster);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static void EventSink_Movement(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Alive || from.AccessLevel > AccessLevel.Player)
            {
                return;
            }

            if (!from.Player)
            {
                // Else it won't work on monsters.
                DeathStrike.AddStep(from);
                return;
            }

            int maxWeight  = GetMaxWeight(from) + OverloadAllowance;
            int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

            if (overWeight > 0)
            {
                from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);

                if (from.Stam == 0)
                {
                    from.SendLocalizedMessage(500109);                       // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            //if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
            //	--from.Stam;

            if (from.Stam == 0)
            {
                from.SendLocalizedMessage(500110);                   // You are too fatigued to move.
                e.Blocked = true;
                return;
            }

            /*
             * if (from is PlayerMobile)
             * {
             *  int amt = (from.Mounted ? 48 : 16);
             *  PlayerMobile pm = (PlayerMobile)from;
             *
             *  if ((++pm.StepsTaken % amt) == 0)
             *      --from.Stam;
             * }
             *
             *
             * if ( overWeight <= 0 && from is PlayerMobile && from.TotalWeight > 200)
             * {
             *  PlayerMobile pm = (PlayerMobile)from;
             *
             *  if (!pm.IsInEvent)
             *  {
             *      int amt = (-from.TotalWeight + from.MaxWeight)/6;
             *
             *      if ((e.Direction & Direction.Running) != 0) //Running
             *          amt /= 4;
             *
             *      if (!from.Mounted)
             *          amt /= 2;
             *
             *      if (amt < 1)
             *          amt = 1;
             *
             *      if ((++pm.StepsTaken%amt) == 0)
             *          --from.Stam;
             *  }
             * }
             */

            DeathStrike.AddStep(from);
        }
        public static bool SetCurrentAbility(Mobile m, WeaponAbility a)
        {
            if (!Core.AOS)
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (!IsWeaponAbility(m, a))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a != null && !a.Validate(m))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a == null)
            {
                m_Table.Remove(m);
            }
            else
            {
                m_Table[m] = a;
            }

            m.CanReveal = true;

            if (HonorableExecution.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0x91, 0));

                HonorableExecution.m_Table.Remove(m);
            }

            if (LightningStrike.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0x95, 0));

                LightningStrike.m_Table.Remove(m);
            }

            if (MomentumStrike.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0x96, 0));

                MomentumStrike.m_Table.Remove(m);
            }

            if (FocusAttack.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0xF5, 0));

                FocusAttack.m_Table.Remove(m);

                BaseWeapon weapon = m.Weapon as BaseWeapon;

                if (weapon != null)
                {
                    FocusAttack.RemoveBonus(weapon);
                }
            }

            if (DeathStrike.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0xF6, 0));

                DeathStrike.m_Table.Remove(m);
            }

            if (KiAttack.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0xF8, 0));

                KiAttack.m_Table.Remove(m);
            }

            if (SurpriseAttack.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0xF9, 0));

                SurpriseAttack.m_Table.Remove(m);
            }

            if (Backstab.UnderEffect(m))
            {
                m.Send(new SetNewSpell(0xFA, 0));

                Backstab.m_Table.Remove(m);
            }

            return(true);
        }