aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d21e870a533..b2f0bda7ec8 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -873,7 +873,7 @@ void Unit::CastStop(uint32 except_spellid)
{
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id!=except_spellid)
- InterruptSpell(i,false);
+ InterruptSpell(CurrentSpellTypes(i),false);
}
void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
@@ -2904,13 +2904,9 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
}
}
if (isNormal || m_currentSpells[CURRENT_MELEE_SPELL])
- {
misschance = 5.0f;
- }
else
- {
misschance = 24.0f;
- }
}
// PvP : PvE melee misschances per leveldif > 2
@@ -3314,9 +3310,11 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
// set new current spell
m_currentSpells[CSpellType] = pSpell;
pSpell->SetReferencedFromCurrent(true);
+
+ pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
}
-void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
+void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant)
{
assert(spellType < CURRENT_MAX_SPELL);
@@ -3345,6 +3343,18 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
}
}
+void Unit::FinishSpell(CurrentSpellTypes spellType, bool ok /*= true*/)
+{
+ Spell* spell = m_currentSpells[spellType];
+ if (!spell)
+ return;
+
+ if (spellType == CURRENT_CHANNELED_SPELL)
+ spell->SendChannelUpdate(0);
+
+ spell->finish(ok);
+}
+
bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skipAutorepeat, bool isAutoshoot) const
{
// We don't do loop here to explicitly show that melee spell is excluded.