Core/Spells: Fix Corpse Explosion picking ghoul as a target without selection. (#83)

This commit is contained in:
Rival
2016-08-15 02:16:58 +04:00
committed by Shin
parent 7760bf753c
commit cdc96a7269

View File

@@ -1313,13 +1313,13 @@ class spell_dk_blood_gorged : public SpellScriptLoader
class CorpseExplosionCheck class CorpseExplosionCheck
{ {
public: public:
explicit CorpseExplosionCheck(uint64 casterGUID) : _casterGUID(casterGUID) { } explicit CorpseExplosionCheck(uint64 casterGUID, bool allowGhoul) : _casterGUID(casterGUID), _allowGhoul(allowGhoul) { }
bool operator()(WorldObject* obj) const bool operator()(WorldObject* obj) const
{ {
if (Unit* target = obj->ToUnit()) 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->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)
&& target->GetDisplayId() == target->GetNativeDisplayId()) && target->GetDisplayId() == target->GetNativeDisplayId())
return false; return false;
@@ -1360,7 +1360,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
void CheckTarget(WorldObject*& target) void CheckTarget(WorldObject*& target)
{ {
if (CorpseExplosionCheck(GetCaster()->GetGUID())(target)) if (CorpseExplosionCheck(GetCaster()->GetGUID(), true)(target))
target = NULL; target = NULL;
_target = target; _target = target;
@@ -1371,7 +1371,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
WorldObject* target = _target; WorldObject* target = _target;
if (!target) if (!target)
{ {
targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID())); targets.remove_if(CorpseExplosionCheck(GetCaster()->GetGUID(), false));
if (targets.empty()) if (targets.empty())
{ {
FinishCast(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); FinishCast(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);