diff options
author | treeston <treeston.mmoc@gmail.com> | 2017-06-20 00:58:32 +0200 |
---|---|---|
committer | treeston <treeston.mmoc@gmail.com> | 2017-06-20 00:58:32 +0200 |
commit | 052fc24315ace866ea1cf610e85df119b68100c9 (patch) | |
tree | a487df4240cd352f1ae14e3edcc95a3905f1a1d0 /src | |
parent | fd07c4985e2728a9fdf938eeaf7539cce9426c3b (diff) |
Fix an overly strict check that was causing guardians to evade loop. Also make players properly enter combat when their pets are engaged by a creature.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/PetAI.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index e278d1f79fb..f27f9a0adb9 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -64,7 +64,6 @@ void PetAI::_stopAttack() { if (!me->IsAlive()) { - TC_LOG_DEBUG("misc", "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUID().GetCounter()); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->CombatStop(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 157b441d90a..bb08b9bc862 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5750,7 +5750,7 @@ void Unit::_removeAttacker(Unit* pAttacker) Unit* Unit::getAttackerForHelper() const // If someone wants to help, who to give them { if (Unit* victim = GetVictim()) - if (!IsControlledByPlayer() || IsInCombatWith(victim) || victim->IsInCombatWith(this)) + if ((!IsPet() && !GetPlayerMovingMe()) || IsInCombatWith(victim) || victim->IsInCombatWith(this)) return victim; if (!m_attackers.empty()) @@ -5857,6 +5857,14 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (victim->GetTypeId() == TYPEID_PLAYER) victim->SetInCombatWith(this); + if (Unit* owner = victim->GetOwner()) + { + AddThreat(owner, 0.0f); + SetInCombatWith(owner); + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetInCombatWith(this); + } + creature->SendAIReaction(AI_REACTION_HOSTILE); creature->CallAssistance(); |