diff options
author | Ovahlord <dreadkiller@gmx.de> | 2024-06-14 23:25:41 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-14 23:25:41 +0200 |
commit | 5fb9b9c4246d7cf44ed40f1936e6a45d6242ced2 (patch) | |
tree | 32ee51fdb09ed7d8771e4522763af0f7b3524e33 /src | |
parent | 8e9e8551ee4071717d14ba55cc3135e8534050e1 (diff) |
Core/Spells: fixed cast time scaling
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index c0a7dd72d12..c71b73f4423 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3786,7 +3786,22 @@ int32 SpellInfo::GetMaxDuration() const uint32 SpellInfo::CalcCastTime(Spell* spell /*= nullptr*/) const { int32 castTime = 0; - if (CastTimeEntry) + + uint8 casterLevel = [spell]()->uint8 + { + if (spell && spell->GetCaster() && spell->GetCaster()->IsUnit()) + return spell->GetCaster()->ToUnit()->GetLevel();; + + return 0; + }(); + + if (casterLevel > 0 && Scaling.CastTimeMax > 0) + { + castTime = Scaling.CastTimeMax; + if (Scaling.CastTimeMaxLevel > casterLevel) + castTime = Scaling.CastTimeMin + int32(casterLevel - 1) * (Scaling.CastTimeMax - Scaling.CastTimeMin) / (Scaling.CastTimeMaxLevel - 1); + } + else if (CastTimeEntry) castTime = std::max(CastTimeEntry->Base, CastTimeEntry->Minimum); if (castTime <= 0) |