Exemplo n.º 1
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            damage = AOS.Scale(damage, 100 + damageBonus);

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Exemplo n.º 2
0
        public void DoHeal(Mobile from)
        {
            int min = Scale(from, MinHeal);
            int max = Scale(from, MaxHeal);

            ArcaneEmpowermentSpell.AddHealBonus(from, ref min);
            ArcaneEmpowermentSpell.AddHealBonus(from, ref max);
            from.Heal(Utility.RandomMinMax(min, max));
        }
Exemplo n.º 3
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar)
        {
            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            TransformContext context = TransformationSpellHelper.GetContext(Caster);

            if (context != null && context.Spell is ReaperFormSpell)
            {
                damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
            }

            damage = AOS.Scale(damage, 100 + damageBonus);

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Exemplo n.º 4
0
            public InternalTimer(Mobile m, Mobile from) : base(TimeSpan.FromSeconds(0.0))
            {
                m_Mobile = m;
                m_From   = from;
                m_loc    = m_Mobile.Location;
                map      = m_Mobile.Map;
                double alchemyBonus = 0;
                double sdi          = 0;
                int    dmgInc       = 0;

                if ((((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned) && ((BaseCreature)from).ControlMaster != null)
                {
                    Mobile master = (((BaseCreature)from).ControlMaster);
                    alchemyBonus = AosAttributes.GetValue(master, AosAttribute.EnhancePotions);
                    sdi          = AosAttributes.GetValue(master, AosAttribute.SpellDamage);
                    dmgInc       = AosAttributes.GetValue(master, AosAttribute.WeaponDamage);
                    //if (alchemyBonus > 50)
                    //    alchemyBonus = 50;
                    sdi += ArcaneEmpowermentSpell.GetSpellBonus(master, false);

                    TransformContext context = TransformationSpellHelper.GetContext(master);

                    if (context != null && context.Spell is ReaperFormSpell)
                    {
                        sdi += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                    }

                    sdi          += (int)(master.Skills.Inscribe.Fixed + (1000 * (int)(master.Skills.Inscribe.Fixed / 100))) / 100;
                    alchemyBonus += master.Skills.Alchemy.Fixed / 330 * 10;
                    sdi          += m.Int / 10;

                    exploDamage = (int)(((master.Skills[SkillName.Alchemy].Value / 2.5)) * (1 + (alchemyBonus + sdi) / 100));
                    minDamage   = (int)master.Skills[SkillName.Carpentry].Value;
                    minDamage  += (int)master.Skills[SkillName.ArmsLore].Value;
                    minDamage  /= 6;
                    minDamage  *= (100 + dmgInc);
                    minDamage  /= 100;
                }
                else
                {
                    minDamage   = 20;
                    exploDamage = 20;
                }
                Priority = TimerPriority.TwoFiftyMS;
            }
Exemplo n.º 5
0
        public static int GetSpellDamage(Mobile m, bool applyCap)
        {
            int bonus = 0;

            bonus += ArcaneEmpowermentSpell.GetSDIBonus(m);

            bonus += ReaperFormSpell.GetSDIBonus(m);

            if (GrapesOfWrath.IsUnderInfluence(m))
            {
                bonus += 15;
            }

            if (PsychicAttack.UnderEffect(m))
            {
                bonus -= 4;
            }

            if (m is PlayerMobile)
            {
                PlayerMobile pm = m as PlayerMobile;

                bonus += m.GetMagicalAttribute(MagicalAttribute.SpellDamage);

                if (applyCap)
                {
                    int cap = IsFocusSkillSpec(m) ? 30 : 15;

                    if (bonus > cap)
                    {
                        bonus = cap;
                    }
                }

                if (pm.Berserk)
                {
                    bonus += 3 * (int)(((float)(m.HitsMax - m.Hits) / m.HitsMax) * 5.0);
                }
            }

            return(bonus);
        }
Exemplo n.º 6
0
        public override Spell GetRandomBuffSpell()
        {
            if (UsesMagery && 0.5 > Utility.RandomDouble())
            {
                return(base.GetRandomBuffSpell());
            }

            int        mana = m_Mobile.Mana;
            BaseWeapon wep  = m_Mobile.Weapon as BaseWeapon;

            if (mana >= 50 && !ArcaneEmpowermentSpell.IsUnderEffects(m_Mobile) && 0.5 >= Utility.RandomDouble())
            {
                return(new ArcaneEmpowermentSpell(m_Mobile, null));
            }
            if (mana >= 32 && wep != null && !ImmolatingWeaponSpell.IsImmolating(m_Mobile, wep))
            {
                return(new ImmolatingWeaponSpell(m_Mobile, null));
            }

            return(null);
        }
Exemplo n.º 7
0
        public override Spell GetRandomBuffSpell()
        {
            BaseWeapon wep   = m_Mobile.Weapon as BaseWeapon;
            int        skill = (int)m_Mobile.Skills[SkillName.Spellweaving].Value;

            if (!GiftOfRenewalSpell.IsUnderEffects(m_Mobile) && 0.33 >= Utility.RandomDouble())
            {
                return(new GiftOfRenewalSpell(m_Mobile, null));
            }
            else if (skill >= 24 && ArcaneEmpowermentSpell.IsUnderEffects(m_Mobile) && 0.33 >= Utility.RandomDouble())
            {
                return(new ArcaneEmpowermentSpell(m_Mobile, null));
            }
            else if (skill >= 10 && wep != null && !(wep is Fists) && !wep.Immolating && 0.33 >= Utility.RandomDouble())
            {
                return(new ImmolatingWeaponSpell(m_Mobile, null));
            }
            else
            {
                return(base.GetRandomBuffSpell());
            }
        }
Exemplo n.º 8
0
            private void SetDamage(int min, int max)
            {
                /*  new way to apply alchemy bonus according to Stratics' calculator.
                 *      this gives a mean to values 25, 50, 75 and 100. Stratics' calculator is outdated.
                 *      Those goals will give 2 to alchemy bonus. It's not really OSI-like but it's an approximation. */

                m_MinDamage = min;
                m_MaxDamage = max;

                if (m_From == null)
                {
                    return;
                }

                int alchemySkill = m_From.Skills.Alchemy.Fixed;
                int alchemyBonus = alchemySkill / 125 + alchemySkill / 250;

                m_MinDamage  = Scale(m_From, m_MinDamage + alchemyBonus);
                m_MaxDamage  = Scale(m_From, m_MaxDamage + alchemyBonus);
                m_MinDamage *= 1 + ArcaneEmpowermentSpell.GetSpellBonus(m_From, false);
                m_MaxDamage *= 1 + ArcaneEmpowermentSpell.GetSpellBonus(m_From, false);
            }
Exemplo n.º 9
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, Mobile target)
        {
            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            if (m_Caster is PlayerMobile && m_Caster.Race == Race.Gargoyle)
            {
                double perc = ((double)m_Caster.Hits / (double)m_Caster.HitsMax) * 100;

                perc  = 100 - perc;
                perc /= 20;

                if (perc > 4)
                {
                    sdiBonus += 12;
                }
                else if (perc >= 3)
                {
                    sdiBonus += 9;
                }
                else if (perc >= 2)
                {
                    sdiBonus += 6;
                }
                else if (perc >= 1)
                {
                    sdiBonus += 3;
                }
            }

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            TransformContext context = TransformationSpellHelper.GetContext(Caster);

            if (context != null && context.Spell is ReaperFormSpell)
            {
                damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
            }

            damage = AOS.Scale(damage, 100 + damageBonus);

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Exemplo n.º 10
0
            public override void OnCast()
            {
                Corpse toChannel = null;

                foreach (Item item in Caster.GetItemsInRange(3))
                {
                    if (item is Corpse && !((Corpse)item).Channeled)
                    {
                        toChannel = (Corpse)item;
                        break;
                    }
                }

                int max, min, mana, number;

                if (toChannel != null)
                {
                    min    = 1 + (int)(Caster.Skills[SkillName.SpiritSpeak].Value * 0.25);
                    max    = min + 4;
                    mana   = 0;
                    number = 1061287;                     // You channel energy from a nearby corpse to heal your wounds.
                }
                else
                {
                    min    = 1 + (int)(Caster.Skills[SkillName.SpiritSpeak].Value * 0.25);
                    max    = min + 4;
                    mana   = 10;
                    number = 1061286;                     // You channel your own spiritual energy to heal your wounds.
                }

                if (Caster.Mana < mana)
                {
                    Caster.SendLocalizedMessage(1061285);                       // You lack the mana required to use this skill.
                }
                else
                {
                    Caster.CheckSkill(SkillName.SpiritSpeak, 0.0, 120.0);

                    if (Utility.RandomDouble() > (Caster.Skills[SkillName.SpiritSpeak].Value / 100.0))
                    {
                        Caster.SendLocalizedMessage(502443);                           // You fail your attempt at contacting the netherworld.
                    }
                    else
                    {
                        if (toChannel != null)
                        {
                            toChannel.Channeled = true;
                            toChannel.Hue       = 0x835;
                        }

                        Caster.Mana -= mana;
                        Caster.SendLocalizedMessage(number);

                        if (min > max)
                        {
                            min = max;
                        }
                        min += (int)Caster.Skills[SkillName.Healing].Value / 15;
                        max += (int)Caster.Skills[SkillName.Healing].Value / 15;
                        ArcaneEmpowermentSpell.AddHealBonus(Caster, ref min);
                        ArcaneEmpowermentSpell.AddHealBonus(Caster, ref max);
                        Caster.Hits += Utility.RandomMinMax(min, max);

                        Caster.FixedParticles(0x375A, 1, 15, 9501, 2100, 4, EffectLayer.Waist);
                    }
                }

                FinishSequence();
            }
Exemplo n.º 11
0
        private void ExplodePunch(Mobile target)
        {
            double alchemyBonus = 0;
            double sdi          = 0;
            int    dmgInc       = 0;
            int    exploDamage  = 20;

            if ((Controlled || Summoned) && ControlMaster != null)
            {
                Mobile master = ControlMaster;
                alchemyBonus = AosAttributes.GetValue(master, AosAttribute.EnhancePotions);
                sdi          = AosAttributes.GetValue(master, AosAttribute.SpellDamage);
                //if (alchemyBonus > 50)
                //    alchemyBonus = 50;
                sdi          += (int)(master.Skills.Inscribe.Fixed + (1000 * (int)(master.Skills.Inscribe.Fixed / 100))) / 100;
                alchemyBonus += master.Skills.Alchemy.Fixed / 330 * 10;
                sdi          += master.Int / 10;
                sdi          += ArcaneEmpowermentSpell.GetSpellBonus(master, false);

                TransformContext context = TransformationSpellHelper.GetContext(master);

                if (context != null && context.Spell is ReaperFormSpell)
                {
                    sdi += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }
                exploDamage = (int)(((master.Skills[SkillName.Alchemy].Value / 2.5)) * (1 + (alchemyBonus + sdi) / 100));
            }


            if (target == null)
            {
                return;
            }

            Point3D m_loc = target.Location;
            Map     map   = target.Map;

            int ExpRange = 0;

            if (ControlMaster != null)
            {
                ExpRange += (int)(ControlMaster.Skills[SkillName.Tinkering].Value + ControlMaster.Skills[SkillName.Alchemy].Value) / 50;
                if (Utility.RandomDouble() > AosAttributes.GetValue(ControlMaster, AosAttribute.EnhancePotions))
                {
                    ExpRange += 1;
                }
                if (Utility.RandomDouble() > AosAttributes.GetValue(ControlMaster, AosAttribute.SpellDamage))
                {
                    ExpRange += 1;
                }
            }
            target.PlaySound(0x11D);

            if ((Map)map != null)
            {
                IPooledEnumerable eable = (IPooledEnumerable)map.GetMobilesInRange(m_loc, ExpRange);

                foreach (object o in eable)
                {
                    if ((o is Mobile) && (o != this) && (target == null || (SpellHelper.ValidIndirectTarget(this, (Mobile)o) && CanBeHarmful((Mobile)o, false))) &&
                        ((Mobile)o).InLOS(target))
                    {
                        if (o is PlayerMobile)
                        {
                            AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage / 4), 0, 100, 0, 0, 0);
                        }
                        else if (o is BaseCreature && Controlled)
                        {
                            if (ControlMaster != ((BaseCreature)o).ControlMaster)
                            {
                                AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage), 0, 100, 0, 0, 0);
                            }
                            else if (o is BaseCreature)
                            {
                                AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage), 0, 100, 0, 0, 0);
                            }
                        }
                        DoHarmful((Mobile)o);
                    }
                }
            }
        }
