Core/Spells: Fixed cast time calculation in many places
This commit is contained in:
1 parent
2849526137
commit
7aff234ada
5 files changed
+13
-11
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user