Example #1
0
        private static bool CanChange(PlayerMobile from, Race targetRace)
        {
            if (from.Deleted)
            {
                return(false);
            }

            if (from.Race == targetRace)
            {
                from.SendLocalizedMessage(1111918); // You are already that race.
            }
            else if (!MondainsLegacy.CheckML(from, false))
            {
                from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding...
            }
            else if (!from.Alive)
            {
                from.SendLocalizedMessage(1073646); // Only the living may proceed...
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1073647); // You may not continue while mounted...
            }
            else if (!from.CanBeginAction <PolymorphSpell>() || DisguiseTimers.IsDisguised(from) ||
                     AnimalForm.UnderTransformation(from) || !from.CanBeginAction <IncognitoSpell>() ||
                     from.IsBodyMod)                // TODO: Does this cover everything?
            {
                from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
            }
            else if (from.Spell?.IsCasting == true)
            {
                from.SendLocalizedMessage(1073649); // One may not proceed while embracing magic...
            }
            else if (from.Poisoned)
            {
                from.SendLocalizedMessage(1073652); // You must be healthy to proceed...
            }
            else if (IsWearingEquipment(from))
            {
                from.SendLocalizedMessage(1073650); // To proceed you must be unburdened by equipment...
            }
            else
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
            }
            else if (!from.CanBeginAction(typeof(Bola)))
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1049624, from.NetState); // // You have to wait a few moments before you can use another bola!
            }
            else if (from.Target is BolaTarget)
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1049631, from.NetState); // This bola is already being used.
            }
            else if (from.Mounted)
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1042053, from.NetState); // You can't use this while on a mount!
            }
            else if (from.Flying)
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1113414, from.NetState); // You can't use this while flying!
            }
            else if (AnimalForm.UnderTransformation(from))
            {
                PrivateOverheadMessage(MessageType.Regular, 946, 1070902, from.NetState); // 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.AddToBackpack(one);
                }

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

                from.Target = new BolaTarget(this);
                from.LocalOverheadMessage(MessageType.Emote, 201, 1049632);               // * You begin to swing the bola...*
                from.NonlocalOverheadMessage(MessageType.Emote, 201, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola...
            }
        }
Example #3
0
        private static void FinishThrow(Mobile from, Mobile to)
        {
            if (Core.AOS)
            {
                new Bola().MoveToWorld(to.Location, to.Map);
            }

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

            var mt = to.Mount;

            if (mt != null && !(to is ChaosDragoon or ChaosDragoonElite))
            {
                mt.Rider = null;
            }

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

                mobile.SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(Core.ML ? 10 : 3), true);
            }

            if (Core.AOS) /* only failsafe, attacker should already be dismounted */
            {
                (from as PlayerMobile)?.SetMountBlock(
                    BlockMountType.BolaRecovery,
                    TimeSpan.FromSeconds(Core.ML ? 10 : 3),
                    true
                    );
            }

            to.Damage(1);

            Timer.StartTimer(TimeSpan.FromSeconds(2.0), from.EndAction <Bola>);
        }
Example #4
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
        })
Example #5
0
    public override void OnHit(Mobile attacker, Mobile defender, int damage)
    {
        if (!Validate(attacker) || !CheckMana(attacker, true))
        {
            return;
        }

        if (defender is ChaosDragoon or ChaosDragoonElite)
        {
            return;
        }

        if (attacker.Mounted || attacker.Flying)
        {
            if (attacker.Weapon is not Lance || !defender.Mounted && !defender.Flying && defender.Weapon is not Lance)
            {
                attacker.SendLocalizedMessage(1061283); // You cannot perform that attack while mounted!
            }
        }

        ClearCurrentAbility(attacker);

        var mount = defender.Mount;

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

        if (Core.ML && attacker is LesserHiryu && Utility.RandomDouble() <= 0.8)
        {
            return; // Lesser Hiryu have an 80% chance of missing this attack
        }

        DoDismount(attacker, defender, TimeSpan.FromSeconds(10));

        if (!attacker.Mounted)
        {
            AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
        }
    }
Example #6
0
        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 && (!Core.ML || !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 (CheckHit(to, from))
                {
                    to.Damage(Utility.RandomMinMax(10, 20), from);
                    //    Dismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                    Server.Items.Dismount.DoDismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                }
            }
        }
Example #7
0
        public static bool CheckCast(Mobile caster, Spell spell)
        {
            if (Factions.Sigil.ExistsOn(caster))
            {
                caster.SendLocalizedMessage(1061632);                   // You can't do that while carrying the sigil.
                return(false);
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                caster.SendLocalizedMessage(1061628);                   // You can't do that while polymorphed.
                return(false);
            }
            else if (AnimalForm.UnderTransformation(caster))
            {
                caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
                return(false);
            }

            return(true);
        }
Example #8
0
    public void SwapToAnimalNumber(int index)
    {
        GameObject chosenAnimalPrefab = null;

        if (index < _equippedAnimalsPrefabs.Length)
        {
            chosenAnimalPrefab = _equippedAnimalsPrefabs[index];
        }
        if (chosenAnimalPrefab != null)
        {
            AnimalForm chosenAnimalForm = (AnimalForm)Enum.Parse(typeof(AnimalForm), chosenAnimalPrefab.name);
            if (_currentAnimalIdentifier == chosenAnimalForm)
            {
                return;
            }
            DestroyCurrentForm();
            _currentPlayerForm       = Instantiate(chosenAnimalPrefab, _positionBeforeDestroy, Quaternion.identity);
            _currentAnimalIdentifier = chosenAnimalForm;
        }
    }
Example #9
0
        public virtual bool Validate(Mobile from)
        {
            if (!from.Player)
            {
                return(true);
            }

            if (HonorableExecution.IsUnderPenalty(from))
            {
                from.SendLocalizedMessage(1063024);                   // You cannot perform this special move right now.
                return(false);
            }

            if (AnimalForm.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1063024);                   // You cannot perform this special move right now.
                return(false);
            }

            return(CheckSkills(from) && CheckMana(from, false));
        }
Example #10
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 <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 (!HasFreeHands(from))
            {
                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.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1070902); // You can't use this while in an animal form!
            }
            else
            {
                EtherealMount.StopMounting(from);

                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...
            }
        }
Example #11
0
        public bool Cast()
        {
            StartCastTime = Core.TickCount;

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

            if (!Caster.CheckAlive())
            {
                return(false);
            }

            if (Scroll is BaseWand && Caster.Spell?.IsCasting == true)
            {
                Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
            }
            else if (Caster.Spell?.IsCasting == true)
            {
                Caster.SendLocalizedMessage(502642); // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast &&
                     TransformationSpellHelper.UnderTransformation(Caster, typeof(HorrificBeastSpell)) ||
                     BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
            }
            else if (!(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen))
            {
                Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && Core.TickCount - Caster.NextSpellTime < 0)
            {
                Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell.
            }
            else if (Caster is PlayerMobile mobile && mobile.PeacedUntil > DateTime.UtcNow)
            {
                mobile.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
            }
Example #12
0
        private static bool CanBegin(Mobile from)
        {
            if (!from.Alive)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019048); // I am dead and cannot do that.
                return(false);
            }

            if (!ClearHands(from))
            {
                return(false);
            }

            if (from.Mounted)
            {
                from.SendLocalizedMessage(1005583);
                return(false);
            }

            if (AnimalForm.UnderTransformation(from))
            {
                return(false);
            }

            if (from.Frozen)
            {
                from.SendLocalizedMessage(500111); // You are frozen and cannot move.
                return(false);
            }

            if (!from.Body.IsHuman)
            {
                return(false);
            }

            from.DisruptiveAction();

            return(true);
        }
Example #13
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (m_Bola.Deleted)
                {
                    return;
                }

                if ((obj is Item))
                {
                    ((Item)obj).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049628, from.NetState); // You have no reason to throw a bola at that.
                    return;
                }

                if (obj is Mobile)
                {
                    Mobile to = (Mobile)obj;

                    if (!m_Bola.IsChildOf(from.Backpack))
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
                    }
                    else if (from.Mounted)
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1042053, from.NetState); // You can't use this while on a mount!
                    }
                    else if (from.Flying)
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1113414, from.NetState); // You can't use this while flying!
                    }
                    else if (from == to)
                    {
                        from.SendLocalizedMessage(1005576); // You can't throw this at yourself.
                    }
                    else if (AnimalForm.UnderTransformation(from))
                    {
                        from.PrivateOverheadMessage(MessageType.Regular, 946, 1070902, from.NetState); // You can't use this while in an animal form!
                    }
                    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 if (!from.CanBeHarmful(to))
                    {
                    }
                    else if (from.BeginAction(typeof(Bola)))
                    {
                        from.RevealingAction();

                        EtherealMount.StopMounting(from);

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

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

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

                        from.DoHarmful(to);

                        BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0));
                        Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseBolaLock), from);
                        Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(FinishThrow), new object[] { from, to, m_Bola });
                    }
                    else
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1049624, from.NetState); // You have to wait a few moments before you can use another bola!
                    }
                }
            }
Example #14
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);
        }
Example #15
0
        public virtual bool Validate(Mobile from)
        {
            if (!from.Player)
            {
                return(true);
            }

            if (HonorableExecution.IsUnderPenalty(from))
            {
                from.SendLocalizedMessage(1063024); // You cannot perform this special move right now.
                return(false);
            }

            if (AnimalForm.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1063024); // You cannot perform this special move right now.
                return(false);
            }

            string option = null;

            if (this is Backstab)
            {
                option = "Backstab";
            }
            else if (this is DeathStrike)
            {
                option = "Death Strike";
            }
            else if (this is FocusAttack)
            {
                option = "Focus Attack";
            }
            else if (this is KiAttack)
            {
                option = "Ki Attack";
            }
            else if (this is SurpriseAttack)
            {
                option = "Surprise Attack";
            }
            else if (this is HonorableExecution)
            {
                option = "Honorable Execution";
            }
            else if (this is LightningStrike)
            {
                option = "Lightning Strike";
            }
            else if (this is MomentumStrike)
            {
                option = "Momentum Strike";
            }

            if (option != null && !DuelContext.AllowSpecialMove(from, option, this))
            {
                return(false);
            }

            return(CheckSkills(from) && CheckMana(from, false));
        }
Example #16
0
            protected override void OnTick()
            {
                if (m_Mobile is NubiaPlayer)
                {
                    if (((NubiaPlayer)m_Mobile).hasDon(DonEnum.CorpDiamant))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* Votre corps est imunisé contre le poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} ne semble pas affecté par le poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Example #17
0
        public static int MobileNotoriety(Mobile source, Mobile target)
        {
            if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier))
            {
                return(Notoriety.Invulnerable);
            }

            if (target.AccessLevel > AccessLevel.Player)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)target;

                Mobile master = bc.GetMaster();

                if (master != null && master.AccessLevel > AccessLevel.Player)
                {
                    return(Notoriety.CanBeAttacked);
                }

                if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType())
                {
                    return(Notoriety.Enemy);
                }
            }

            if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead)))
            {
                return(Notoriety.Murderer);
            }

            if (target.Criminal)
            {
                return(Notoriety.Criminal);
            }

            // XmlPoints challenge mod
            if (XmlPoints.AreTeamMembers(source, target))
            {
                return(Notoriety.Ally);
            }
            else
            if (XmlPoints.AreChallengers(source, target))
            {
                return(Notoriety.Enemy);
            }

            Guild sourceGuild = GetGuildFor(source.Guild as Guild, source);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (sourceGuild != null && targetGuild != null)
            {
                if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild))
                {
                    return(Notoriety.Ally);
                }
                else if (sourceGuild.IsEnemy(targetGuild))
                {
                    return(Notoriety.Enemy);
                }
            }

            Faction srcFaction = Faction.Find(source, true, true);
            Faction trgFaction = Faction.Find(target, true, true);

            if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet)
            {
                return(Notoriety.Enemy);
            }

            if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckHouseFlag(source, target, target.Location, target.Map))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))
            {
                if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) && !AnimalForm.UnderTransformation(target))
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            if (CheckAggressor(source.Aggressors, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckAggressed(source.Aggressed, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (target is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)target;

                if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source)
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            if (source is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)source;

                Mobile master = bc.GetMaster();
                if (master != null && CheckAggressor(master.Aggressors, target))
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            return(Notoriety.Innocent);
        }
Example #18
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 || !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 (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 (AnimalForm.UnderTransformation(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
                        }
                        // jakob, added this to check control points
                        else if (sig.LastMonolith is TownMonolith && !((TownMonolith)sig.LastMonolith).HasAllControlPoints(pl.Faction))
                        {
                            m_Thief.SendMessage("You cannot steal this sigil unless your faction is controlling all control points.");
                        }
                        // end
                        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, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != 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)) && !(toSteal.RootParent is FillableContainer))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    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 || (root is BaseCreature && ((BaseCreature)root).ControlMaster == 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))
                                {
                                    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 = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        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);
            }
Example #19
0
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.SendAsciiMessage("You feel yourself resisting the effects of the poison");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x22, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }



                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                //if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                //    m_Mobile.RevealingAction();

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Example #20
0
        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);
            }
            #region Mondain's Legacy
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced)
            {
                m_Caster.SendLocalizedMessage(1072060);                   // You cannot cast a spell while calmed.
            }
            #endregion
            else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster)))
            {
                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 have not yet recovered from casting a spell.
            }
            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 (ShowHandMovement && 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);
        }
Example #21
0
 private static bool CheckAnimal(Mobile m, Type type) => AnimalForm.UnderTransformation(m, type);
Example #22
0
        public static bool OnCast(Mobile caster, Spell spell)
        {
            ITransformationSpell transformSpell = spell as ITransformationSpell;

            if (transformSpell == null)
            {
                return(false);
            }

            if (Factions.Sigil.ExistsOn(caster))
            {
                caster.SendLocalizedMessage(1061632);                   // You can't do that while carrying the sigil.
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                caster.SendLocalizedMessage(1061628);                   // You can't do that while polymorphed.
            }
            else if (DisguiseTimers.IsDisguised(caster))
            {
                caster.SendLocalizedMessage(1061631);                   // You can't do that while disguised.
                return(false);
            }
            else if (AnimalForm.UnderTransformation(caster))
            {
                caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || (caster.IsBodyMod && GetContext(caster) == null))
            {
                spell.DoFizzle();
            }
            else if (spell.CheckSequence())
            {
                TransformContext context = GetContext(caster);
                Type             ourType = spell.GetType();

                bool wasTransformed = (context != null);
                bool ourTransform   = (wasTransformed && context.Type == ourType);

                if (wasTransformed)
                {
                    RemoveContext(caster, context, ourTransform);

                    if (ourTransform)
                    {
                        caster.PlaySound(0xFA);
                        caster.FixedParticles(0x3728, 1, 13, 5042, EffectLayer.Waist);
                    }
                }

                if (!ourTransform)
                {
                    List <ResistanceMod> mods = new List <ResistanceMod>();

                    if (transformSpell.PhysResistOffset != 0)
                    {
                        mods.Add(new ResistanceMod(ResistanceType.Physical, transformSpell.PhysResistOffset));
                    }

                    if (transformSpell.FireResistOffset != 0)
                    {
                        mods.Add(new ResistanceMod(ResistanceType.Fire, transformSpell.FireResistOffset));
                    }

                    if (transformSpell.ColdResistOffset != 0)
                    {
                        mods.Add(new ResistanceMod(ResistanceType.Cold, transformSpell.ColdResistOffset));
                    }

                    if (transformSpell.PoisResistOffset != 0)
                    {
                        mods.Add(new ResistanceMod(ResistanceType.Poison, transformSpell.PoisResistOffset));
                    }

                    if (transformSpell.NrgyResistOffset != 0)
                    {
                        mods.Add(new ResistanceMod(ResistanceType.Energy, transformSpell.NrgyResistOffset));
                    }

                    if (!((Body)transformSpell.Body).IsHuman)
                    {
                        Mobiles.IMount mt = caster.Mount;

                        if (mt != null)
                        {
                            mt.Rider = null;
                        }
                    }

                    caster.BodyMod = transformSpell.Body;
                    caster.HueMod  = transformSpell.Hue;

                    for (int i = 0; i < mods.Count; ++i)
                    {
                        caster.AddResistanceMod(mods[i]);
                    }

                    transformSpell.DoEffect(caster);

                    Timer timer = new TransformTimer(caster, transformSpell);
                    timer.Start();

                    AddContext(caster, new TransformContext(timer, mods, ourType, transformSpell));
                    return(true);
                }
            }

            return(false);
        }
Example #23
0
        public virtual bool Validate(Mobile from)
        {
            if (!from.Player)
            {
                return(true);
            }

            NetState state = from.NetState;

            if (state == null)
            {
                return(false);
            }

            if (RequiresSE && !state.SupportsExpansion(Expansion.SE))
            {
                from.SendLocalizedMessage(1063456); // You must upgrade to Samurai Empire in order to use that ability.
                return(false);
            }

            if (HonorableExecution.IsUnderPenalty(from) || AnimalForm.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1063024); // You cannot perform this special move right now.
                return(false);
            }

            if (Core.ML && from.Spell != null)
            {
                from.SendLocalizedMessage(1063024); // You cannot perform this special move right now.
                return(false);
            }

            string option = null;

            if (this is ArmorIgnore)
            {
                option = "Armor Ignore";
            }
            else if (this is BleedAttack)
            {
                option = "Bleed Attack";
            }
            else if (this is ConcussionBlow)
            {
                option = "Concussion Blow";
            }
            else if (this is CrushingBlow)
            {
                option = "Crushing Blow";
            }
            else if (this is Disarm)
            {
                option = "Disarm";
            }
            else if (this is Dismount)
            {
                option = "Dismount";
            }
            else if (this is DoubleStrike)
            {
                option = "Double Strike";
            }
            else if (this is InfectiousStrike)
            {
                option = "Infectious Strike";
            }
            else if (this is MortalStrike)
            {
                option = "Mortal Strike";
            }
            else if (this is MovingShot)
            {
                option = "Moving Shot";
            }
            else if (this is ParalyzingBlow)
            {
                option = "Paralyzing Blow";
            }
            else if (this is ShadowStrike)
            {
                option = "Shadow Strike";
            }
            else if (this is WhirlwindAttack)
            {
                option = "Whirlwind Attack";
            }
            else if (this is RidingSwipe)
            {
                option = "Riding Swipe";
            }
            else if (this is FrenziedWhirlwind)
            {
                option = "Frenzied Whirlwind";
            }
            else if (this is Block)
            {
                option = "Block";
            }
            else if (this is DefenseMastery)
            {
                option = "Defense Mastery";
            }
            else if (this is NerveStrike)
            {
                option = "Nerve Strike";
            }
            else if (this is TalonStrike)
            {
                option = "Talon Strike";
            }
            else if (this is Feint)
            {
                option = "Feint";
            }
            else if (this is DualWield)
            {
                option = "Dual Wield";
            }
            else if (this is DoubleShot)
            {
                option = "Double Shot";
            }
            else if (this is ArmorPierce)
            {
                option = "Armor Pierce";
            }

            if (option != null && !DuelContext.AllowSpecialAbility(from, option, true))
            {
                return(false);
            }

            return(CheckSkills(from) && CheckMana(from, false));
        }
Example #24
0
            protected override void OnTick()
            {
                #region Mondain's Legacy
                if ((Core.AOS && m_Poison.RealLevel < 4 &&
                     TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.RealLevel < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(
                            MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(
                            MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }
                #endregion

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                     // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;
                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                #region Mondain's Legacy
                if (Core.ML)
                {
                    if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 &&
                        m_Poison.m_Level <= 13)                         // darkglow
                    {
                        m_From.SendLocalizedMessage(1072850);           // Darkglow poison increases your damage!

                        Stop();

                        new DarkglowTimer(m_Mobile, m_From, m_Poison, m_Index).Start();
                    }

                    if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 &&
                        m_Poison.m_Level <= 18)                         // parasitic
                    {
                        Stop();

                        new ParasiticTimer(m_Mobile, m_From, m_Poison, m_Index).Start();
                    }
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if (0.60 <= Utility.RandomDouble())
                // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Example #25
0
        private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */
        {
            BaseWeapon defWeapon = defender.Weapon as BaseWeapon;

            Skill atkSkill = defender.Skills.Ninjitsu;
            Skill defSkill = defender.Skills[defWeapon.Skill];

            double atSkillValue  = attacker.Skills.Ninjitsu.Value;
            double defSkillValue = defWeapon.GetDefendSkillValue(attacker, defender);

            double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);

            if (defSkillValue <= -20.0)
            {
                defSkillValue = -19.9;
            }

            if (Spells.Chivalry.DivineFurySpell.UnderEffect(attacker))
            {
                attackValue += 10;
            }

            if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) || AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune)))
            {
                attackValue += 20;
            }

            if (HitLower.IsUnderAttackEffect(attacker))
            {
                attackValue -= 25;
            }

            if (attackValue > 45)
            {
                attackValue = 45;
            }

            attackValue = (atSkillValue + 20.0) * (100 + attackValue);

            double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance);

            if (Spells.Chivalry.DivineFurySpell.UnderEffect(defender))
            {
                defenseValue -= 20;
            }

            if (HitLower.IsUnderDefenseEffect(defender))
            {
                defenseValue -= 25;
            }

            int refBonus = 0;

            if (Block.GetBonus(defender, ref refBonus))
            {
                defenseValue += refBonus;
            }

            if (SkillHandlers.Discordance.GetEffect(attacker, ref refBonus))
            {
                defenseValue -= refBonus;
            }

            if (defenseValue > 45)
            {
                defenseValue = 45;
            }

            defenseValue = (defSkillValue + 20.0) * (100 + defenseValue);

            double chance = attackValue / (defenseValue * 2.0);

            if (chance < 0.02)
            {
                chance = 0.02;
            }

            return(attacker.CheckSkill(atkSkill.SkillName, chance));
        }
Example #26
0
        public static bool IsActive(Mobile m)
        {
            AnimalFormContext context = AnimalForm.GetContext(m);

            return(context != null && context.Type == typeof(WildWhiteTiger));
        }
Example #27
0
        public virtual bool Cast()
        {
            m_StartCastTime = Core.TickCount;

            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 is PlayerMobile && ((PlayerMobile)m_Caster).Peaced)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502643);                 // You can not cast a spell while frozen.
            }
            else if (SkillHandlers.SpiritSpeak.IsInSpiritSpeak(m_Caster) || (m_Caster.Spell != null && m_Caster.Spell.IsCasting))
            {
                m_Caster.SendLocalizedMessage(502642);                 // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) ||
                     (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster)))
            {
                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 && Core.TickCount - m_Caster.NextSpellTime < 0)
            {
                m_Caster.SendLocalizedMessage(502644);                 // You have not yet recovered from casting a spell.
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                #region Stygian Abyss
                if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying)
                {
                    if (BaseMount.OnFlightPath(m_Caster))
                    {
                        if (m_Caster.IsPlayer())
                        {
                            m_Caster.SendLocalizedMessage(1113750);                             // You may not cast spells while flying over such precarious terrain.
                            return(false);
                        }
                        else
                        {
                            m_Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain.");
                        }
                    }
                }
                #endregion

                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;

                    Caster.Delta(MobileDelta.Flags);

                    if (!(m_Scroll is BaseWand) && RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    SayMantra();

                    TimeSpan castDelay = GetCastDelay();

                    if (ShowHandMovement && !(m_Scroll is SpellStone) && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
                    {
                        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();
                    }

                    if (Core.ML)
                    {
                        WeaponAbility.ClearCurrentAbility(m_Caster);
                    }

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

                    OnBeginCast();

                    if (castDelay > TimeSpan.Zero)
                    {
                        m_CastTimer.Start();
                    }
                    else
                    {
                        m_CastTimer.Tick();
                    }

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

            return(false);
        }
Example #28
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.BaseDismount(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();
        }
Example #29
0
 public static bool CheckAnimal(Mobile m, Type type)
 {
     return(AnimalForm.UnderTransformation(m, type));
 }
Example #30
0
        public void CheckCancelMorph(Mobile m)
        {
            if (m == null)
            {
                return;
            }

            double minSkill, maxSkill;

            AnimalFormContext acontext = AnimalForm.GetContext(m);
            TransformContext  context  = TransformationSpellHelper.GetContext(m);

            if (context != null)
            {
                Spell spell = context.Spell as Spell;
                spell.GetCastSkills(out minSkill, out maxSkill);
                if (m.Skills[spell.CastSkill].Value < minSkill)
                {
                    TransformationSpellHelper.RemoveContext(m, context, true);
                }
            }
            if (acontext != null)
            {
                int i;
                for (i = 0; i < AnimalForm.Entries.Length; ++i)
                {
                    if (AnimalForm.Entries[i].Type == acontext.Type)
                    {
                        break;
                    }
                }
                if (m.Skills[SkillName.Ninjitsu].Value < AnimalForm.Entries[i].ReqSkill)
                {
                    AnimalForm.RemoveContext(m, true);
                }
            }
            if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1)
            {
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(PolymorphSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
            }
            if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1)
            {
                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).SetHairMods(-1, -1);
                }
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(IncognitoSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
                BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
            }
            return;
        }