Exemplo n.º 1
0
        public virtual double GetDamageScalar(Mobile target)
        {
            double scalar = 1.0;

            if (target == null)
            {
                return(scalar);
            }

            if (target is BaseCreature)
            {
                ((BaseCreature)target).AlterDamageScalarFrom(m_Caster, ref scalar);
            }

            if (m_Caster is BaseCreature)
            {
                ((BaseCreature)m_Caster).AlterDamageScalarTo(target, ref scalar);
            }

            scalar *= GetSlayerDamageScalar(target);

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

            if (Evasion.CheckSpellEvasion(target))             //Only single target spells an be evaded
            {
                scalar = 0;
            }

            return(scalar);
        }
Exemplo n.º 2
0
        public virtual double GetDamageScalar(Mobile target)
        {
            double scalar = 1.0;

            if (target is BaseCreature)
            {
                ((BaseCreature)target).AlterDamageScalarFrom(Caster, ref scalar);
            }

            if (Caster is BaseCreature)
            {
                ((BaseCreature)Caster).AlterDamageScalarTo(target, ref scalar);
            }

            scalar *= GetSlayerDamageScalar(target);

            target.Region.SpellDamageScalar(Caster, target, ref scalar);

            if (RunedSashOfWarding.IsUnderWardingEffect(target, WardingEffect.SpellDamage))
            {
                scalar *= 0.9;
            }

            if (Evasion.CheckSpellEvasion(target))                      //Only single target spells an be evaded
            {
                scalar = 0;
            }

            return(scalar);
        }
Exemplo n.º 3
0
        public virtual double GetDamageScalar(Mobile target)
        {
            //double scalar = 1.0;
            double scalar = (0.5 + m_Caster.Skills[CastSkill].Value / 100.0);

            if (!Core.AOS)              //EvalInt stuff for AoS is handled elsewhere
            {
                double casterEI = m_Caster.Skills[DamageSkill].Value;
                double targetRS = target.Skills[SkillName.MagicResist].Value;

                /*
                 * if( Core.AOS )
                 *      targetRS = 0;
                 */

                //m_Caster.CheckSkill( DamageSkill, 0.0, 120.0 );

                if (casterEI > targetRS)
                {
                    scalar = (1.0 + ((casterEI - targetRS) / 500.0));
                }
                else
                {
                    scalar = (1.0 + ((casterEI - targetRS) / 200.0));
                }

                // magery damage bonus, -25% at 0 skill, +0% at 100 skill, +5% at 120 skill
                scalar += (m_Caster.Skills[CastSkill].Value - 100.0) / 400.0;

                if (!target.Player && !target.Body.IsHuman /*&& !Core.AOS*/)
                {
                    scalar *= 2.0;                     // Double magery damage to monsters/animals if not AOS
                }
            }

            if (target is BaseCreature)
            {
                ((BaseCreature)target).AlterDamageScalarFrom(m_Caster, ref scalar);
            }

            if (m_Caster is BaseCreature)
            {
                ((BaseCreature)m_Caster).AlterDamageScalarTo(target, ref scalar);
            }

            if (Core.SE)
            {
                scalar *= GetSlayerDamageScalar(target);
            }

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

            if (Evasion.CheckSpellEvasion(target))                      //Only single target spells an be evaded
            {
                scalar = 0;
            }

            return(scalar);
        }
Exemplo n.º 4
0
        public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage, int phys, int fire, int cold, int pois, int nrgy, DFAlgorithm dfa)
        {
            int iDamage = (int)damage;

            #region Taran: Spell damage is based on armor difference

            /*
             * double newDamage = damage;
             *
             * if (target is PlayerMobile && from is PlayerMobile)
             * {
             *  World.Broadcast(25, true, "Old damage is: " + iDamage);
             *
             *  double defar = ((PlayerMobile) target).BaseArmorRatingSpells;
             *  double attar = ((PlayerMobile) from).BaseArmorRatingSpells;
             *
             *  double diff = defar - attar;
             *
             *  World.Broadcast(50, true, "Difference in armor rating is: " + diff);
             *
             *  if (defar - attar > 0)
             *      newDamage = iDamage*(1.00 - ((diff * 1.6) / 100));
             *
             *  if (newDamage / iDamage < 0.6) //Don't deal less than 60% damage
             *      newDamage = iDamage*0.6;
             *
             *  iDamage = (int) newDamage;
             *
             *  World.Broadcast(25, true, "New damage is: " + iDamage);
             * }
             */
            #endregion

            //Maka);
            if (target == from && from.MagicDamageAbsorb > 0)
            {
                from.FixedEffect(0x37B9, 10, 5);
                from.MagicDamageAbsorb = 0;
                iDamage = 0;
                DefensiveSpell.Nullify(from);
            }

            if (Evasion.CheckSpellEvasion(target))
            {
                iDamage = 0;
            }

            if (delay == TimeSpan.Zero)
            {
                if (from is BaseCreature)
                {
                    ((BaseCreature)from).AlterSpellDamageTo(target, ref iDamage);
                }

                if (target is BaseCreature)
                {
                    ((BaseCreature)target).AlterSpellDamageFrom(from, ref iDamage);
                }

                //WeightOverloading.DFA = dfa;

                int damageGiven = AOS.Damage(target, from, iDamage, phys, fire, cold, pois, nrgy);
                DoLeech(damageGiven, from, target);

                //WeightOverloading.DFA = DFAlgorithm.Standard;
            }
            else
            {
                new SpellDamageTimerAOS(spell, target, from, iDamage, phys, fire, cold, pois, nrgy, delay, dfa).Start();
            }

            if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
            {
                BaseCreature c = (BaseCreature)target;

                c.OnHarmfulSpell(from);
                c.OnDamagedBySpell(from);
            }
        }