Bugfix: cast items with target "TARGET_DEST_NEARBY_ENTRY" (e.g. item 7247) did not work because the if-clause only checks valid target units or game objects; fixed via additional check for target object type "TARGET_OBJECT_TYPE_DEST" and a valid target destination

This commit is contained in:
Stoabrogga
2018-05-08 16:29:00 +00:00
committed by Barbz
parent 97c08f02b7
commit 7e1c5b16ae

View File

@@ -3415,6 +3415,8 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
if (m_CastItem) if (m_CastItem)
{ {
bool selectTargets = false; bool selectTargets = false;
bool nearbyDest = false;
for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
{ {
if (!m_spellInfo->Effects[i].IsEffect()) if (!m_spellInfo->Effects[i].IsEffect())
@@ -3426,6 +3428,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
break; break;
} }
if (m_spellInfo->Effects[i].TargetA.GetObjectType() == TARGET_OBJECT_TYPE_DEST)
{
nearbyDest = true;
}
// xinef: by default set it to false, and to true if any valid target is found // xinef: by default set it to false, and to true if any valid target is found
selectTargets = true; selectTargets = true;
} }
@@ -3434,8 +3441,26 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
{ {
SelectSpellTargets(); SelectSpellTargets();
_spellTargetsSelected = true; _spellTargetsSelected = true;
bool spellFailed = false;
if (m_UniqueTargetInfo.empty() && m_UniqueGOTargetInfo.empty()) if (m_UniqueTargetInfo.empty() && m_UniqueGOTargetInfo.empty())
{
// no valid nearby target unit or game object found; check if nearby destination type
if (nearbyDest)
{
if (!m_targets.HasDst())
{
// no valid target destination
spellFailed = true;
}
}
else
{
spellFailed = true;
}
}
if (spellFailed)
{ {
SendCastResult(SPELL_FAILED_CASTER_AURASTATE); SendCastResult(SPELL_FAILED_CASTER_AURASTATE);
finish(false); finish(false);