mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
fix(Core/Spells): Polymorphed targets should call assistance. (#8674)
Fixes #8413
This commit is contained in:
@@ -2192,9 +2192,14 @@ void Creature::SendAIReaction(AiReaction reactionType)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
|
||||
}
|
||||
|
||||
void Creature::CallAssistance()
|
||||
void Creature::CallAssistance(Unit* target /*= nullptr*/)
|
||||
{
|
||||
if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !IsCharmed())
|
||||
if (!target)
|
||||
{
|
||||
target = GetVictim();
|
||||
}
|
||||
|
||||
if (!m_AlreadyCallAssistance && target && !IsPet() && !IsCharmed())
|
||||
{
|
||||
SetNoCallAssistance(true);
|
||||
|
||||
@@ -2204,13 +2209,13 @@ void Creature::CallAssistance()
|
||||
{
|
||||
std::list<Creature*> assistList;
|
||||
|
||||
Acore::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
|
||||
Acore::AnyAssistCreatureInRangeCheck u_check(this, target, radius);
|
||||
Acore::CreatureListSearcher<Acore::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check);
|
||||
Cell::VisitGridObjects(this, searcher, radius);
|
||||
|
||||
if (!assistList.empty())
|
||||
{
|
||||
AssistDelayEvent* e = new AssistDelayEvent(GetVictim()->GetGUID(), this);
|
||||
AssistDelayEvent* e = new AssistDelayEvent(target->GetGUID(), this);
|
||||
while (!assistList.empty())
|
||||
{
|
||||
// Pushing guids because in delay can happen some creature gets despawned => invalid pointer
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
|
||||
void DoFleeToGetAssistance();
|
||||
void CallForHelp(float fRadius);
|
||||
void CallAssistance();
|
||||
void CallAssistance(Unit* target = nullptr);
|
||||
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
|
||||
void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
|
||||
bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
|
||||
|
||||
Reference in New Issue
Block a user