mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
Core/Spells: Fixed cast time calculation in many places
This commit is contained in:
@@ -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