aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Creature.cpp12
-rw-r--r--src/game/CreatureAI.cpp9
2 files changed, 14 insertions, 7 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 3e857a34acc..6b018a6254f 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1706,8 +1706,16 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
// TODO: should switch to range attack
return false;
- if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
- return false;
+ if(!force)
+ {
+ if(who->isInCombat())
+ if(Unit *victim = who->getAttackerForHelper())
+ if(IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
+ force = true;
+
+ if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
+ return false;
+ }
if(!canCreatureAttack(who, force))
return false;
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 13889812e4c..20acf216c82 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -110,11 +110,10 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
if(me->canStartAttack(who, false))
AttackStart(who);
- else if(who->getVictim() && me->IsFriendlyTo(who)
- && me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
- //&& me->canStartAttack(who->getVictim(), true))
- && me->canStartAttack(who->getVictim(), false)) // TODO: if we use true, it will not attack it when it arrives
- me->GetMotionMaster()->MoveChase(who->getVictim());
+ //else if(who->getVictim() && me->IsFriendlyTo(who)
+ // && me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
+ // && me->canStartAttack(who->getVictim(), true)) // TODO: if we use true, it will not attack it when it arrives
+ // me->GetMotionMaster()->MoveChase(who->getVictim());
}
void CreatureAI::SelectNearestTarget(Unit *who)