mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/Spells: Corpse Explosion should not be able to pick the Ghoul out of implicit targets
This commit is contained in:
@@ -322,13 +322,14 @@ class spell_dk_blood_gorged : public SpellScriptLoader
|
||||
class CorpseExplosionCheck
|
||||
{
|
||||
public:
|
||||
explicit CorpseExplosionCheck(uint64 casterGUID) : _casterGUID(casterGUID) { }
|
||||
explicit CorpseExplosionCheck(uint64 casterGUID, bool allowGhoul) : _casterGUID(casterGUID),
|
||||
_allowGhoul(allowGhoul) { }
|
||||
|
||||
bool operator()(WorldObject* obj) const
|
||||
{
|
||||
if (Unit* target = obj->ToUnit())
|
||||
{
|
||||
if ((target->isDead() || (target->GetEntry() == NPC_DK_GHOUL && target->GetOwnerGUID() == _casterGUID))
|
||||
if ((target->isDead() || (_allowGhoul && target->GetEntry() == NPC_DK_GHOUL && target->GetOwnerGUID() == _casterGUID))
|
||||
&& !(target->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)
|
||||
&& target->GetDisplayId() == target->GetNativeDisplayId())
|
||||
return false;
|
||||
@@ -339,6 +340,7 @@ public:
|
||||
|
||||
private:
|
||||
uint64 _casterGUID;
|
||||
bool _allowGhoul;
|
||||
};
|
||||
|
||||
// 49158 - Corpse Explosion (51325, 51326, 51327, 51328)
|
||||
@@ -369,7 +371,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
|
||||
void CheckTarget(WorldObject*& target)
|
||||
{
|
||||
if (CorpseExplosionCheck(GetCaster()->GetGUID())(target))
|
||||
if (CorpseExplosionCheck(GetCaster()->GetGUID(), true)(target))
|
||||
target = NULL;
|
||||
|
||||
_target = target;
|
||||
@@ -380,7 +382,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
WorldObject* target = _target;
|
||||
if (!target)
|
||||
{
|
||||
targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID()));
|
||||
targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID(), false));
|
||||
if (targets.empty())
|
||||
{
|
||||
FinishCast(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
|
||||
|
||||
Reference in New Issue
Block a user