mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11740] Restore spellmod charges used by fail spell cast
Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also * Prevent more one charge use for same spell cast * Cleanup enum SpellState from unused cases * Propertly remove spellmod charges at spell finish in case pet/totem caster
This commit is contained in:
parent
f1bec402e9
commit
222612fa51
5 changed files with 63 additions and 26 deletions
|
|
@ -18696,10 +18696,10 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
|||
|
||||
void Player::RemoveSpellMods(Spell const* spell)
|
||||
{
|
||||
if(!spell || (m_SpellModRemoveCount == 0))
|
||||
if (!spell || (m_SpellModRemoveCount == 0))
|
||||
return;
|
||||
|
||||
for(int i=0;i<MAX_SPELLMOD;++i)
|
||||
for(int i = 0; i < MAX_SPELLMOD; ++i)
|
||||
{
|
||||
for (SpellModList::const_iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();)
|
||||
{
|
||||
|
|
@ -18718,6 +18718,31 @@ void Player::RemoveSpellMods(Spell const* spell)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::ResetSpellModsDueToCanceledSpell (Spell const* spell)
|
||||
{
|
||||
for(int i = 0; i < MAX_SPELLMOD; ++i )
|
||||
{
|
||||
for (SpellModList::const_iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end(); ++itr)
|
||||
{
|
||||
SpellModifier *mod = *itr;
|
||||
|
||||
if (mod->lastAffected != spell)
|
||||
continue;
|
||||
|
||||
mod->lastAffected = NULL;
|
||||
|
||||
if (mod->charges == -1)
|
||||
{
|
||||
mod->charges = 1;
|
||||
if (m_SpellModRemoveCount > 0)
|
||||
--m_SpellModRemoveCount;
|
||||
}
|
||||
else if (mod->charges > 0)
|
||||
++mod->charges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send Proficiency
|
||||
void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue