diff options
author | Shauren <shauren.trinity@gmail.com> | 2018-01-27 12:19:18 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-01-27 12:19:18 +0100 |
commit | 2ab4e6c7aaa972f2a3c14a75d3065f9a67d87f8a (patch) | |
tree | 4a093a5f6eb15393a68d681e528b13c329efc378 /src | |
parent | 275c17b4c23468a3274079c1174a7e4999131d81 (diff) |
Core/Spells: Fixed downranking coefficient penalty formula
Closes #21318
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 6 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 2 |
6 files changed, 14 insertions, 22 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ea78cfd468d..d520268d9b5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2352,20 +2352,12 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, bool add return urand(uint32(minDamage), uint32(maxDamage)); } -float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const +float Unit::CalculateSpellpowerCoefficientLevelPenalty(SpellInfo const* spellProto) const { - if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel) + if (getLevel() < spellProto->MaxLevel) return 1.0f; - float LvlPenalty = 0.0f; - - if (spellProto->SpellLevel < 20) - LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f; - float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(getLevel()); - if (LvlFactor > 1.0f) - LvlFactor = 1.0f; - - return AddPct(LvlFactor, -LvlPenalty); + return std::max(0.0f, std::min(1.0f, (22.0f + spellProto->MaxLevel - getLevel()) / 20.0f)); } void Unit::SendMeleeAttackStart(Unit* victim) @@ -6921,7 +6913,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin // Default calculation if (coeff && DoneAdvertisedBenefit) { - float factorMod = CalculateLevelPenalty(spellProto) * stack; + float factorMod = CalculateSpellpowerCoefficientLevelPenalty(spellProto) * stack; if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; @@ -7324,7 +7316,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui } // level penalty still applied on Taken bonus - is it blizzlike? - float factorMod = CalculateLevelPenalty(spellProto) * stack; + float factorMod = CalculateSpellpowerCoefficientLevelPenalty(spellProto) * stack; TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); } } @@ -7788,7 +7780,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui // Default calculation if (coeff && DoneAdvertisedBenefit) { - float factorMod = CalculateLevelPenalty(spellProto) * stack; + float factorMod = CalculateSpellpowerCoefficientLevelPenalty(spellProto) * stack; if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; @@ -7970,7 +7962,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u } // level penalty still applied on Taken bonus - is it blizzlike? - float factorMod = CalculateLevelPenalty(spellProto) * int32(stack); + float factorMod = CalculateSpellpowerCoefficientLevelPenalty(spellProto) * int32(stack); TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 59ee716729b..c05c84dc6d0 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1570,7 +1570,7 @@ class TC_GAME_API Unit : public WorldObject int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask); void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = nullptr); void ModSpellDurationTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = nullptr); - float CalculateLevelPenalty(SpellInfo const* spellProto) const; + float CalculateSpellpowerCoefficientLevelPenalty(SpellInfo const* spellProto) const; void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 5c8d57c65f2..0c122bfc685 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -616,7 +616,7 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader float bonus = 0.8068f; bonus *= caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); } @@ -935,7 +935,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader // Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); } @@ -1114,7 +1114,7 @@ class spell_mage_mana_shield : public SpellScriptLoader float bonus = 0.8053f; bonus *= caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index e75fb3db34c..c76f0325c29 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1919,7 +1919,7 @@ class spell_pal_sacred_shield : public SpellScriptLoader // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 0d30d4fa177..2dc2c340cd8 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -1013,7 +1013,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) // Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 279553f87e9..c82c7cf445f 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -1230,7 +1230,7 @@ class spell_warl_shadow_ward : public SpellScriptLoader float bonus = 0.8068f; bonus *= caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); amount += int32(bonus); } |