Beispiel #1
0
            internal uint SpellDamageBonusDone(Unit target, uint damage, SpellDamageType damageType, SpellInfo spellInfo, Spell spell = null, uint stack = 1)
            {
                if (spell != null)
                {
                    damage = (uint)unit.Spells.ApplySpellModifier(spell, SpellModifierType.DamageMultiplier, damage);
                }

                return(damage);
            }
Beispiel #2
0
            internal uint SpellDamageBonusDone(Unit target, uint damage, SpellDamageType damageType, SpellInfo spellInfo, Spell spell = null)
            {
                float damageMultiplier = unit.Auras.TotalAuraMultiplier(AuraEffectType.ModifyDamagePercentDone);

                damage = (uint)(damage * damageMultiplier);

                if (spell != null)
                {
                    damage = (uint)unit.Spells.ApplySpellModifier(spell, SpellModifierType.DamageMultiplier, damage);
                }

                return(damage);
            }
        public SpellDamageInfo(Unit caster, Unit target, SpellInfo spellInfo, SpellDamageType spellDamageType, HitType hitType)
        {
            Caster    = caster;
            Target    = target;
            SpellInfo = spellInfo;

            SpellDamageType = spellDamageType;
            HitType         = hitType;

            Damage  = 0;
            Absorb  = 0;
            Resist  = 0;
            HasCrit = false;
        }
Beispiel #4
0
        public SpellDamageInfo(Unit caster, Unit target, SpellInfo spellInfo, uint originalDamage, bool hasCrit, SpellDamageType spellDamageType)
        {
            Caster    = caster;
            Target    = target;
            SpellInfo = spellInfo;

            SpellDamageType = spellDamageType;

            Damage  = originalDamage;
            HasCrit = hasCrit;

            HitType = 0;
            Absorb  = 0;
            Resist  = 0;

            if (HasCrit)
            {
                HitType |= HitType.CriticalHit;
            }
        }
Beispiel #5
0
        public void DealSpellDamage(SpellCast spell, int damage, SpellDamageType type, int index)
        {
            bool isHeal = false;
            bool isDot  = false;

            Unit caster = spell.Caster;

            switch (type)
            {
            case SpellDamageType.SPELL_TYPE_HEAL:
                isHeal = true;
                break;

            case SpellDamageType.SPELL_TYPE_HEALDOT:
                isHeal = true;
                isDot  = true;
                break;

            case SpellDamageType.SPELL_TYPE_DOT:
                isDot = true;
                break;
            }

            int benefit = 0;

            if (caster.IsTypeOf(ObjectTypes.TYPE_PLAYER))
            {
                int penalty     = 0;
                int effectcount = 0;
                for (uint i = 0; i < 3; i++)
                {
                    if (spell.Spell.Effect[i] != 0)
                    {
                        effectcount++;
                    }
                }

                if (effectcount > 1)
                {
                    penalty = 5;
                }

                int spelldamage = 0;
                //TODO
                //        If IsHeal Then
                //            SpellDamage = CType(Caster, CharacterObject).healing.Value
                //        Else
                //            SpellDamage = CType(Caster, CharacterObject).spellDamage(DamageType).Value
                //        End If

                if (isDot)
                {
                    int tickamt = (int)(spell.Duration / spell.Spell.EffectAmplitude[index]);
                    if (tickamt < 5)
                    {
                        tickamt = 5;
                    }

                    benefit = spelldamage / tickamt;
                }
                else
                {
                    int casttime = spell.CastTime?.m_base ?? 0;
                    if (casttime < 1500)
                    {
                        casttime = 1500;
                    }
                    else if (casttime > 3500)
                    {
                        casttime = 3500;
                    }

                    benefit = (int)Math.Truncate(spelldamage * (casttime / 1000f) * ((100 - penalty) / 100) / 3.5f);
                }
            }

            damage += benefit;

            uint health = GetHealth();

            if (isHeal)
            {
                if (GetHealth() != GetMaxHealth())
                {
                    health += (uint)damage;
                    if (health > GetMaxHealth())
                    {
                        Health.Current = Health.Maximum;
                    }
                    else
                    {
                        Health.Current = health;
                    }

                    if (damage != 0)
                    {
                        GridManager.Instance.SendSurrounding(this.BuildUpdate(), this);
                    }
                }
            }
            else
            {
                caster.Attack(this, false);
                caster.DealDamage(this.Guid, (uint)damage);
            }
        }
Beispiel #6
0
            internal uint SpellDamageBonusTaken(Unit caster, SpellInfo spellInfo, uint damage, SpellDamageType damageType)
            {
                if (damageType == SpellDamageType.Processed)
                {
                    return(damage);
                }

                float damageMultiplier = unit.Auras.TotalAuraMultiplier(AuraEffectType.ModifyDamagePercentTaken);
                float resultingDamage  = damage * damageMultiplier;

                return((uint)Mathf.Max(0.0f, resultingDamage));
            }
Beispiel #7
0
        public void DealSpellDamage(SpellCast spell, int damage, SpellDamageType type, int index)
        {
            bool isHeal = false;
            bool isDot  = false;

            Unit caster = spell.Caster;

            switch (type)
            {
            case SpellDamageType.SPELL_TYPE_HEAL:
                isHeal = true;
                break;

            case SpellDamageType.SPELL_TYPE_HEALDOT:
                isHeal = true;
                isDot  = true;
                break;

            case SpellDamageType.SPELL_TYPE_DOT:
                isDot = true;
                break;
            }

            int benefit = 0;

            if (caster.IsTypeOf(ObjectTypes.TYPE_PLAYER))
            {
                int penalty     = 0;
                int effectcount = 0;
                for (uint i = 0; i < 3; i++)
                {
                    if (spell.Spell.Effect[i] != 0)
                    {
                        effectcount++;
                    }
                }

                if (effectcount > 1)
                {
                    penalty = 5;
                }

                int spelldamage = 0;
                //TODO
                //        If IsHeal Then
                //            SpellDamage = CType(Caster, CharacterObject).healing.Value
                //        Else
                //            SpellDamage = CType(Caster, CharacterObject).spellDamage(DamageType).Value
                //        End If

                if (isDot)
                {
                    int tickamt = (int)(spell.Duration / spell.Spell.EffectAmplitude[index]);
                    if (tickamt < 5)
                    {
                        tickamt = 5;
                    }

                    benefit = spelldamage / tickamt;
                }
                else
                {
                    int casttime = spell.CastTime?.m_base ?? 0;
                    if (casttime < 1500)
                    {
                        casttime = 1500;
                    }
                    else if (casttime > 3500)
                    {
                        casttime = 3500;
                    }

                    benefit = (int)Math.Truncate(spelldamage * (casttime / 1000f) * ((100 - penalty) / 100) / 3.5f);
                }
            }

            damage += benefit;
        }
Beispiel #8
0
		public virtual void CheckSpellImmunity(SpellDamageType s, double damagein, out double damage)
		{
			damage = damagein;
		}
 internal uint SpellDamageBonusTaken(Unit caster, SpellInfo spellInfo, uint damage, SpellDamageType damageType, uint stack = 1)
 {
     return(damage);
 }
 internal uint SpellDamageBonusDone(Unit victim, SpellInfo spellInfo, uint damage, SpellDamageType damageType, uint stack = 1)
 {
     return(damage);
 }
 public virtual void DamageDealt(Unit victim, int damage, SpellDamageType spellDamageType)
 {
 }