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.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 0296f7ceb4d..b2e214f915e 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -650,9 +650,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// no xp,health if type 8 /critters/
if ( pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
{
- // critters run away when hit
- pVictim->GetMotionMaster()->MoveFleeing(this);
-
// allow loot only if has loot_id in creature_template
if(damage >= pVictim->GetHealth())
{
@@ -750,13 +747,13 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if(damagetype != DOT)
{
- if(getVictim())
- {
+ if(!getVictim())
+ /*{
// if have target and damage pVictim just call AI reaction
if(pVictim != getVictim() && pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
((Creature*)pVictim)->AI()->AttackedBy(this);
}
- else
+ else*/
{
// if not have main target then attack state with target (including AI call)
//start melee attacks only after melee hit
@@ -8195,8 +8192,8 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
m_attacking = victim;
m_attacking->_addAttacker(this);
- if(m_attacking->GetTypeId()==TYPEID_UNIT && ((Creature*)m_attacking)->AI())
- ((Creature*)m_attacking)->AI()->AttackedBy(this);
+ //if(m_attacking->GetTypeId()==TYPEID_UNIT && ((Creature*)m_attacking)->AI())
+ // ((Creature*)m_attacking)->AI()->AttackedBy(this);
if(GetTypeId()==TYPEID_UNIT)
{
@@ -12904,7 +12901,13 @@ void Unit::SetFeared(bool apply)
Unit::AuraList const& fearAuras = GetAurasByType(SPELL_AURA_MOD_FEAR);
if(!fearAuras.empty())
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
- if(!caster) caster = getVictim();
+ if(!caster)
+ {
+ if(getVictim())
+ caster = getVictim();
+ else if(m_attackers.size())
+ caster = *m_attackers.begin();
+ }
GetMotionMaster()->MoveFleeing(caster); // caster==NULL processed in MoveFleeing
}
else