예제 #1
0
        public override void OnDoubleClick(Mobile m)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (!CanThrow(m, true))
            {
                return;
            }

            if (m.Spell != null)
            {
                m.Spell.OnCasterUsingObject(this);
            }

            if (ClearHands)
            {
                m.ClearHands();
            }

            if (DismountUser)
            {
                EtherealMount.StopMounting(m);
            }

            if (DismountUser && m.Mounted)
            {
                BaseMount.Dismount(m);
            }

            m.Target = BeginTarget(m);
            OnBeginTarget(m, true);
        }
예제 #2
0
파일: Bola.cs 프로젝트: Tauriella/ServUO-1
        private static void FinishThrow(object state)
        {
            object[] states = (object[])state;

            Mobile from = (Mobile)states[0];
            Mobile to   = (Mobile)states[1];
            Item   bola = (Item)states[2];

            if (!from.Alive)
            {
                return;
            }
            if (!bola.IsChildOf(from.Backpack))
            {
                bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
            }
            else if (!from.InRange(to, 15) || !from.InLOS(to) || !from.CanSee(to))
            {
                from.PrivateOverheadMessage(MessageType.Regular, 946, 1042060, from.NetState); // You cannot see that target!
            }
            else if (!to.Mounted && !to.Flying && !AnimalForm.UnderTransformation(to))
            {
                to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that.
            }
            else
            {
                bola.Consume();

                from.Direction = from.GetDirectionTo(to);
                from.Animate(AnimationType.Attack, 4);
                from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                new Bola().MoveToWorld(to.Location, to.Map);

                if (to is Neira || to is ChaosDragoon || to is ChaosDragoonElite)
                {
                    to.PrivateOverheadMessage(MessageType.Regular, 946, 1042047, from.NetState); // You fail to knock the rider from its mount.
                }
                else
                {
                    if (CheckHit(to, from))
                    {
                        to.Damage(Utility.RandomMinMax(10, 20), from);

                        if (from.Flying)
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113590, from.Name); // You have been grounded by ~1_NAME~!
                        }
                        else
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1049623, from.Name); // You have been knocked off of your mount by ~1_NAME~!
                        }
                        BaseMount.Dismount(to);

                        BaseMount.SetMountPrevention(to, BlockMountType.Dazed, TimeSpan.FromSeconds(10.0));
                    }
                }
            }
        }
예제 #3
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!defender.Mounted)
            {
                attacker.SendLocalizedMessage(1060848); // This attack only works on mounted targets
                ClearCurrentAbility(attacker);
                return;
            }

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

            ClearCurrentAbility(attacker);

            if (!attacker.Mounted)
            {
                var mount = defender.Mount as Mobile;
                BaseMount.Dismount(defender);

                if (mount != null) // Ethy mounts don't take damage
                {
                    var amount = 10 + (int)(10.0 * (attacker.Skills.Bushido.Value - 50.0) / 70.0 + 5);

                    AOS.Damage(
                        mount,
                        null,
                        amount,
                        100,
                        0,
                        0,
                        0,
                        0
                        ); // The mount just takes damage, there's no flagging as if it was attacking the mount directly

                    // TODO: Mount prevention until mount healed
                }
            }
            else
            {
                var amount = 10 + (int)(10.0 * (attacker.Skills.Bushido.Value - 50.0) / 70.0 + 5);

                AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);

                if (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));
                    Items.ParalyzingBlow.BeginImmunity(defender, Items.ParalyzingBlow.FreezeDelayDuration);
                }
            }
        }
예제 #4
0
        public override void OnEnter(Mobile m)
        {
            if (m_Controller.ShowEnterMessage)
            {
                m.SendMessage("You have entered {0}", this.Name);
            }
            if (m_Controller.ForceMobReturnHome)
            {
                if (m is BaseCreature)
                {
                    BaseCreature bc = (BaseCreature)m;
                    if (bc.Home != Point3D.Zero && !bc.Controlled && !bc.Deleted && bc.NetState == null)
                    {
                        bc.Location = bc.Home;
                    }
                }
            }
            if (!m_Controller.AllowHiding)
            {
                if (m.Hidden && m.AccessLevel == AccessLevel.Player)
                {
                    m.RevealingAction(false);
                    m.LocalOverheadMessage(MessageType.Regular, 38, false, "Your cover has been blown!");
                }
            }
            if (m_Controller.NoStatLoss)
            {
                PlayerMobile pm = m as PlayerMobile;
                if (pm != null)
                {
                    if (BaseShieldGuard.InSkillLoss(pm))
                    {
                        BaseShieldGuard.ClearSkillLoss(pm);
                    }
                }
            }

            if (m_Controller.IsT2AZone)
            {
                m.IsT2A = true;
                if (m.Mounted)
                {
                    BaseMount.Dismount(m);
                    m.SendMessage(61, "You may not ride mounts in this area.");
                }

                if (m is PlayerMobile)
                {
                    m.SendMessage(61, "This is a T2A zone.  If you have a template enabled, it will be applied now.");
                    PvPTemplates.PvPTemplates.FetchProfile(m as PlayerMobile).ApplyDelta(false);
                }
            }

            base.OnEnter(m);
        }