Exemplo n.º 12
0
        public override Spell ChooseSpell(Mobile c)
        {
            Spell spell = CheckCastHealingSpell();

            if (spell != null)
            {
                return(spell);
            }

            switch (Utility.Random(16))
            {
            case 0:
            case 1:
            case 2:                     // Poison them
            {
                m_Mobile.DebugSay("Attempting to poison");

                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                break;
            }

            case 3:                     // Bless ourselves.
            {
                m_Mobile.DebugSay("Blessing myself");

                if (Utility.RandomBool() && !ArcaneEmpowermentSpell.IsBuffed(m_Mobile))
                {
                    spell = new ArcaneEmpowermentSpell(m_Mobile, null);
                }
                else
                {
                    spell = new BlessSpell(m_Mobile, null);
                }

                break;
            }

            case 4:                     // Wildfire
            {
                m_Mobile.DebugSay("Incendio!");

                spell = new WildfireSpell(m_Mobile, null);

                break;
            }

            case 5:                     // Reduce their cast speed
            {
                if (c.InRange(m_Mobile.Location, 6))
                {
                    if (m_Mobile.Skills[SkillName.Spellweaving].Value >= 90.0)
                    {
                        spell = new EssenceOfWindSpell(m_Mobile, null);
                    }
                    else if (c.InRange(m_Mobile.Location, 2))
                    {
                        spell = new ThunderstormSpell(m_Mobile, null);
                    }
                }

                m_Mobile.DebugSay("Attempting to reduce their cast speed");

                break;
            }

            case 6:                     // Curse them.
            {
                m_Mobile.DebugSay("Attempting to curse");

                spell = GetRandomCurseSpell(c);
                break;
            }

            case 7:                     // Paralyze them.
            {
                m_Mobile.DebugSay("Attempting to paralyze");

                if (m_Mobile.Skills[SkillName.Magery].Value > 50.0)
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }

                break;
            }

            case 8:                     // Drain mana
            {
                m_Mobile.DebugSay("Attempting to drain mana");

                spell = GetRandomManaDrainSpell(c);
                break;
            }

            default:                     // Damage them.
            {
                m_Mobile.DebugSay("Just doing damage");

                spell = GetRandomDamageSpell(c);
                break;
            }
            }

            return(spell);
        }
Exemplo n.º 13
0
        public void SpellweavingPower()
        {
            this.CheckFocus();

            if (this.CheckForAttuneWeapon()) // Always attune if needed
            {
                return;
            }
            else if (this.CheckForGiftOfRenewal()) // Always use renewal
            {
                return;
            }

            if (this.m_Mobile.Combatant == null)
            {
                return;
            }

            // TODO improve selecting the spell.

            int choices = 5; // default choices: allure, summon, melee, melee, thunderstorm

            if (this.m_Mobile.Mana > 50)
            {
                if (this.m_Mobile.Skills[SkillName.Spellweaving].Value > 90.0) // add word of death+, uses 50 mana
                {
                    choices += 4;
                }
                else if (this.m_Mobile.Skills[SkillName.Spellweaving].Value > 66.0) // add wildfire+, uses 50 mana
                {
                    choices += 3;
                }
                else if (this.m_Mobile.Skills[SkillName.Spellweaving].Value > 62.0) // add essence of wind+, uses 42 mana
                {
                    choices += 2;
                }
                else if (this.m_Mobile.Skills[SkillName.Spellweaving].Value > 44.0) // add empower, uses 50 mana
                {
                    ++choices;
                }
            }

            switch (Utility.Random(choices))
            {
            case 0:     // Allure
            {
                if (this.m_Mobile.Combatant is BaseCreature)
                {
                    if (this.m_Mobile.Debug)
                    {
                        this.m_Mobile.Say(1436, "Casting Dryad Allure");
                    }

                    new DryadAllureSpell(this.m_Mobile, null).Cast();
                    break;
                }
                else
                {
                    goto case 1;
                }
            }

            case 1:     // Summon
            {
                if (this.m_Mobile.Followers < this.m_Mobile.FollowersMax)
                {
                    Spell spell = this.GetSpellweavingSummon();

                    if (spell != null)
                    {
                        if (this.m_Mobile.Debug)
                        {
                            this.m_Mobile.Say(1436, "Summoning help");
                        }

                        spell.Cast();
                    }

                    this.ForceTarget();
                    break;
                }
                else
                {
                    goto case 2;
                }
            }

            case 2:
            case 3:     // Do nothing, aka melee
            {
                break;
            }

            case 4:
            {
                new ThunderstormSpell(this.m_Mobile, null).Cast();
                break;
            }

            case 5:     // Empower, increases summons & healing.
            {
                if (ArcaneEmpowermentSpell.GetSpellBonus(this.m_Mobile, true) == 0)
                {
                    new ArcaneEmpowermentSpell(this.m_Mobile, null).Cast();
                    break;
                }
                else
                {
                    goto case 2;
                }
            }

            case 6:     // Essence of Wind, cold aura and speed debuff.
            {
                if (!EssenceOfWindSpell.IsDebuffed(this.m_Mobile.Combatant))
                {
                    new EssenceOfWindSpell(this.m_Mobile, null).Cast();
                    break;
                }
                else
                {
                    goto case 2;
                }
            }

            case 7:
            {
                new WildfireSpell(this.m_Mobile, null).Cast();
                this.ForceTarget();
                break;
            }

            case 8:
            {
                new WordOfDeathSpell(this.m_Mobile, null).Cast();
                break;
            }
            }

            return;
        }
Exemplo n.º 14
0
        public override void OnTrigger(Mobile from)
        {
            int       sdiBonus;
            int       damage  = 0;
            ArrayList targets = new ArrayList();
            //uncomment this if you want staff to be immune to traps
            //if (from.AccessLevel > AccessLevel.Player)
            //    return;

            int ManaLoss = ScaleMana(ManaCost);

            if (!(TrapOwner.InRange(Location, 25)) || TrapOwner.Map != Map || TrapOwner.Map == Map.Internal)
            {
                this.UsesRemaining -= 1;
                return;
            }

            if (TrapOwner != null && TrapOwner.Player && TrapOwner.CanBeHarmful(from, false) &&
                from != TrapOwner && SpellHelper.ValidIndirectTarget(TrapOwner, (Mobile)from) &&
                (!(from is BaseCreature) || ((BaseCreature)from).ControlMaster != TrapOwner))
            {
                if (TrapOwner.Mana >= ManaLoss)
                {
                    TrapOwner.Mana -= ManaLoss;
                }
                else
                {
                    ManaLoss      -= TrapOwner.Mana;
                    TrapOwner.Mana = 0;
                    TrapOwner.Damage(ManaLoss);
                }
            }
            else
            {
                return;
            }

            if (this.Visible == false)
            {
                this.Visible = true;
            }

            int MinDamage = 20 * (TrapPower / 100);
            int MaxDamage = 30 * (TrapPower / 100);


            if (MinDamage < 5)
            {
                MinDamage = 5;
            }

            if (MaxDamage < 10)
            {
                MaxDamage = 10;
            }
            if (from.Alive)
            {
                IPooledEnumerable eable = this.Map.GetMobilesInRange(new Point3D(from.Location), DamageRange);

                foreach (Mobile m in eable)
                {
                    if ((m != TrapOwner && SpellHelper.ValidIndirectTarget(TrapOwner, (Mobile)m) && TrapOwner.CanBeHarmful(m, false)) && m.InLOS(this))
                    {
                        targets.Add(m);
                    }
                }
                eable.Free();

                if ((from != TrapOwner && SpellHelper.ValidIndirectTarget(TrapOwner, (Mobile)from) && TrapOwner.CanBeHarmful(from, false)) && from.InLOS(this))  //yes, intentional double hit to triggerer
                {
                    targets.Add(from);
                }

                if (targets.Count > 0)
                {
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = (Mobile)targets[i];
                        if (DamageScalar != 0)
                        {
                            sdiBonus  = AosAttributes.GetValue(TrapOwner, AosAttribute.SpellDamage);
                            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(TrapOwner, (m.Player && TrapOwner.Player));

                            // PvP spell damage increase cap of 15% from an item’s magic property
                            if ((m.Player && TrapOwner.Player) && (sdiBonus > 15 + (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10)))
                            {
                                sdiBonus = 15 + (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10);
                            }
                            sdiBonus += (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10);

                            TrapOwner.DoHarmful(m);
                            MinDamage = MinDamage * (100 + sdiBonus) / 100;
                            MaxDamage = MaxDamage * (100 + sdiBonus) / 100;
                            switch (m_DamageType)
                            {
                            case "Physical":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 100, 0, 0, 0, 0);
                                break;

                            case "Fire":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 100, 0, 0, 0);
                                break;

                            case "Cold":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 100, 0, 0);
                                break;

                            case "Poison":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 0, 100, 0);
                                break;

                            case "Energy":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 0, 0, 100);
                                break;
                            }
                            SpellHelper.DoLeech(damage, TrapOwner, m);
                            if (PointDest != Point3D.Zero && TrapOwner.Player)
                            {
                                Teleport(m);
                            }
                        }
                        if (Poison != null)
                        {
                            m.ApplyPoison(m, m_Poison);
                            TrapOwner.DoHarmful(m);
                        }

                        if (ParalyzeTime > 0)
                        {
                            TrapOwner.DoHarmful(m);
                            if (m.Player)
                            {
                                m.Paralyze(TimeSpan.FromSeconds(ParalyzeTime - (m.Skills.MagicResist.Value / 12) / 4));
                            }
                            else
                            {
                                m.Paralyze(TimeSpan.FromSeconds(ParalyzeTime - (m.Skills.MagicResist.Value / 12)));
                            }
                        }
                    }

                    if (TrapOwner.Alive)
                    {
                        this.UsesRemaining -= 1;
                    }
                    else
                    {
                        UsesRemaining -= 10;
                    }

                    if (this.UsesRemaining <= 0)
                    {
                        this.Delete();
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            Consume();
            double PoisonChance = 0;

            for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
            {
                Mobile      m    = m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                {
                    Target.Cancel(m);
                }
            }

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x307);

            Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
            int alchemyBonus = 0;

            if (direct)
            {
                alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
            }

            IPooledEnumerable eable     = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange(loc, ExplosionRange) : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
            ArrayList         toExplode = new ArrayList();

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (from != null)
                    {
                        from.DoHarmful(m);
                    }

                    int damage = Utility.RandomMinMax(min, max);

                    damage += alchemyBonus;

                    if (!Core.AOS && damage > 40)
                    {
                        damage = 40;
                    }
                    else if (Core.AOS && toDamage > 2)
                    {
                        damage /= toDamage - 1;
                    }
                    if (!(m is PlayerMobile))
                    {
                        damage *= 2;
                    }

                    damage *= 1 + ArcaneEmpowermentSpell.GetSpellBonus(from, false);
                    if (((BasePotion)this).Poison != null)
                    {
                        PoisonChance  = .1;
                        PoisonChance += ((from.Skills[SkillName.Poisoning].Value + from.Skills[SkillName.Alchemy].Value + from.Skills[SkillName.TasteID].Value) / 333);
                        if (PoisonChance > Utility.RandomDouble())
                        {
                            m.ApplyPoison(from, Poison);
                        }
                    }
                    AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                }
                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }