*Do not let target get in combat until hit by attacker.
--HG-- branch : trunk
This commit is contained in:
@@ -58,7 +58,9 @@ class CreatureGroup
|
||||
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;
|
||||
|
||||
#define formation_mgr Trinity::Singleton<CreatureGroupManager>::Instance()
|
||||
|
||||
@@ -74,7 +74,6 @@ void PetAI::AttackStart(Unit *u)
|
||||
if(i_pet.Attack(u,true))
|
||||
{
|
||||
i_pet.SetInCombatWith(u);
|
||||
u->SetInCombatWith(&i_pet);
|
||||
|
||||
i_pet.clearUnitState(UNIT_STAT_FOLLOW);
|
||||
// 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)*/)
|
||||
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
|
||||
&& !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->AI())
|
||||
{
|
||||
SetInCombatWith(target);
|
||||
target->SetInCombatWith(this);
|
||||
((Creature*)target)->AI()->AttackStart(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetInCombatWith(target);
|
||||
target->SetInCombatWith(this);
|
||||
}
|
||||
|
||||
SetInCombatWith(target);
|
||||
target->SetInCombatWith(this);
|
||||
|
||||
Unit *who = target->GetCharmerOrOwnerOrSelf();
|
||||
if(who->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -9727,6 +9716,14 @@ void Unit::CombatStart(Unit* target)
|
||||
me->UpdatePvP(true);
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user