fix(Core/Spells): Polymorphed targets should call assistance. (#8674)

Fixes #8413
This commit is contained in:
UltraNix
2021-10-24 07:58:54 +02:00
committed by GitHub
parent 96441a91dc
commit 16a54fdeac
3 changed files with 29 additions and 9 deletions

View File

@@ -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

View File

@@ -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; }

View File

@@ -1355,6 +1355,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else
caster->CastSpell(target, 61634, true);
}
if (Creature* creatureTarget = target->ToCreature())
{
creatureTarget->CallAssistance(caster);
}
}
switch (GetId())
{
@@ -1558,6 +1563,15 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
case SPELLFAMILY_MAGE:
{
// Polymorph
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
{
if (Creature* creatureTarget = target->ToCreature())
{
creatureTarget->SetNoCallAssistance(false);
}
}
switch (GetId())
{
case 66: // Invisibility
@@ -1570,12 +1584,12 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Remove the IGNORE_AURASTATE aura
target->RemoveAurasDueToSpell(44544);
break;
case 44401: //Missile Barrage
case 48108: //Hot Streak
case 57761: //Fireball!
case 44401: // Missile Barrage
case 48108: // Hot Streak
case 57761: // Fireball!
if (removeMode != AURA_REMOVE_BY_EXPIRE || aurApp->GetBase()->IsExpired())
break;
if (target->HasAura(70752)) //Item - Mage T10 2P Bonus
if (target->HasAura(70752)) // Item - Mage T10 2P Bonus
target->CastSpell(target, 70753, true);
break;
default:
@@ -1594,6 +1608,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
caster->CastSpell(target, 55080, true, nullptr, GetEffect(0));
}
break;
}
case SPELLFAMILY_WARRIOR:
if (!caster)
break;