*Fix some bugged AI which cause creatures enter evade mode repeatedly.
*Let player enter combat when attacked but not hit by creatures. --HG-- branch : trunk
This commit is contained in:
@@ -85,7 +85,6 @@ void ScriptedAI::AttackStart(Unit* who, bool melee)
|
|||||||
if (m_creature->Attack(who, melee))
|
if (m_creature->Attack(who, melee))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
@@ -108,7 +107,6 @@ void ScriptedAI::AttackStart(Unit* who)
|
|||||||
if (m_creature->Attack(who, true))
|
if (m_creature->Attack(who, true))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
@@ -834,7 +832,6 @@ void Scripted_NoMovementAI::AttackStart(Unit* who)
|
|||||||
if (m_creature->Attack(who, true))
|
if (m_creature->Attack(who, true))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1150,8 +1150,6 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
|||||||
if (m_creature->Attack(who, MeleeEnabled))
|
if (m_creature->Attack(who, MeleeEnabled))
|
||||||
{
|
{
|
||||||
//Begin melee attack if we are within range
|
//Begin melee attack if we are within range
|
||||||
m_creature->AddThreat(who, 0.0f);
|
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ void npc_escortAI::AttackStart(Unit *who)
|
|||||||
if ( m_creature->Attack(who, true) )
|
if ( m_creature->Attack(who, true) )
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -440,7 +440,6 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
|
|||||||
Akama->AddThreat(m_creature, 10000000.0f);
|
Akama->AddThreat(m_creature, 10000000.0f);
|
||||||
m_creature->Attack(Akama, true);
|
m_creature->Attack(Akama, true);
|
||||||
Akama->Attack(m_creature, true);
|
Akama->Attack(m_creature, true);
|
||||||
m_creature->SetInCombatWith(Akama);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,8 +170,6 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI
|
|||||||
if (m_creature->Attack(who, true))
|
if (m_creature->Attack(who, true))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -522,7 +522,6 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
|
|||||||
Malone->setFaction(14);
|
Malone->setFaction(14);
|
||||||
Malone->GetMotionMaster()->MoveChase(player);
|
Malone->GetMotionMaster()->MoveChase(player);
|
||||||
}
|
}
|
||||||
m_creature->SetInCombatWith(player);
|
|
||||||
DoStartMovement(player);
|
DoStartMovement(player);
|
||||||
AttackStart(player);
|
AttackStart(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI
|
|||||||
if (m_creature->Attack(who, true))
|
if (m_creature->Attack(who, true))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1211,8 +1211,6 @@ struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_
|
|||||||
if (m_creature->Attack(who, true))
|
if (m_creature->Attack(who, true))
|
||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
@@ -1497,9 +1495,6 @@ struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
if (m_creature->Attack(who, false))
|
if (m_creature->Attack(who, false))
|
||||||
{
|
{
|
||||||
m_creature->SetInCombatWith(who);
|
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
InCombat = true;
|
InCombat = true;
|
||||||
|
|||||||
@@ -148,9 +148,6 @@ AggressorAI::AttackStart(Unit *u)
|
|||||||
|
|
||||||
if(i_creature.Attack(u,true))
|
if(i_creature.Attack(u,true))
|
||||||
{
|
{
|
||||||
i_creature.SetInCombatWith(u);
|
|
||||||
u->SetInCombatWith(&i_creature);
|
|
||||||
|
|
||||||
i_creature.AddThreat(u, 0.0f);
|
i_creature.AddThreat(u, 0.0f);
|
||||||
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
|
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
|
||||||
i_victimGuid = u->GetGUID();
|
i_victimGuid = u->GetGUID();
|
||||||
|
|||||||
@@ -139,9 +139,6 @@ void GuardAI::AttackStart(Unit *u)
|
|||||||
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
|
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
|
||||||
if(i_creature.Attack(u,true))
|
if(i_creature.Attack(u,true))
|
||||||
{
|
{
|
||||||
i_creature.SetInCombatWith(u);
|
|
||||||
u->SetInCombatWith(&i_creature);
|
|
||||||
|
|
||||||
i_creature.AddThreat(u, 0.0f);
|
i_creature.AddThreat(u, 0.0f);
|
||||||
i_victimGuid = u->GetGUID();
|
i_victimGuid = u->GetGUID();
|
||||||
i_creature.GetMotionMaster()->MoveChase(u);
|
i_creature.GetMotionMaster()->MoveChase(u);
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ void PetAI::AttackStart(Unit *u)
|
|||||||
|
|
||||||
if(i_pet.Attack(u,true))
|
if(i_pet.Attack(u,true))
|
||||||
{
|
{
|
||||||
i_pet.SetInCombatWith(u);
|
|
||||||
|
|
||||||
i_pet.clearUnitState(UNIT_STAT_FOLLOW);
|
i_pet.clearUnitState(UNIT_STAT_FOLLOW);
|
||||||
// TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
|
// TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
|
||||||
// thus with the following clear the original TMG gets invalidated and crash, doh
|
// thus with the following clear the original TMG gets invalidated and crash, doh
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ ReactorAI::AttackStart(Unit *p)
|
|||||||
if(i_creature.Attack(p,true))
|
if(i_creature.Attack(p,true))
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Tag unit GUID: %u (TypeId: %u) as a victim", p->GetGUIDLow(), p->GetTypeId());
|
DEBUG_LOG("Tag unit GUID: %u (TypeId: %u) as a victim", p->GetGUIDLow(), p->GetTypeId());
|
||||||
i_creature.SetInCombatWith(p);
|
|
||||||
p->SetInCombatWith(&i_creature);
|
|
||||||
|
|
||||||
i_creature.AddThreat(p, 0.0f);
|
i_creature.AddThreat(p, 0.0f);
|
||||||
i_victimGuid = p->GetGUID();
|
i_victimGuid = p->GetGUID();
|
||||||
|
|||||||
@@ -8203,6 +8203,11 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
|||||||
((WorldObject*)this)->SendMessageToSet(&data, true);
|
((WorldObject*)this)->SendMessageToSet(&data, true);
|
||||||
|
|
||||||
((Creature*)this)->CallAssistance();
|
((Creature*)this)->CallAssistance();
|
||||||
|
|
||||||
|
// should not let player enter combat by right clicking target
|
||||||
|
SetInCombatWith(victim);
|
||||||
|
if(victim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
victim->SetInCombatWith(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delay offhand weapon attack to next attack time
|
// delay offhand weapon attack to next attack time
|
||||||
|
|||||||
Reference in New Issue
Block a user