public virtual bool Validate(Mobile from)
        {
            if (!from.Player)
            {
                return(true);
            }

            if (AnimalForm.UnderEffect(from))
            {
                from.SendLocalizedMessage(1063218);                    // You cannot use that ability in this form.
                return(false);
            }

            return(CheckSkills(from) && CheckMana(from, false));
        }
Esempio n. 2
0
        public override bool CanEquip(Mobile m)
        {
            if (!base.CanEquip(m))
            {
                return(false);
            }

            if (AnimalForm.UnderEffect(m))
            {
                m.SendLocalizedMessage(1070902);                   // You can't use this while in an animal form!
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1040019);                   // The bola must be in your pack to use it.
            }
            else if (!from.CanBeginAction(typeof(Bola)))
            {
                from.SendLocalizedMessage(1049624);                   // You have to wait a few moments before you can use another bola!
            }
            else if (from.Target is BolaTarget)
            {
                from.SendLocalizedMessage(1049631);                   // This bola is already being used.
            }
            else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
            {
                from.SendLocalizedMessage(1040015);                   // Your hands must be free to use this
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1040016);                   // You cannot use this while riding a mount
            }
            else if (AnimalForm.UnderEffect(from))
            {
                from.SendLocalizedMessage(1070902);                   // You can't use this while in an animal form!
            }
            else
            {
                EtherealMount.StopMounting(from);

                Item one = from.FindItemOnLayer(Layer.OneHanded);
                Item two = from.FindItemOnLayer(Layer.TwoHanded);

                if (one != null)
                {
                    from.Backpack.DropItem(one);
                }

                if (two != null)
                {
                    from.Backpack.DropItem(two);
                }

                from.Target = new BolaTarget(this);
                from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1049632);                   // * You begin to swing the bola...*
                from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name);     // ~1_NAME~ begins to menacingly swing a bola...
            }
        }
Esempio n. 4
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);
        }
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;

            if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!m_Caster.CheckAlive())
            {
                return(false);
            }
            else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(this is Shadowjump || this is MirrorImage || this is AnimalForm) && AnimalForm.UnderEffect(m_Caster))
            {
                // TODO: Revealing action and mantra should be before this ( at least for palading spell)
                if (this is PaladinSpell)
                {
                    m_Caster.SendLocalizedMessage(1063218);                       // You cannot use that ability in this form.
                }
                else if (this is SamuraiSpell)
                {
                    if (this is MomentumStrike || this is LightningStrike || this is HonorableExecution)
                    {
                        m_Caster.SendLocalizedMessage(1063024);                           // You cannot perform this special move right now.
                    }
                    else
                    {
                        m_Caster.SendLocalizedMessage(1063218);                           // You cannot use that ability in this form.
                    }
                }
                else if (this is NinjaSpell)
                {
                    m_Caster.SendLocalizedMessage(1063024);                       // You cannot perform this special move right now.
                }
                else
                {
                    m_Caster.SendLocalizedMessage(1061091);                       // You cannot cast that spell in this form.
                }
            }
            else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendLocalizedMessage(502643);                   // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime)
            {
                m_Caster.SendLocalizedMessage(502644);                   // You must wait for that spell to have an effect.
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    m_State        = SpellState.Casting;
                    m_Caster.Spell = this;

                    if (RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    if (m_Caster.Body.IsHuman)
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (m_Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (m_Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana
            }

            return(false);
        }
Esempio n. 6
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

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

                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 || (!toSteal.Stackable && !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);

                    Sigil 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 (DisguiseGump.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 (TransformationSpell.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                               // You cannot steal the sigil while in that form.
                        }
                        else if (AnimalForm.UnderEffect(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1063222);                               // You cannot steal the sigil while mimicking an animal.
                        }
                        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, 80.0, 80.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.Now;                                     // begin grace period
                                }

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

                                if (sig.LastMonolith != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                }

                                sig.LastStolen = DateTime.Now;

                                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 (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) && !(root is FillableContainer)))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && toSteal is Container && si == null)
                {
                    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.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.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 equiped.
                }
                else if (root == 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))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

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

                            int amount = Utility.RandomMinMax(1, maxAmount);

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

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    if (!m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                                    {
                                        m_Thief.SendLocalizedMessage(1048147);                                           // Your backpack can't hold anything else.
                                    }
                                    else
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal.Dupe(amount);

                                    if (toSteal.Cheater_Name != null)
                                    {
                                        stolen.Cheater_Name = toSteal.Cheater_Name;
                                    }

                                    if (!m_Thief.Backpack.CheckHold(m_Thief, stolen, false, true))
                                    {
                                        stolen.Delete();
                                        stolen = null;
                                        m_Thief.SendLocalizedMessage(1048147);                                           // Your backpack can't hold anything else.
                                    }
                                    else
                                    {
                                        toSteal.Amount -= amount;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

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

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

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                               // You fail to steal the item.
                        }

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

                return(stolen);
            }
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (attacker.Mounted && !(defender.Weapon is Lance))               // TODO: Should there be a message here?
            {
                return;
            }

            ClearCurrentAbility(attacker);

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

            if (AnimalForm.UnderEffect(attacker))
            {
                attacker.SendLocalizedMessage(1070902);                   // You can't use this while in an animal form!
                return;
            }

            IMount mount = defender.Mount;

            if (mount == null)
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                return;
            }

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

            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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }