Пример #1
0
 internal float ApplyEffectModifiers(SpellInfo spellInfo, float value)
 {
     return(value);
 }
Пример #2
0
 internal void TriggerSpell(SpellInfo spellInfo, Unit target, SpellCastFlags extraCastFlags = 0)
 {
     CastSpell(spellInfo, new SpellCastingOptions(new SpellExplicitTargets {
         Target = target
     }, SpellCastFlags.TriggeredByAura | extraCastFlags));
 }
Пример #3
0
            internal bool IsSpellCrit(Unit victim, SpellInfo spellInfo, SpellSchoolMask schoolMask, Spell spell = null)
            {
                float critChance = CalculateSpellCriticalChance(victim, spellInfo, schoolMask, spell);

                return(RandomUtils.CheckSuccessPercent(critChance));
            }
Пример #4
0
            private float CalculateSpellCriticalChance(Unit victim, SpellInfo spellInfo, SpellSchoolMask schoolMask, Spell spell = null)
            {
                if (spellInfo.HasAttribute(SpellAttributes.CantCrit) || spellInfo.DamageClass == SpellDamageClass.None)
                {
                    return(0.0f);
                }

                if (spellInfo.HasAttribute(SpellAttributes.AlwaysCrit))
                {
                    return(100.0f);
                }

                float critChance = unit.CritPercentage;

                if (victim == null)
                {
                    return(Mathf.Max(critChance, 0.0f));
                }

                switch (spellInfo.DamageClass)
                {
                case SpellDamageClass.Magic:
                    if (!spellInfo.IsPositive)
                    {
                        critChance += victim.Auras.TotalAuraModifier(AuraEffectType.ModAttackerSpellCritChance);
                    }
                    goto default;

                case SpellDamageClass.Melee:
                    if (!spellInfo.IsPositive)
                    {
                        critChance += victim.Auras.TotalAuraModifier(AuraEffectType.ModAttackerMeleeCritChance);
                    }
                    goto default;

                case SpellDamageClass.Ranged:
                    if (!spellInfo.IsPositive)
                    {
                        critChance += victim.Auras.TotalAuraModifier(AuraEffectType.ModAttackerRangedCritChance);
                    }
                    goto default;

                default:
                    critChance += victim.Auras.TotalAuraModifierForCaster(AuraEffectType.ModAttackerSpellCritChanceForCaster, unit.Id);
                    critChance += victim.Auras.TotalAuraModifier(AuraEffectType.ModAttackerSpellAndWeaponCritChance);
                    break;
                }

                IReadOnlyList <AuraEffect> spellCritAuras = unit.GetAuraEffects(AuraEffectType.OverrideSpellCritCalculation);

                if (spellCritAuras != null)
                {
                    for (int i = 0; i < spellCritAuras.Count; i++)
                    {
                        if (spellCritAuras[i].EffectInfo is AuraEffectInfoOverrideSpellCritCalculation effectInfo)
                        {
                            effectInfo.ModifySpellCrit(unit, victim, spellInfo, ref critChance, spell);
                        }
                    }
                }

                return(Mathf.Max(critChance, 0.0f));
            }
Пример #5
0
 internal uint SpellHealingBonusTaken(Unit caster, SpellInfo spellInfo, uint healAmount)
 {
     return(healAmount);
 }
Пример #6
0
 internal uint SpellHealingBonusDone(Unit target, SpellInfo spellInfo, uint healAmount)
 {
     return(healAmount);
 }
Пример #7
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);
            }
Пример #8
0
 internal Unit GetMeleeHitRedirectTarget(Unit victim, SpellInfo spellInfo = null)
 {
     return(null);
 }
Пример #9
0
 internal Unit GetMagicHitRedirectTarget(Unit victim, SpellInfo spellInfo)
 {
     return(null);
 }