From 5fb9b9c4246d7cf44ed40f1936e6a45d6242ced2 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 14 Jun 2024 23:25:41 +0200 Subject: Core/Spells: fixed cast time scaling --- src/server/game/Spells/SpellInfo.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.3