예제 #5
0
        public override bool OnMoveOver(Mobile m)
        {
            if (m.LegsArmor != null && m.LegsArmor is PlateLegs)
            {
                m.SendMessage("The caltrops have no effect on you...");
            }
            else if (m.Mounted)
            {
                if (Utility.RandomBool())
                {
                    BaseMount.Dismount(m);
                    if (m is TeiravonMobile)
                    {
                        TeiravonMobile tm = (TeiravonMobile)m;
                        tm.Dismounted();
                    }

                    m.Emote("*You see {0} is thrown from {1} mount!*", m.Name, m.Female ? "her" : "his");
                    m.SendMessage("Your mount stumbles over the caltrops!");

                    m.Freeze(TimeSpan.FromSeconds(3.0));
                }
                else if (Utility.RandomBool())
                {
                    m.Emote("*You see {0}'s mount stumble, but keep its footing.*", m.Name);

                    m.Freeze(TimeSpan.FromSeconds(1.0));
                }
                else
                {
                    m.Emote("The caltrops have no effect on your mount.");
                }
            }
            else
            {
                if (Utility.RandomBool())
                {
                    m.Freeze(TimeSpan.FromSeconds(1.0));
                }

                m.Stam = (int)(m.Stam * .25);

                m.Emote("*You see {0} stumble over the caltrops!*", m.Name);
            }

            if (Utility.RandomBool())
            {
                Delete();
            }

            return(base.OnMoveOver(m));
        }
예제 #6
0
 public override void OnHit(Mobile attacker, Mobile defender, int damage)
 {
     if (!attacker.Mounted)
     {
         attacker.SendMessage("You must be mounted to use this ability!");
         ClearCurrentAbility(attacker);
         return;
     }
     if (!Validate(attacker) || !CheckMana(attacker, true))
     {
         return;
     }
     ClearCurrentAbility(attacker);
     if (defender.Mounted)
     {
         Mobile mount = defender.Mount as Mobile;
         BaseMount.Dismount(defender);
         int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Chivalry].Value) / 70.0 + 5);
         if (mount != null)
         {
             AOS.Damage(mount, null, amount, 100, 0, 0, 0, 0);
         }
         else
         {
             AOS.Damage(defender, null, amount, 100, 0, 0, 0, 0);
         }
     }
     else
     {
         int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Chivalry].Value) / 70.0 + 5);
         AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);
         if (Server.Items.ParalyzingBlow.IsImmune(defender))
         {
             attacker.SendLocalizedMessage(1070804);
             defender.SendLocalizedMessage(1070813);
         }
         else
         {
             defender.Paralyze(TimeSpan.FromSeconds(4.0));
             Server.Items.ParalyzingBlow.BeginImmunity(defender, Server.Items.ParalyzingBlow.FreezeDelayDuration);
         }
     }
 }
예제 #7
0
        protected override void OnThrownAt(Mobile from, TMobile target)
        {
            base.OnThrownAt(from, target);

            var mounted = target.Mounted;

            if (target is PlayerMobile)
            {
                var pm = target as PlayerMobile;

                pm.SetMountBlock(BlockMountType.Dazed, MountRecovery, mounted);
            }

            if (!mounted)
            {
                return;
            }

            BaseMount.Dismount(target);
            OnTargetDismounted(from, target, true);
        }
예제 #8
0
        protected virtual void OnBeforeThrownAt(Mobile m, TEntity target)
        {
            if (m == null || m.Deleted || target == null || !CanThrowAt(m, target, false))
            {
                return;
            }

            if (m.Spell != null)
            {
                m.Spell.OnCasterUsingObject(this);
            }

            if (DismountUser)
            {
                EtherealMount.StopMounting(m);
            }

            if (ClearHands)
            {
                m.ClearHands();
            }

            if (DismountUser && m.Mounted)
            {
                BaseMount.Dismount(m);
            }

            if ((m.Direction & Direction.Running) != Direction.Running)
            {
                m.Direction = m.GetDirectionTo(target.Location);
            }

            m.Animate(11, 5, 1, true, false, 0);

            if (ThrowSound >= 0)
            {
                m.PlaySound(ThrowSound);
            }
        }
예제 #9
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!defender.Mounted)
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                ClearCurrentAbility(attacker);
                return;
            }

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

            ClearCurrentAbility(attacker);

            if (!attacker.Mounted)
            {
                Mobile mount = defender.Mount as Mobile;
                BaseMount.Dismount(defender);

                if (mount != null)                      //Ethy mounts don't take damage
                {
                    int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 5);

                    AOS.Damage(mount, null, amount, 100, 0, 0, 0, 0);                           //The mount just takes damage, there's no flagging as if it was attacking the mount directly

                    //TODO: Mount prevention until mount healed
                }
            }
            else
            {
                int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 5);

                AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);

                defender.Paralyze(TimeSpan.FromSeconds(3.0));
            }
        }
예제 #10
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);
                // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            /*
             * if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
             * return MorphResult.Fail;
             *
             * On OSI,it seems you can only gain starting at '0' using Animal form.
             */

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            if (!BaseFormTalisman.EntryEnabled(m, entry.Type))
            {
                return(MorphResult.Success);                // Still consumes mana, just no effect
            }

            BaseMount.Dismount(m);

            int bodyMod = entry.BodyMod;
            int hueMod  = entry.HueMod;

            m.BodyMod = bodyMod;
            m.HueMod  = hueMod;

            if (entry.SpeedBoost)
            {
                m.Send(SpeedControl.MountSpeed);
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            SkillMod stealingMod = null;

            if (entry.StealingBonus)
            {
                stealingMod         = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
                stealingMod.ObeyCap = true;
                m.AddSkillMod(stealingMod);
            }

            Timer timer = new AnimalFormTimer(m, bodyMod, hueMod);

            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, stealingMod));
            return(MorphResult.Success);
        }
예제 #11
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.SendLocalizedMessage(1061628);                 // You can't do that while polymorphed.
            }
            else if (TransformationSpellHelper.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1063219);                 // You cannot mimic an animal while in that form.
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || (Caster.IsBodyMod && AnimalForm.GetContext(Caster) == null))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                AnimalFormContext context = AnimalForm.GetContext(Caster);
                int mana = ScaleMana(RequiredMana);

                Ninjitsu.AnimalForm.AddLastAnimalForm(Caster, 16);

                if (mana > Caster.Mana)
                {
                    Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
                }
                else if (context != null)
                {
                    AnimalForm.RemoveContext(Caster, context, true);
                    Caster.Mana -= mana;

                    BuffInfo.RemoveBuff(Caster, BuffIcon.WhiteTigerForm);
                    return;
                }
                else
                {
                    double ninjitsu = Caster.Skills.Ninjitsu.Value;

                    if (ninjitsu < RequiredSkill + 37.5)
                    {
                        double chance = (ninjitsu - RequiredSkill) / 37.5;

                        if (chance < Utility.RandomDouble())
                        {
                            DoFizzle();
                            return;
                        }
                    }
                }

                Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
                Caster.Mana -= mana;

                Caster.CheckSkill(SkillName.Ninjitsu, 0.0, 90.0);

                BaseMount.Dismount(Caster);

                int bodyMod = Caster.Female ? 1255 : 1254;
                int hueMod  = 2500;

                Caster.BodyMod = bodyMod;
                Caster.HueMod  = hueMod;

                Caster.SendSpeedControl(SpeedControlType.MountSpeed);

                Timer timer = new AnimalFormTimer(Caster, bodyMod, hueMod);
                timer.Start();

                int skills = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value + (GetMasteryLevel() * 40)) / 3);

                AnimalForm.AddContext(Caster, new AnimalFormContext(timer, null, true, typeof(WildWhiteTiger), null));
                Caster.CheckStatTimers();

                int bleedMod = (int)(((Caster.Skills[SkillName.Ninjitsu].Value + Caster.Skills[SkillName.Stealth].Value + (GetMasteryLevel() * 40)) / 3) / 10);
                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.WhiteTigerForm, 1155911, 1156060, String.Format("{0}\t{1}\t{2}\t{3}", "20", "5", "", bleedMod.ToString())));
                // +~1_ARG~ Defense Chance Increase.<br>+~2_ARG~ Max Defense Chance Increase Cap.<br> Chance to evade attacks.<br>Applies bleed to victim with a max damage of ~4_ARG~.

                Caster.Delta(MobileDelta.WeaponDamage);
            }

            FinishSequence();
        }
