mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7723] New AI call EnterCombat called at enter creature to combat (and re-enter if leave by some reason).
This commit is contained in:
parent
f2f817883a
commit
73db1cbe01
10 changed files with 30 additions and 25 deletions
|
|
@ -1118,7 +1118,7 @@ void CreatureEventAI::JustSummoned(Creature* pUnit)
|
|||
}
|
||||
}
|
||||
|
||||
void CreatureEventAI::Aggro(Unit *who)
|
||||
void CreatureEventAI::EnterCombat(Unit *enemy)
|
||||
{
|
||||
//Check for on combat start events
|
||||
if (!bEmptyList)
|
||||
|
|
@ -1129,7 +1129,7 @@ void CreatureEventAI::Aggro(Unit *who)
|
|||
{
|
||||
case EVENT_T_AGGRO:
|
||||
(*i).Enabled = true;
|
||||
ProcessEvent(*i, who);
|
||||
ProcessEvent(*i, enemy);
|
||||
break;
|
||||
//Reset all in combat timers
|
||||
case EVENT_T_TIMER:
|
||||
|
|
@ -1164,17 +1164,12 @@ void CreatureEventAI::AttackStart(Unit *who)
|
|||
if (!who)
|
||||
return;
|
||||
|
||||
bool inCombat = m_creature->isInCombat();
|
||||
|
||||
if (m_creature->Attack(who, MeleeEnabled))
|
||||
{
|
||||
m_creature->AddThreat(who, 0.0f);
|
||||
m_creature->SetInCombatWith(who);
|
||||
who->SetInCombatWith(m_creature);
|
||||
|
||||
if (!inCombat)
|
||||
Aggro(who);
|
||||
|
||||
if (CombatMovementEnabled)
|
||||
{
|
||||
m_creature->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
|
||||
|
|
@ -1233,8 +1228,8 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
|
|||
}
|
||||
else if (m_creature->GetMap()->IsDungeon())
|
||||
{
|
||||
who->SetInCombatWith(m_creature);
|
||||
m_creature->AddThreat(who, 0.0f);
|
||||
who->SetInCombatWith(m_creature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue