diff options
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 117 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 3 |
2 files changed, 0 insertions, 120 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6fa98f4bb55..f903a37c75b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10151,101 +10151,6 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply) } } -uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const -{ - // Not apply this to creature cast spells with casttime == 0 - if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !IsPet()) - return 3500; - - if (CastingTime > 7000) CastingTime = 7000; - if (CastingTime < 1500) CastingTime = 1500; - - if (damagetype == DOT && !spellProto->IsChanneled()) - CastingTime = 3500; - - int32 overTime = 0; - uint8 effects = 0; - bool DirectDamage = false; - bool AreaEffect = false; - - for (SpellEffectInfo const* effect : spellProto->GetEffects()) - { - if (!effect) - continue; - switch (effect->Effect) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_POWER_DRAIN: - case SPELL_EFFECT_HEALTH_LEECH: - case SPELL_EFFECT_ENVIRONMENTAL_DAMAGE: - case SPELL_EFFECT_POWER_BURN: - case SPELL_EFFECT_HEAL: - DirectDamage = true; - break; - case SPELL_EFFECT_APPLY_AURA: - switch (effect->ApplyAuraName) - { - case SPELL_AURA_PERIODIC_DAMAGE: - case SPELL_AURA_PERIODIC_HEAL: - case SPELL_AURA_PERIODIC_LEECH: - if (spellProto->GetDuration()) - overTime = spellProto->GetDuration(); - break; - default: - // -5% per additional effect - ++effects; - break; - } - default: - break; - } - - if (effect->IsTargetingArea()) - AreaEffect = true; - } - - // Combined Spells with Both Over Time and Direct Damage - if (overTime > 0 && CastingTime > 0 && DirectDamage) - { - // mainly for DoTs which are 3500 here otherwise - uint32 OriginalCastTime = spellProto->CalcCastTime(); - if (OriginalCastTime > 7000) OriginalCastTime = 7000; - if (OriginalCastTime < 1500) OriginalCastTime = 1500; - // Portion to Over Time - float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f)); - - if (damagetype == DOT) - CastingTime = uint32(CastingTime * PtOT); - else if (PtOT < 1.0f) - CastingTime = uint32(CastingTime * (1 - PtOT)); - else - CastingTime = 0; - } - - // Area Effect Spells receive only half of bonus - if (AreaEffect) - CastingTime /= 2; - - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for (SpellEffectInfo const* effect : spellProto->GetEffects()) - { - if (!effect) - continue; - if (effect->Effect == SPELL_EFFECT_HEALTH_LEECH || - (effect->Effect == SPELL_EFFECT_APPLY_AURA && effect->ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - - // -5% of total per any additional effect - for (uint8 i = 0; i < effects; ++i) - CastingTime *= 0.95f; - - return CastingTime; -} - void Unit::UpdateAuraForGroup() { if (Player* player = ToPlayer()) @@ -10272,28 +10177,6 @@ void Unit::SetCantProc(bool apply) } } -float Unit::CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const -{ - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - int32 DotDuration = spellInfo->GetDuration(); - if (!spellInfo->IsChanneled() && DotDuration > 0) - DotFactor = DotDuration / 15000.0f; - - if (uint32 DotTicks = spellInfo->GetMaxTicks()) - DotFactor /= DotTicks; - } - - int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime(); - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime); - - // As wowwiki says: C = (Cast Time / 3.5) - return (CastingTime / 3500.0f) * DotFactor; -} - float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized) const { if (GetTypeId() != TYPEID_PLAYER || (IsInFeralForm() && !normalized)) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3e5614ff30a..063e22ab1d3 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1664,9 +1664,6 @@ class TC_GAME_API Unit : public WorldObject static uint32 SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim); static uint32 SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim); - uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; - float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const; - uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); |