mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-17 05:29:43 -04:00
Core/Spells: Fixed cast time calculation in many places
This commit is contained in:
@@ -74,7 +74,7 @@ void Totem::InitStats(uint32 duration)
|
||||
|
||||
// Get spell cast by totem
|
||||
if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell()))
|
||||
if (totemSpell->CalcCastTime()) // If spell has cast time -> its an active totem
|
||||
if (totemSpell->CalcCastTime(getLevel())) // If spell has cast time -> its an active totem
|
||||
m_type = TOTEM_ACTIVE;
|
||||
|
||||
m_duration = duration;
|
||||
|
||||
@@ -12438,7 +12438,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
||||
}
|
||||
case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK:
|
||||
// Skip melee hits or instant cast spells
|
||||
if (procSpell && procSpell->CalcCastTime() != 0)
|
||||
if (procSpell && procSpell->CalcCastTime(getLevel()) > 0)
|
||||
takeCharges = true;
|
||||
break;
|
||||
case SPELL_AURA_REFLECT_SPELLS_SCHOOL:
|
||||
@@ -12956,7 +12956,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
|
||||
if (overTime > 0 && CastingTime > 0 && DirectDamage)
|
||||
{
|
||||
// mainly for DoTs which are 3500 here otherwise
|
||||
uint32 OriginalCastTime = spellProto->CalcCastTime();
|
||||
uint32 OriginalCastTime = spellProto->CalcCastTime(getLevel());
|
||||
if (OriginalCastTime > 7000) OriginalCastTime = 7000;
|
||||
if (OriginalCastTime < 1500) OriginalCastTime = 1500;
|
||||
// Portion to Over Time
|
||||
@@ -13045,7 +13045,7 @@ float Unit::CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffect
|
||||
DotFactor /= DotTicks;
|
||||
}
|
||||
|
||||
int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
|
||||
int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime(getLevel());
|
||||
// Distribute Damage over multiple effects, reduce by AoE
|
||||
CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
|
||||
|
||||
|
||||
@@ -3057,14 +3057,14 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
|
||||
{
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
|
||||
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||
m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
|
||||
m_casttime = m_spellInfo->CalcCastTime(m_caster->getLevel(), this);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
else
|
||||
m_casttime = 0; // Set cast time to 0 if .cheat casttime is enabled.
|
||||
}
|
||||
else
|
||||
m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
|
||||
m_casttime = m_spellInfo->CalcCastTime(m_caster->getLevel(), this);
|
||||
|
||||
// don't allow channeled spells / spells with cast time to be casted while moving
|
||||
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks 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;
|
||||
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
|
||||
uint32 GetMaxTicks() const;
|
||||
|
||||
uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const;
|
||||
uint32 CalcCastTime(uint8 level = 0, Spell* spell = NULL) const;
|
||||
uint32 GetRecoveryTime() const;
|
||||
|
||||
int32 CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const;
|
||||
|
||||
Reference in New Issue
Block a user