Core/Units: send AI reactions uppon entering combat instead of attacking an enemy

This commit is contained in:
Ovahlord committed 2021-01-31 14:08:58 +01:00
1 parent 1e1ebf16bd
commit cc25457fe8
3 files changed
+9 -2

No files matched your search

@@ -3272,6 +3272,14 @@ bool Creature::IsEngaged() const
return false;
}
void Creature::AtEnterCombat()
{
Unit::AtEnterCombat();
if (GetAI() && !IsControlledByPlayer())
SendAIReaction(AI_REACTION_HOSTILE);
}
void Creature::AtEngage(Unit* target)
{
Unit::AtEngage(target);
@@ -364,6 +364,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void MakeInterruptable(bool apply);
bool IsEngaged() const override;
void AtEnterCombat() override;
void AtEngage(Unit* target) override;
void AtDisengage() override;
-2
View File
@@ -5586,8 +5586,6 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
if (creature && !IsControlledByPlayer())
{
EngageWithTarget(victim); // ensure that anything we're attacking has threat
creature->SendAIReaction(AI_REACTION_HOSTILE);
creature->CallAssistance();
// Remove emote state - will be restored on creature reset