예제 #12
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             // On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            double minSkill = entry.ReqSkill - 12.5;
            double maxSkill = entry.ReqSkill + 37.5;

            if (!m.CheckSkill(SkillName.Ninjitsu, minSkill, maxSkill))
            {
                return(MorphResult.Fail);
            }

            BaseMount.Dismount(m);

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod >= 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.ForcedRun = true;
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            #region Heritage Items

            /*
             * else if ( entry.StealingBonus )
             * {
             *      mod = new DefaultSkillMod( SkillName.Stealing, true, 10.0 );
             *      mod.ObeyCap = true;
             *      m.AddSkillMod( mod );
             * }
             */
            #endregion

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, m.HueMod);
            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type));

            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x7F3);

            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.AnimalForm, 1075822, 1075823, String.Format("{0}\t{1}", entry.ArticleCliloc, entry.FormCliloc)));

            m.Target = null;

            return(MorphResult.Success);
        }
예제 #13
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!defender.Mounted && !defender.Flying && (!Core.ML || !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)
            {
                IMount mount = defender.Mount;

                if (mount != null || defender.Flying || (Core.ML && Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(defender)))
                {
                    BaseMount.Dismount(defender);

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

                        if (!m_MountPrevented.Contains((Mobile)mount))
                        {
                            m_MountPrevented.Add((Mobile)mount);
                        }
                    }
                    else
                    {
                        AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);
                    }

                    attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount!

                    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);
                }
            }
        }
예제 #14
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            BaseMount.Dismount(m);

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod > 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.Send(SpeedBoost.Instantiate(true));
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, entry.HueMod);

            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type));
            return(MorphResult.Success);
        }
예제 #15
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                //Close bank box on steal attempt -Adam
                BankBox box = m_Thief.FindBankNoCreate();

                if (box != null && box.Opened)
                {
                    box.Close();
                    m_Thief.Send(new MobileUpdate(m_Thief));
                }

                Item stolen = null;

                object root = toSteal.RootParent;

                var contParent = toSteal.Parent as Container;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                BaseAddon addon = null;

                if (toSteal is AddonComponent)
                {
                    addon = ((AddonComponent)toSteal).Addon;
                }

                bool stealflag = (addon != null && addon.GetSavedFlag(ItemFlags.StealableFlag)) ||
                                 toSteal.GetSavedFlag(ItemFlags.StealableFlag);

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                     // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                     // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                     // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                     // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                     // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                     // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                     // Your backpack can't hold anything else.
                }
                #region Sigils
                else if (toSteal is Sigil)
                {
                    PlayerState pl      = PlayerState.Find(m_Thief);
                    Faction     faction = (pl == null ? null : pl.Faction);

                    var sig = (Sigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703);  // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                     // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710);  // You can't steal that!
                    }
                    else if (faction != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581);                             //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583);                             //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582);                             //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                             // You cannot steal the sigil while in that form.
                        }
                        else if (m_Thief is PlayerMobile && ((PlayerMobile)m_Thief).SavagePaintExpiration > TimeSpan.Zero)
                        {
                            m_Thief.SendLocalizedMessage(1114352);                             // You cannot steal the sigil while disguised in savage paint.
                        }
                        else if (pl.IsLeaving)
                        {
                            m_Thief.SendLocalizedMessage(1005589);                             // You are currently quitting a faction and cannot steal the town sigil
                        }
                        else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
                        {
                            m_Thief.SendLocalizedMessage(1005590);                             //	You cannot steal your own sigil
                        }
                        else if (sig.IsPurifying)
                        {
                            m_Thief.SendLocalizedMessage(1005592);                             // You cannot steal this sigil until it has been purified
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 0.0, 0.0))
                        {
                            if (Sigil.ExistsOn(m_Thief))
                            {
                                m_Thief.SendLocalizedMessage(1010258);
                                //	The sigil has gone back to its home location because you already have a sigil.
                            }
                            else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259);                                 //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                if (sig.IsBeingCorrupted)
                                {
                                    sig.GraceStart = DateTime.UtcNow;                                     // begin grace period
                                }

                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                    sig.LastStolen         = DateTime.UtcNow;
                                }

                                switch (PvPController._SigilAnnounceStolen)
                                {
                                case PvPController.SigilStolenAnnouncing.All:
                                {
                                    foreach (Faction factionToBCast in Faction.Factions)
                                    {
                                        List <PlayerState> members = factionToBCast.Members;

                                        if (sig.Corrupted != null)
                                        {
                                            if (sig.Corrupted == factionToBCast)
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName);
                                                }
                                            }
                                            else
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from the {2} stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName,
                                                        sig.Corrupted.Definition.FriendlyName);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            foreach (PlayerState member in members)
                                            {
                                                member.Mobile.SendMessage(
                                                    factionToBCast.Definition.HueBroadcast,
                                                    "The {0} have stolen the {1} sigil!",
                                                    faction.Definition.FriendlyName,
                                                    sig.Town.Definition.FriendlyName);
                                            }
                                        }
                                    }
                                }
                                break;

                                case PvPController.SigilStolenAnnouncing.Owner:
                                {
                                    if (sig.Corrupted != null)
                                    {
                                        List <PlayerState> members = sig.Corrupted.Members;

                                        foreach (PlayerState member in members)
                                        {
                                            member.Mobile.SendMessage(
                                                sig.Corrupted.Definition.HueBroadcast,
                                                "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                faction.Definition.FriendlyName,
                                                sig.Town.Definition.FriendlyName);
                                        }
                                    }
                                }
                                break;
                                }

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594);                             //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1005588);                         //	You must join a faction to do that
                    }
                }
                #endregion

                else if (!stealflag && si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) &&
                         !(toSteal.RootParent is FillableContainer) && !stealflag)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is Spellbook)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal.Nontransferable)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.EraAOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is IEthicsItem && ((IEthicsItem)toSteal).EthicsItemState != null &&
                         !((IEthicsItem)toSteal).EthicsItemState.HasExpired)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                     // You must be standing next to an item to steal it.
                }
                // Alan: commented this out b/c there shouldn't be a required skill level to steal stealflag stuff
                //else if ( ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) || ( stealflag ) && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) ) //&& m_Thief.Skills[SkillName.Stealing].Value < 90.0 ) )
                //	m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item.
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);           // You cannot steal items which are equipped.
                }
                else if (toSteal.GetSavedFlag(0x01))                 //Not lootable item
                {
                    m_Thief.SendLocalizedMessage(502710);            // You can't steal that!
                }
                else if (root == m_Thief || (root is BaseCreature && ((BaseCreature)root).GetMaster() == m_Thief))
                {
                    m_Thief.SendLocalizedMessage(502704);                     // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.Spell != null)
                {
                    m_Thief.SendMessage("You are too busy concentrating on your spell to steal that item.");
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (addon != null)
                    {
                        w = addon.Weight = addon.TotalWeight;
                    }

                    if (w > 10 && !stealflag)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        m_Thief.BeginAction(typeof(Hiding));

                        Timer.DelayCall(TimeSpan.FromSeconds(SpecialMovesController._StealingRehideDelay), ReleaseHideLock, m_Thief);

                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            var maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
                            var minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight);                             //added a min amount

                            if (minAmount < 1)
                            {
                                minAmount = 1;
                            }

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(minAmount, maxAmount);                             //(change from 1, maxamount)

                            if (amount >= toSteal.Amount)
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount) ?? toSteal;
                                }
                            }
                        }
                        else
                        {
                            var iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (stealflag || m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen is PowerScroll)
                        {
                            var  scroll  = (PowerScroll)stolen;
                            bool success = Utility.RandomBool();

                            if (success || Utility.RandomBool())
                            {
                                BaseMount.Dismount(m_Thief);
                                BaseMount.SetMountPrevention(
                                    m_Thief, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(success ? 60.0 : 5.0));
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724); // You successfully steal the item.

                            if (stolen is Head2)
                            {
                                ((Head2)stolen).Owner = m_Thief as PlayerMobile;
                            }

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }

                            if (stealflag)
                            {
                                //toSteal.SetSavedFlag( 0x04, false );
                                // ARTEGORDONMOD
                                // set the taken flag to trigger release from any controlling spawner
                                ItemFlags.SetTaken(stolen, true);
                                // clear the stealable flag so that the item can only be stolen once if it is later locked down.
                                ItemFlags.SetStealable(stolen, false);

                                if (addon != null)                                 //deed it up!
                                {
                                    Item deed = addon.Deed;

                                    addon.Delete();
                                    stolen = deed;
                                }
                                else                                 // release it if it was locked down
                                {
                                    toSteal.Movable = true;
                                }

                                if (toSteal.Spawner != null)                                 //its not spawned anymore, its STOLEN!
                                {
                                    toSteal.Spawner.Remove(toSteal);
                                    toSteal.Spawner = null;
                                }
                            }

                            Conquests.CheckProgress <StealingConquest>(m_Thief as PlayerMobile, toSteal);
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }

                        caught = !stealflag && (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }