mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
Core/Spells: Fixed downranking coefficient penalty formula
Closes #21318
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user