Pet/Guardian AI hook re-organizing

Port From (https://github.com/TrinityCore/TrinityCore/commit/f7a7d02a7f50400cdc2be3c4722afeefe7efce80)
This commit is contained in:
hondacrx
2020-07-22 15:27:19 -04:00
parent 61b6606dce
commit db44970987
5 changed files with 74 additions and 53 deletions
+11 -4
View File
@@ -2678,10 +2678,17 @@ namespace Game.Spells
// This prevents spells such as Hunter's Mark from triggering pet attack
if (m_spellInfo.DmgClass != SpellDmgClass.None)
{
Pet playerPet = playerCaster.GetPet();
if (playerPet != null)
if (playerPet.IsAlive() && playerPet.IsControlled() && Convert.ToBoolean(m_targets.GetTargetMask() & SpellCastTargetFlags.Unit))
playerPet.GetAI().OwnerAttacked(m_targets.GetUnitTarget());
Unit unitTarget = m_targets.GetUnitTarget();
if (unitTarget)
{
foreach (Unit controlled in playerCaster.m_Controlled)
{
Creature cControlled = controlled.ToCreature();
if (cControlled != null)
if (cControlled.IsAIEnabled)
cControlled.GetAI().OwnerAttacked(unitTarget);
}
}
}
}