diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-08-15 19:04:09 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-08-15 19:04:09 +0200 |
| commit | 7aff234ada2a64f07d10fe5fc9880bc2b3f647ec (patch) | |
| tree | a65d3d239910bfa1e163335e488cf819979a87cd /src/server/game/Spells/SpellInfo.cpp | |
| parent | 284952613702e45ac3501fbf39c1275621499585 (diff) | |
Core/Spells: Fixed cast time calculation in many places
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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; |
