aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 900c7526fad..734182fa4cf 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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)