aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 7b30c3e6634..66d930ebc74 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3051,18 +3051,20 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
// Prepare data for triggers
prepareDataForTriggerSystem(triggeredByAura);
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- 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);
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = m_caster->ToPlayer())
{
- m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
-
- // Set casttime to 0 if .cheat casttime is enabled.
- if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
- m_casttime = 0;
+ if (!m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
+ {
+ 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(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(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)