fix(DB/ZulGurub): Hoodoo Piles should not melee atack their targets. (#12269)

Will of Hakkar is casted on pile looter.
Fixes #12186
This commit is contained in:
UltraNix
2022-07-09 16:12:16 +02:00
committed by GitHub
parent bafc72e675
commit f6ede1a503
2 changed files with 9 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
--
UPDATE `creature_template` SET `flags_extra`=130 WHERE `entry`=15047;
DELETE FROM `smart_scripts` WHERE `entryorguid`=15047 AND `source_type`=0;
INSERT INTO `smart_scripts` VALUES
(15047,0,0,0,1,0,100,1,500,500,0,0,0,11,24178,0,0,0,0,0,23,0,0,0,0,0,0,0,0,'Gurubashi - OOC - Cast Will of Hakkar');

View File

@@ -2058,17 +2058,16 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
bool self = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER)
if (spellInfo->Effects[i].TargetA.GetReferenceType() == TARGET_REFERENCE_TYPE_CASTER && !spellInfo->Effects[i].TargetB.GetTarget())
{
self = true;
break;
}
}
if (self)
if (self && target && target->GetGUID() != GetGUID())
{
if (target)
target->CastSpell(target, spellInfo, true);
target->CastSpell(target, spellInfo, true);
return;
}