[10510] Reimplement aura stack checking EventAI events.

* In consistent with other EVENT_T_TARGET_* apply event
  to current combat target.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
kamikazetg 2010-09-20 13:26:43 +04:00 committed by VladimirMangos
parent 47397ff19b
commit 1544c97525
5 changed files with 29 additions and 31 deletions

View file

@ -310,7 +310,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_REACHED_HOME:
case EVENT_T_RECEIVE_EMOTE:
break;
case EVENT_T_BUFFED:
case EVENT_T_AURA:
{
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
if (!holder || holder->GetStackAmount() < event.buffed.amount)
@ -320,13 +320,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_TARGET_BUFFED:
case EVENT_T_TARGET_AURA:
{
//Prevent event from occuring on no unit
if (!pActionInvoker)
if (!m_creature->isInCombat() || !m_creature->getVictim())
return false;
SpellAuraHolder* holder = pActionInvoker->GetSpellAuraHolder(event.buffed.spellId);
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
if(!holder || holder->GetStackAmount() < event.buffed.amount)
return false;
@ -334,7 +333,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_MISSING_BUFF:
case EVENT_T_MISSING_AURA:
{
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
if (holder && holder->GetStackAmount() >= event.buffed.amount)
@ -344,13 +343,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_TARGET_MISSING_BUFF:
case EVENT_T_TARGET_MISSING_AURA:
{
//Prevent event from occuring on no unit
if (!pActionInvoker)
if (!m_creature->isInCombat() || !m_creature->getVictim())
return false;
SpellAuraHolder* holder = pActionInvoker->GetSpellAuraHolder(event.buffed.spellId);
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
if (holder && holder->GetStackAmount() >= event.buffed.amount)
return false;
@ -1172,10 +1170,10 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_CASTING:
case EVENT_T_FRIENDLY_HP:
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED: //FIXME: not work in this way
case EVENT_T_MISSING_BUFF:
case EVENT_T_TARGET_MISSING_BUFF: //FIXME: not work in this way
case EVENT_T_AURA:
case EVENT_T_TARGET_AURA:
case EVENT_T_MISSING_AURA:
case EVENT_T_TARGET_MISSING_AURA:
if (Combat)
ProcessEvent(*i);
break;