*Do not let target get in combat until hit by attacker.
--HG-- branch : trunk
This commit is contained in:
@@ -86,7 +86,6 @@ void ScriptedAI::AttackStart(Unit* who, bool melee)
|
|||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
m_creature->SetInCombatWith(who);
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
@@ -110,7 +109,6 @@ void ScriptedAI::AttackStart(Unit* who)
|
|||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
m_creature->SetInCombatWith(who);
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
@@ -823,7 +821,6 @@ void Scripted_NoMovementAI::AttackStart(Unit* who)
|
|||||||
{
|
{
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
m_creature->SetInCombatWith(who);
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1152,7 +1152,6 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
|||||||
//Begin melee attack if we are within range
|
//Begin melee attack if we are within range
|
||||||
m_creature->AddThreat(who, 0.0f);
|
m_creature->AddThreat(who, 0.0f);
|
||||||
m_creature->SetInCombatWith(who);
|
m_creature->SetInCombatWith(who);
|
||||||
who->SetInCombatWith(m_creature);
|
|
||||||
|
|
||||||
if (!InCombat)
|
if (!InCombat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ class CreatureGroup
|
|||||||
bool isEmpty() {return CreatureGroupMembers.empty();}
|
bool isEmpty() {return CreatureGroupMembers.empty();}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern UNORDERED_MAP<uint32, CreatureGroup*> CreatureGroupHolder;
|
typedef UNORDERED_MAP<uint32, CreatureGroup*> CreatureGroupHolderType;
|
||||||
|
|
||||||
|
extern CreatureGroupHolderType CreatureGroupHolder;
|
||||||
extern UNORDERED_MAP<uint32, FormationMember*> CreatureGroupMap;
|
extern UNORDERED_MAP<uint32, FormationMember*> CreatureGroupMap;
|
||||||
|
|
||||||
#define formation_mgr Trinity::Singleton<CreatureGroupManager>::Instance()
|
#define formation_mgr Trinity::Singleton<CreatureGroupManager>::Instance()
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ void PetAI::AttackStart(Unit *u)
|
|||||||
if(i_pet.Attack(u,true))
|
if(i_pet.Attack(u,true))
|
||||||
{
|
{
|
||||||
i_pet.SetInCombatWith(u);
|
i_pet.SetInCombatWith(u);
|
||||||
u->SetInCombatWith(&i_pet);
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+11
-14
@@ -9697,23 +9697,12 @@ void Unit::CombatStart(Unit* target)
|
|||||||
if(!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/)
|
if(!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/)
|
||||||
target->SetStandState(PLAYER_STATE_NONE);
|
target->SetStandState(PLAYER_STATE_NONE);
|
||||||
|
|
||||||
//Call creature group update
|
|
||||||
if(GetTypeId()==TYPEID_UNIT && ((Creature *)this)->GetFormationID() &&
|
|
||||||
CreatureGroupHolder.find(((Creature *)this)->GetFormationID()) != CreatureGroupHolder.end())
|
|
||||||
CreatureGroupHolder[((Creature *)this)->GetFormationID()]->MemberHasAttacked(((Creature *)this));
|
|
||||||
|
|
||||||
if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
||||||
&& !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->AI())
|
&& !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->AI())
|
||||||
{
|
|
||||||
SetInCombatWith(target);
|
|
||||||
target->SetInCombatWith(this);
|
|
||||||
((Creature*)target)->AI()->AttackStart(this);
|
((Creature*)target)->AI()->AttackStart(this);
|
||||||
}
|
|
||||||
else
|
SetInCombatWith(target);
|
||||||
{
|
target->SetInCombatWith(this);
|
||||||
SetInCombatWith(target);
|
|
||||||
target->SetInCombatWith(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit *who = target->GetCharmerOrOwnerOrSelf();
|
Unit *who = target->GetCharmerOrOwnerOrSelf();
|
||||||
if(who->GetTypeId() == TYPEID_PLAYER)
|
if(who->GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -9727,6 +9716,14 @@ void Unit::CombatStart(Unit* target)
|
|||||||
me->UpdatePvP(true);
|
me->UpdatePvP(true);
|
||||||
me->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
me->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Call creature group update
|
||||||
|
if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->GetFormationID())
|
||||||
|
{
|
||||||
|
CreatureGroupHolderType::iterator itr = CreatureGroupHolder.find(((Creature*)this)->GetFormationID());
|
||||||
|
if(itr != CreatureGroupHolder.end())
|
||||||
|
itr->second->MemberHasAttacked(((Creature*)this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SetInCombatState(bool PvP)
|
void Unit::SetInCombatState(bool PvP)
|
||||||
|
|||||||
Reference in New Issue
Block a user