From 7aff234ada2a64f07d10fe5fc9880bc2b3f647ec Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 19:04:09 +0200 Subject: Core/Spells: Fixed cast time calculation in many places --- src/server/game/Spells/SpellInfo.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/server/game/Spells/SpellInfo.cpp') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index e0b4355a37f..4254be1c968 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2238,16 +2238,18 @@ int32 SpellInfo::GetMaxDuration() const return (DurationEntry->Duration[2] == -1) ? -1 : abs(DurationEntry->Duration[2]); } -uint32 SpellInfo::CalcCastTime(Unit* caster /*= NULL*/, Spell* spell /*= NULL*/) const +uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= NULL*/) const { int32 castTime = 0; + if (!level && spell) + level = spell->GetCaster()->getLevel(); // not all spells have cast time index and this is all is pasiive abilities - if (caster && CastTimeMax > 0) + if (level && CastTimeMax > 0) { castTime = CastTimeMax; - if (CastTimeMaxLevel > int32(caster->getLevel())) - castTime = CastTimeMin + int32(caster->getLevel() - 1) * (CastTimeMax - CastTimeMin) / (CastTimeMaxLevel - 1); + if (CastTimeMaxLevel > level) + castTime = CastTimeMin + int32(level - 1) * (CastTimeMax - CastTimeMin) / (CastTimeMaxLevel - 1); } else if (CastTimeEntry) castTime = CastTimeEntry->CastTime; -- cgit v1.2.3