Core/Spells: Fixed spell modifiers losing charges on cancelled casts
Closes #247 Closes #640 Closes #1353
This commit is contained in:
@@ -2957,9 +2957,12 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
|||||||
// Prepare data for triggers
|
// Prepare data for triggers
|
||||||
prepareDataForTriggerSystem(triggeredByAura);
|
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)
|
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||||
m_casttime = GetSpellCastTime(m_spellInfo, this);
|
m_casttime = GetSpellCastTime(m_spellInfo, this);
|
||||||
//m_caster->ModSpellCastTime(m_spellInfo, m_casttime, this);
|
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||||
|
|
||||||
// don't allow channeled spells / spells with cast time to be casted while moving
|
// 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)
|
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
|
||||||
@@ -3028,6 +3031,8 @@ void Spell::cancel()
|
|||||||
{
|
{
|
||||||
case SPELL_STATE_PREPARING:
|
case SPELL_STATE_PREPARING:
|
||||||
CancelGlobalCooldown();
|
CancelGlobalCooldown();
|
||||||
|
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
m_caster->ToPlayer()->RestoreSpellMods(this);
|
||||||
case SPELL_STATE_DELAYED:
|
case SPELL_STATE_DELAYED:
|
||||||
SendInterrupted(0);
|
SendInterrupted(0);
|
||||||
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
||||||
|
|||||||
Reference in New Issue
Block a user