Example #1
0
        public void Target(Mobile mobile)
        {
            if (!Caster.CanSee(mobile) || mobile.Hidden)
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (CheckHSequence(mobile))
            {
                SpellHelper.Turn(Caster, mobile);
                SpellHelper.CheckReflect((int)this.Circle, Caster, ref mobile);

                if (mobile.Spell != null)
                {
                    mobile.Spell.OnCasterHurt();
                }

                mobile.Paralyzed = false;

                bool success = false;

                if (CheckMagicResist(mobile) && mobile is PlayerMobile)
                {
                    mobile.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                }
                else
                {
                    ApplyEffect(Caster, mobile);
                    success = true;
                }

                //Player Enhancement Customization: Venomous
                bool venomous = PlayerEnhancementPersistance.IsCustomizationEntryActive(Caster, CustomizationType.Venomous);

                if (venomous)
                {
                    if (success)
                    {
                        CustomizationAbilities.Venomous(mobile);
                    }

                    else
                    {
                        mobile.FixedParticles(0x374A, 10, 15, 5021, 0, 0, EffectLayer.Waist);
                        mobile.PlaySound(0x474);
                    }
                }

                else
                {
                    mobile.FixedParticles(0x374A, 10, 15, 5021, 0, 0, EffectLayer.Waist);
                    mobile.PlaySound(0x474);
                }

                DungeonArmor.PlayerDungeonArmorProfile casterDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(Caster, null);

                if (casterDungeonArmor.MatchingSet && !casterDungeonArmor.InPlayerCombat && mobile is BaseCreature)
                {
                    if (Utility.RandomDouble() <= casterDungeonArmor.DungeonArmorDetail.PoisonSpellNoManaCostChance)
                    {
                        Caster.Mana += 9;
                        Caster.SendMessage("You feel a rush of energy from your armor, fueling mana into the spell.");

                        Effects.PlaySound(Caster.Location, Caster.Map, 0x64B);
                        Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, casterDungeonArmor.DungeonArmorDetail.EffectHue, 0, 5005, 0);
                    }
                }
            }

            FinishSequence();
        }
Example #2
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (BaseBoat.FindBoatAt(p, Caster.Map) != null)
            {
                Caster.SendMessage("That location is blocked.");
            }

            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }

                else if (rx >= 0)
                {
                    eastToWest = true;
                }

                else if (ry >= 0)
                {
                    eastToWest = true;
                }

                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);

                int itemID = eastToWest ? 0x3915 : 0x3922;

                TimeSpan duration = TimeSpan.FromSeconds(3.0 + (Caster.Skills[SkillName.Magery].Value * 0.4));

                bool chargeUsed = false;

                bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, null, EnhancedSpellbookType.Warlock, true, true);

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);

                    InternalItem item = new InternalItem(itemID, loc, Caster, Caster.Map, duration, i);

                    if (enhancedSpellcast)
                    {
                        item.m_Enhanced = true;
                    }
                }

                DungeonArmor.PlayerDungeonArmorProfile casterDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(Caster, null);

                if (casterDungeonArmor.MatchingSet && !casterDungeonArmor.InPlayerCombat)
                {
                    if (Utility.RandomDouble() <= casterDungeonArmor.DungeonArmorDetail.PoisonSpellNoManaCostChance)
                    {
                        Caster.Mana += 15;
                        Caster.SendMessage("You feel a rush of energy from your armor, fueling mana into the spell.");

                        Effects.PlaySound(Caster.Location, Caster.Map, 0x64B);
                        Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, casterDungeonArmor.DungeonArmorDetail.EffectHue, 0, 5005, 0);
                    }
                }
            }

            FinishSequence();
        }
