*Fix bug with mindcontrol when aura interrupted on target is still on caster

*Fix bug with "stucked succubus"

--HG--
branch : trunk
This commit is contained in:
QAston
2009-01-20 20:32:23 +01:00
parent 013dd9bedb
commit 15403f0a8f
4 changed files with 28 additions and 16 deletions
+2 -2
View File
@@ -2114,7 +2114,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
} }
} }
void Spell::cancel() void Spell::cancel(bool report)
{ {
if(m_spellState == SPELL_STATE_FINISHED) if(m_spellState == SPELL_STATE_FINISHED)
return; return;
@@ -2144,7 +2144,7 @@ void Spell::cancel()
m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
SendChannelUpdate(0); SendChannelUpdate(0);
SendInterrupted(0); SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED); SendCastResult(report ? SPELL_FAILED_INTERRUPTED : SPELL_FAILED_DONT_REPORT);
} break; } break;
default: default:
+1 -1
View File
@@ -323,7 +323,7 @@ class Spell
~Spell(); ~Spell();
void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL); void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL);
void cancel(); void cancel(bool report = true);
void update(uint32 difftime); void update(uint32 difftime);
void cast(bool skipCheck = false); void cast(bool skipCheck = false);
void finish(bool ok = true); void finish(bool ok = true);
+24 -12
View File
@@ -4644,7 +4644,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
// Statue unsummoned at aura remove // Statue unsummoned at aura remove
Totem* statue = NULL; Totem* statue = NULL;
bool caster_channeled = false; bool channeled = false;
if(IsChanneledSpell(AurSpellInfo)) if(IsChanneledSpell(AurSpellInfo))
{ {
if(!caster) // can be already located for IsSingleTargetSpell case if(!caster) // can be already located for IsSingleTargetSpell case
@@ -4654,8 +4654,15 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
{ {
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
statue = ((Totem*)caster); statue = ((Totem*)caster);
else
caster_channeled = caster==this; // stop caster chanelling state
else if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL]
//prevent recurential call
&& caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
{
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(false);
channeled = true;
}
} }
} }
@@ -4683,8 +4690,13 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
delete Aur; delete Aur;
if(caster_channeled) if(channeled)
RemoveAurasAtChanneledTarget (AurSpellInfo); {
//if target is not caster remove auras also on caster
if (caster!=this)
caster->RemoveAurasAtChanneledTarget (AurSpellInfo, caster);
RemoveAurasAtChanneledTarget (AurSpellInfo, caster);
}
if(statue) if(statue)
statue->UnSummon(); statue->UnSummon();
@@ -12553,23 +12565,23 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura )
return true; return true;
} }
void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster)
{ {
uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); /* uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT);
if(target_guid == GetGUID()) if(target_guid == GetGUID())
return; return;
if(!IS_UNIT_GUID(target_guid)) if(!IS_UNIT_GUID(target_guid))
return; return;
Unit* target = ObjectAccessor::GetUnit(*this, target_guid); Unit* target = ObjectAccessor::GetUnit(*this, target_guid);*/
if(!target) if(!caster)
return; return;
for (AuraMap::iterator iter = target->GetAuras().begin(); iter != target->GetAuras().end(); ) for (AuraMap::iterator iter = GetAuras().begin(); iter != GetAuras().end(); )
{ {
if (iter->second->GetId() == spellInfo->Id && iter->second->GetCasterGUID()==GetGUID()) if (iter->second->GetId() == spellInfo->Id && iter->second->GetCasterGUID() == caster->GetGUID())
target->RemoveAura(iter); RemoveAura(iter);
else else
++iter; ++iter;
} }
+1 -1
View File
@@ -1110,7 +1110,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByCancel(uint32 spellId); void RemoveAurasDueToSpellByCancel(uint32 spellId);
void RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo); void RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster);
void RemoveNotOwnSingleTargetAuras(); void RemoveNotOwnSingleTargetAuras();
void RemoveSpellsCausingAura(AuraType auraType); void RemoveSpellsCausingAura(AuraType auraType);