*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:
megamage
2009-01-30 01:14:48 -06:00
parent 8fe4fc3e47
commit 03234a0657
13 changed files with 5 additions and 28 deletions
-3
View File
@@ -148,9 +148,6 @@ AggressorAI::AttackStart(Unit *u)
if(i_creature.Attack(u,true))
{
i_creature.SetInCombatWith(u);
u->SetInCombatWith(&i_creature);
i_creature.AddThreat(u, 0.0f);
// DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow());
i_victimGuid = u->GetGUID();
-3
View File
@@ -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());
if(i_creature.Attack(u,true))
{
i_creature.SetInCombatWith(u);
u->SetInCombatWith(&i_creature);
i_creature.AddThreat(u, 0.0f);
i_victimGuid = u->GetGUID();
i_creature.GetMotionMaster()->MoveChase(u);
-2
View File
@@ -73,8 +73,6 @@ void PetAI::AttackStart(Unit *u)
if(i_pet.Attack(u,true))
{
i_pet.SetInCombatWith(u);
i_pet.clearUnitState(UNIT_STAT_FOLLOW);
// TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
// thus with the following clear the original TMG gets invalidated and crash, doh
-2
View File
@@ -50,8 +50,6 @@ ReactorAI::AttackStart(Unit *p)
if(i_creature.Attack(p,true))
{
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_victimGuid = p->GetGUID();
+5
View File
@@ -8203,6 +8203,11 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
((WorldObject*)this)->SendMessageToSet(&data, true);
((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