Example #3
0
        public static TimeSpan OnUse(Mobile mobile)
        {
            PlayerMobile pm = mobile as PlayerMobile;

            if (pm != null)
            {
                if (pm.TrueHidden == false)
                {
                    pm.SendMessage("You must hide first using the Hiding skill.");
                    pm.RevealingAction();

                    return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
                }
            }

            if (!mobile.Hidden)
            {
                mobile.SendLocalizedMessage(502725); // You must hide first
            }
            else if (mobile.Skills[SkillName.Hiding].Base < HidingRequirement)
            {
                mobile.SendLocalizedMessage(502726); // You are not hidden well enough.  Become better at hiding.
                mobile.RevealingAction();
            }

            else if (!mobile.CanBeginAction(typeof(Stealth)))
            {
                mobile.RevealingAction();
            }

            else
            {
                if (mobile.CheckSkill(SkillName.Stealth, 0, 100, 1.0))
                {
                    int steps = (int)(mobile.Skills[SkillName.Stealth].Value / 10);

                    BaseArmor gorget = mobile.NeckArmor as BaseArmor;
                    BaseArmor gloves = mobile.HandArmor as BaseArmor;
                    BaseArmor arms   = mobile.ArmsArmor as BaseArmor;
                    BaseArmor head   = mobile.HeadArmor as BaseArmor;
                    BaseArmor legs   = mobile.LegsArmor as BaseArmor;
                    BaseArmor chest  = mobile.ChestArmor as BaseArmor;

                    List <BaseArmor> equipment = new List <BaseArmor>();

                    equipment.Add(gorget);
                    equipment.Add(gloves);
                    equipment.Add(arms);
                    equipment.Add(head);
                    equipment.Add(legs);
                    equipment.Add(chest);

                    //Each Piece of Armor that Has a Meditation Penalty Reduces Total Stealth Steps By 1
                    foreach (BaseArmor armor in equipment)
                    {
                        if (armor != null)
                        {
                            if (armor.OldMedAllowance == ArmorMeditationAllowance.None)
                            {
                                steps--;
                            }
                        }
                    }

                    DungeonArmor.PlayerDungeonArmorProfile stealtherDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(mobile, null);

                    if (stealtherDungeonArmor.MatchingSet && !stealtherDungeonArmor.InPlayerCombat)
                    {
                        steps += 6 + stealtherDungeonArmor.DungeonArmorDetail.BonusStealthSteps;
                    }

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

                    mobile.AllowedStealthSteps = steps;

                    if (pm != null)
                    {
                        pm.IsStealthing = true;

                        if (pm.Skills[SkillName.Hiding].Value >= 80 && pm.Skills[SkillName.Stealth].Value >= 80)
                        {
                            mobile.StealthAttackReady = true;
                        }
                    }

                    mobile.SendMessage("You begin to move quietly.");

                    mobile.BeginAction((typeof(Hiding)));
                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Hiding)); });

                    mobile.BeginAction((typeof(Stealth)));
                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Stealth)); });

                    mobile.m_StealthMovementTimer = null;
                    mobile.m_StealthMovementTimer = new Mobile.StealthMovementTimer(mobile);
                    mobile.m_StealthMovementTimer.Start();

                    mobile.m_HidingTimer = null;
                    mobile.m_HidingTimer = new Mobile.HidingTimer(mobile, DateTime.UtcNow, true);
                    mobile.m_HidingTimer.Start();

                    return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
                }

                else
                {
                    mobile.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed.
                    mobile.RevealingAction();
                }
            }

            return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
        }
Example #4
0
        public static double GetArmorOffset(Mobile from)
        {
            double fullMeditationScalar = 1.0; //Full Meditation
            double noMeditationScalar   = 4.0; //No Meditation is 4x Slower than Full Meditation (Half Meditation is 2x Slower)

            double effectiveMeditationScalar = 1.0;

            double armorPenaltyPercent = 0;

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return(effectiveMeditationScalar);
            }

            DungeonArmor.PlayerDungeonArmorProfile playerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(player, null);

            //Player Is Wearing Dungeon Armor
            if (playerDungeonArmor.MatchingSet)
            {
                switch (playerDungeonArmor.DungeonArmorDetail.MeditationAllowance)
                {
                case ArmorMeditationAllowance.All: armorPenaltyPercent = 0; break;

                case ArmorMeditationAllowance.ThreeQuarter: armorPenaltyPercent = .25; break; break;

                case ArmorMeditationAllowance.Half: armorPenaltyPercent = .5; break;

                case ArmorMeditationAllowance.Quarter: armorPenaltyPercent = .75; break;

                case ArmorMeditationAllowance.None: armorPenaltyPercent = 1.0; break;
                }
            }

            else
            {
                //m_ArmorScalars = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 };
                //Each Layer of Armor Has Different "Effect Amount" on How Much It Can Penalize Meditation
                armorPenaltyPercent += GetArmorMeditationValue(from.NeckArmor as BaseArmor) * BaseArmor.ArmorScalars[0];
                armorPenaltyPercent += GetArmorMeditationValue(from.HandArmor as BaseArmor) * BaseArmor.ArmorScalars[1];
                armorPenaltyPercent += GetArmorMeditationValue(from.HeadArmor as BaseArmor) * BaseArmor.ArmorScalars[2];
                armorPenaltyPercent += GetArmorMeditationValue(from.ArmsArmor as BaseArmor) * BaseArmor.ArmorScalars[3];
                armorPenaltyPercent += GetArmorMeditationValue(from.LegsArmor as BaseArmor) * BaseArmor.ArmorScalars[4];
                armorPenaltyPercent += GetArmorMeditationValue(from.ChestArmor as BaseArmor) * BaseArmor.ArmorScalars[5];
            }

            armorPenaltyPercent += GetArmorMeditationValue(from.ShieldArmor as BaseArmor) * .25;

            if (armorPenaltyPercent > 1.0)
            {
                armorPenaltyPercent = 1.0;
            }

            effectiveMeditationScalar = 4.0 * armorPenaltyPercent;

            if (effectiveMeditationScalar < fullMeditationScalar)
            {
                effectiveMeditationScalar = fullMeditationScalar;
            }

            if (effectiveMeditationScalar > noMeditationScalar)
            {
                effectiveMeditationScalar = noMeditationScalar;
            }

            return(effectiveMeditationScalar);
        }
Example #5
0
        public static void DoBreathAttack(BreathAttackType breathType, BaseCreature creature, Mobile target)
        {
            if (!SpecialAbilities.Exists(creature))
            {
                return;
            }
            if (!SpecialAbilities.Exists(target))
            {
                return;
            }
            if (!creature.CanBeHarmful(target))
            {
                return;
            }

            creature.DoHarmful(target);
            creature.Direction = creature.GetDirectionTo(target);

            if (creature.IsHighSeasBodyType)
            {
                creature.Animate(Utility.RandomList(27), 5, 1, true, false, 0);
            }
            else
            {
                creature.Animate(12, 5, 1, true, false, 0);
            }

            SpecialAbilities.HinderSpecialAbility(1.0, null, creature, 1.0, 1.5, true, 0, false, "", "", "-1");

            Timer.DelayCall(TimeSpan.FromSeconds(1.3), delegate
            {
                if (!SpecialAbilities.Exists(creature))
                {
                    return;
                }

                switch (breathType)
                {
                case BreathAttackType.Fire:
                    Effects.PlaySound(creature.Location, creature.Map, 0x227);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 0, 0);
                    break;

                case BreathAttackType.Ice:
                    Effects.PlaySound(creature.Location, creature.Map, 0x64F);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 1153, 0);
                    break;

                case BreathAttackType.Poison:
                    Effects.PlaySound(creature.Location, creature.Map, 0x22F);
                    Effects.SendMovingEffect(creature, target, 0x372A, 10, 0, false, false, 2208, 0);
                    break;
                }

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
                {
                    if (creature == null)
                    {
                        return;
                    }

                    if (creature.CanBeHarmful(target))
                    {
                        double baseDamage = (double)creature.DamageMax;

                        if (creature.Controlled && creature.ControlMaster is PlayerMobile)
                        {
                            if (target is PlayerMobile)
                            {
                                baseDamage *= BaseCreature.BreathDamageToPlayerScalar * creature.PvPAbilityDamageScalar;
                            }

                            if (target is BaseCreature)
                            {
                                baseDamage *= BaseCreature.BreathDamageToCreatureScalar;
                            }
                        }

                        DungeonArmor.PlayerDungeonArmorProfile defenderDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(target, null);

                        if (defenderDungeonArmor.MatchingSet && !defenderDungeonArmor.InPlayerCombat)
                        {
                            baseDamage *= defenderDungeonArmor.DungeonArmorDetail.BreathDamageReceivedScalar;
                        }

                        switch (breathType)
                        {
                        case BreathAttackType.Fire:
                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 20, 5029);
                            break;

                        case BreathAttackType.Ice:
                            baseDamage = (double)creature.DamageMax * .75;

                            if (target is PlayerMobile)
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .05, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }
                            else
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .10, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0);
                            break;

                        case BreathAttackType.Poison:
                            baseDamage = (double)creature.DamageMax * .5;

                            int poisonLevel = 0;

                            if (creature.HitPoison != null)
                            {
                                poisonLevel = creature.HitPoison.Level;
                            }

                            double poisonChance = 1.0;

                            if (creature.IsControlledCreature())
                            {
                                if (target is PlayerMobile)
                                {
                                    poisonChance = .5;
                                    poisonLevel--;
                                }

                                if (target is BaseCreature)
                                {
                                    BaseCreature bc_Target = target as BaseCreature;

                                    if (bc_Target.IsControlledCreature())
                                    {
                                        poisonChance = .5;
                                        poisonLevel--;
                                    }
                                }
                            }

                            if (poisonLevel < 0)
                            {
                                poisonLevel = 0;
                            }

                            int poisonHue = 2208;

                            poisonHue += poisonLevel;

                            if (Utility.RandomDouble() <= poisonChance)
                            {
                                Poison poison = Poison.GetPoison(poisonLevel);
                                target.ApplyPoison(target, poison);
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x22F);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x372A, 10, 20, poisonHue, 0, 5029, 0);
                            break;
                        }

                        int finalDamage = (int)baseDamage;

                        if (target != null)
                        {
                            AOS.Damage(target, creature, finalDamage, 100, 0, 0, 0, 0);
                        }
                    }
                });
            });
        }
Example #6
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is BaseCreature)
                {
                    BaseCreature bc_Target = target as BaseCreature;

                    if (from.CanBeHarmful(bc_Target, true))
                    {
                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendMessage("You struggle with basic musicianship and your song has no effect.");
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            return;
                        }

                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Discordance].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        double   successChance  = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);
                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Discordance, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            from.DoHarmful(bc_Target, true);

                            from.SendMessage("You play successfully, disrupting your opponent's skills and weakening them significantly.");
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double discordanceModifier = BaseInstrument.DiscordanceModifier;

                            DungeonArmor.PlayerDungeonArmorProfile bardDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(from, null);

                            if (bardDungeonArmor.MatchingSet && !bardDungeonArmor.InPlayerCombat)
                            {
                                discordanceModifier += bardDungeonArmor.DungeonArmorDetail.DiscordanceEffectBonus;
                            }

                            DiscordanceInfo info = new DiscordanceInfo(from, bc_Target, discordanceModifier);

                            //TEST
                            from.Say("Discord Duration: " + effectDuration.ToString());

                            info.m_Duration = effectDuration;
                            info.m_EndTime  = DateTime.UtcNow + effectDuration;
                            info.m_Timer    = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info);

                            Discordance.InsertDiscordanceInfo(bc_Target, info);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceSuccessCooldown * 1000);

                            bc_Target.NextBardingEffectAllowed = DateTime.UtcNow + bc_Target.BardingEffectCooldown;
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Discordance);

                            from.SendMessage(failureMessage);
                        }
                    }

                    else
                    {
                        return;
                    }
                }

                else
                {
                    from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that.
                }
            }
Example #7
0
            protected override void OnTick()
            {
                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                double damage;

                damage = 1 + ((double)m_Mobile.HitsMax * m_Poison.m_Scalar);

                double minimum = m_Poison.m_Minimum;
                double maximum = m_Poison.m_Maximum;

                PlayerMobile pm_From = m_From as PlayerMobile;
                BaseCreature bc_From = m_From as BaseCreature;

                PlayerMobile pm_Target = m_Mobile as PlayerMobile;
                BaseCreature bc_Target = m_Mobile as BaseCreature;

                if (bc_Target != null)
                {
                    bc_Target.m_TakenDamageFromPoison = true;
                }

                if (pm_From != null && bc_Target != null)
                {
                    double poisonDamageScalar = 1.0;

                    DungeonArmor.PlayerDungeonArmorProfile poisonerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(pm_From, null);

                    if (poisonerDungeonArmor.MatchingSet && !poisonerDungeonArmor.InPlayerCombat)
                    {
                        poisonDamageScalar = poisonerDungeonArmor.DungeonArmorDetail.PoisonDamageInflictedScalar;
                    }

                    minimum = (double)minimum * 1.5 * poisonDamageScalar;
                    maximum = (double)maximum * 1.5 * poisonDamageScalar;
                }

                if (bc_From != null && pm_Target != null)
                {
                    double poisonDamageScalar = 1.0;

                    DungeonArmor.PlayerDungeonArmorProfile defenderDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(pm_Target, null);

                    if (defenderDungeonArmor.MatchingSet && !defenderDungeonArmor.InPlayerCombat)
                    {
                        poisonDamageScalar = defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                    }

                    if (bc_From.Controlled && bc_From.ControlMaster is PlayerMobile)
                    {
                        minimum = (double)minimum * bc_From.PvPAbilityDamageScalar;
                        maximum = (double)maximum * bc_From.PvPAbilityDamageScalar;
                    }

                    minimum *= defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                    maximum *= defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                }

                if (damage < minimum)
                {
                    damage = minimum;
                }

                else if (damage > maximum)
                {
                    damage = maximum;
                }

                int finalDamage = (int)(Math.Round(damage));

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

                m_LastDamage = finalDamage;

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

                int finalAdjustedDamage = AOS.Damage(m_Mobile, m_From, finalDamage, 0, 0, 0, 100, 0);
                int displayedDamage     = DamageTracker.AdjustDisplayedDamage(m_From, m_Mobile, finalAdjustedDamage);

                if (pm_From != null)
                {
                    DamageTracker.RecordDamage(pm_From, pm_From, m_Mobile, DamageTracker.DamageType.PoisonDamage, displayedDamage);
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Example #8
0
        public virtual bool CheckSequence()
        {
            int mana = ScaleMana(GetMana());

            if (m_Caster.Player)
            {
                Item item = m_Caster.FindItemOnLayer(Layer.OneHanded);

                if (item != null && !(item is Spellbook) && !(item is Runebook))
                {
                    m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate
                    DoFizzle();

                    return(false);
                }

                item = m_Caster.FindItemOnLayer(Layer.TwoHanded);

                if (item != null && !(item is Spellbook) && !(item is Runebook))
                {
                    m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate
                    DoFizzle();

                    return(false);
                }
            }

            if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing)
            {
                DoFizzle();
            }

            else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))))
            {
                DoFizzle();
            }

            else if (!ConsumeReagents())
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell.
            }
            else if (m_Caster.Mana < mana)
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell.
            }
            else if (CheckFizzle())
            {
                //Backlash Effect: Potential to Cancel Spell
                double totalValue = 0;

                BaseCreature bc_Creature = m_Caster as BaseCreature;
                PlayerMobile player      = m_Caster as PlayerMobile;

                double backlashValue = m_Caster.GetSpecialAbilityEntryValue(SpecialAbilityEffect.Backlash);

                if (Utility.RandomDouble() <= backlashValue)
                {
                    DoFizzle();
                    m_Caster.SendMessage("Backlash causes your spell to fizzle.");

                    return(false);
                }

                DungeonArmor.PlayerDungeonArmorProfile casterDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(m_Caster, null);

                if (casterDungeonArmor.MatchingSet && !casterDungeonArmor.InPlayerCombat)
                {
                    if (Utility.RandomDouble() <= casterDungeonArmor.DungeonArmorDetail.ReducedSpellManaCostChance)
                    {
                        mana = (int)(Math.Round((double)mana * casterDungeonArmor.DungeonArmorDetail.ReducedSpellManaCostScalar));
                        Caster.SendMessage("You feel a rush of energy from your armor, fueling mana into the spell.");

                        Effects.PlaySound(Caster.Location, Caster.Map, 0x64B);
                        Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, casterDungeonArmor.DungeonArmorDetail.EffectHue, 0, 5005, 0);
                    }
                }

                m_Caster.Mana -= mana;

                if (m_Scroll is SpellScroll)
                {
                    m_Scroll.Consume();
                }

                else if (m_Scroll is BaseWand)
                {
                    ((BaseWand)m_Scroll).ConsumeCharge(m_Caster);
                    m_Caster.RevealingAction();
                }

                if (m_Scroll is BaseWand)
                {
                    bool m = m_Scroll.Movable;

                    m_Scroll.Movable = false;

                    if (ClearHandsOnCast && m_Caster is PlayerMobile)
                    {
                        m_Caster.ClearHands();
                    }

                    m_Scroll.Movable = m;
                }

                else
                {
                    if (ClearHandsOnCast && m_Caster is PlayerMobile)
                    {
                        m_Caster.ClearHands();
                    }
                }

                int karma = ComputeKarmaAward();

                if (karma != 0)
                {
                    Misc.FameKarmaTitles.AwardKarma(Caster, karma, true);
                }

                return(true);
            }

            else
            {
                DoFizzle();
            }

            return(false);
        }
Example #9
0
        public virtual double GetDamageScalar(Mobile target, double damageBonus)
        {
            PlayerMobile pm_Caster = m_Caster as PlayerMobile;
            BaseCreature bc_Caster = m_Caster as BaseCreature;

            PlayerMobile pm_Target = target as PlayerMobile;
            BaseCreature bc_Target = target as BaseCreature;

            bool PlayerCaster = false;
            bool PlayerTarget = false;

            bool CreatureCaster = false;
            bool CreatureTarget = false;

            bool TamedCaster = false;
            bool TamedTarget = false;

            if (pm_Caster != null)
            {
                PlayerCaster = true;
            }

            if (bc_Caster != null)
            {
                CreatureCaster = true;
            }

            if (pm_Target != null)
            {
                PlayerTarget = true;
            }

            if (bc_Target != null)
            {
                CreatureTarget = true;
            }

            if (CreatureCaster)
            {
                if (bc_Caster.Controlled && bc_Caster.ControlMaster != null)
                {
                    if (bc_Caster.ControlMaster is PlayerMobile)
                    {
                        TamedCaster = true;
                    }
                }
            }

            if (CreatureTarget)
            {
                if (bc_Target.Controlled && bc_Target.ControlMaster != null)
                {
                    if (bc_Target.ControlMaster is PlayerMobile)
                    {
                        TamedTarget = true;
                    }
                }
            }

            DungeonArmor.PlayerDungeonArmorProfile casterDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(m_Caster, null);
            DungeonArmor.PlayerDungeonArmorProfile targetDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(target, null);

            double damageScalar = .75;

            double evalIntBonus              = (m_Caster.Skills[SkillName.EvalInt].Value / 100) * .5;
            double spiritSpeakBonus          = (m_Caster.Skills[SkillName.SpiritSpeak].Value / 100) * .2;
            double inscriptionBonus          = (m_Caster.Skills[SkillName.Inscribe].Value / 100) * .1;
            double slayerBonus               = GetSlayerDamageBonus(target);
            double spellDamageInflictedBonus = 0;
            double spellDamageReceivedBonus  = 0;

            if (casterDungeonArmor.MatchingSet && !casterDungeonArmor.InPlayerCombat)
            {
                spellDamageInflictedBonus = casterDungeonArmor.DungeonArmorDetail.SpellDamageInflictedBonus;
            }

            if (targetDungeonArmor.MatchingSet && !targetDungeonArmor.InPlayerCombat)
            {
                spellDamageReceivedBonus = targetDungeonArmor.DungeonArmorDetail.SpellDamageReceivedBonus;
            }

            m_Caster.CheckSkill(SkillName.SpiritSpeak, 0.0, 120.0, 1.0);

            double targetMagicResist = target.Skills[SkillName.MagicResist].Value;
            double magicResistBonus  = target.GetSpecialAbilityEntryValue(SpecialAbilityEffect.MagicResist);

            //Player vs Player
            if (m_Caster is PlayerMobile && target is PlayerMobile)
            {
                evalIntBonus     *= .5;
                spiritSpeakBonus *= .5;
                inscriptionBonus *= .5;

                slayerBonus = 0;
                spellDamageInflictedBonus = 0;
                damageBonus = 0;

                spellDamageReceivedBonus = 0;

                magicResistBonus = 0;
            }

            damageScalar += evalIntBonus + spiritSpeakBonus + inscriptionBonus + slayerBonus + spellDamageInflictedBonus + damageBonus - spellDamageReceivedBonus;

            targetMagicResist += magicResistBonus;

            //Player Caster
            if (PlayerCaster)
            {
                //Player Target
                if (PlayerTarget)
                {
                    damageScalar *= 1.0;
                }

                //Tamed Target
                else if (TamedTarget)
                {
                    damageScalar *= 2.0;
                }

                //Creature Target
                else
                {
                    damageScalar *= 2.0;
                }
            }

            //Tamed Creature Casting
            else if (TamedCaster)
            {
                //Player Target
                if (PlayerTarget)
                {
                    damageScalar *= 1.0;
                }

                //Tamed Target
                else if (TamedTarget)
                {
                    damageScalar *= 2.0;
                }

                //Creature Target
                else
                {
                    damageScalar *= 2.0;
                }
            }

            else //Normal Creature Casting
            {
                //Player Target
                if (PlayerTarget)
                {
                    damageScalar *= 1;
                }

                //Tamed Target
                else if (TamedTarget)
                {
                    damageScalar *= 2.0;
                }

                //Creature Target
                else
                {
                    damageScalar *= 2.0;
                }
            }

            if (CreatureTarget)
            {
                bc_Target.AlterDamageScalarFrom(m_Caster, ref damageScalar);
            }

            if (CreatureCaster)
            {
                bc_Caster.AlterDamageScalarTo(target, ref damageScalar);
            }

            target.Region.SpellDamageScalar(m_Caster, target, ref damageScalar);

            //Magic Resist
            double minDamageReduction = (targetMagicResist * .125) / 100;
            double maxDamageReduction = (targetMagicResist * .25) / 100;

            double magicResistScalar = 1 - (minDamageReduction + ((maxDamageReduction - minDamageReduction) * Utility.RandomDouble()));

            damageScalar *= magicResistScalar;

            if (damageScalar < 0)
            {
                damageScalar = 0;
            }

            return(damageScalar);
        }