mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Spells: Don't fail spells SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE when target list is empty for one effect
Closes #30603
This commit is contained in:
@@ -748,7 +748,7 @@ void Spell::SelectSpellTargets()
|
||||
{
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR1_REQUIRE_ALL_TARGETS))
|
||||
{
|
||||
bool noTargetFound = std::none_of(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [effectMask = 1u << spellEffectInfo.EffectIndex](TargetInfo const& target)
|
||||
bool noTargetFound = std::ranges::none_of(m_UniqueTargetInfo, [effectMask = 1u << spellEffectInfo.EffectIndex](TargetInfo const& target)
|
||||
{
|
||||
return target.EffectMask & effectMask;
|
||||
});
|
||||
@@ -760,20 +760,6 @@ void Spell::SelectSpellTargets()
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE))
|
||||
{
|
||||
bool anyNonImmuneTargetFound = std::any_of(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [effectMask = 1u << spellEffectInfo.EffectIndex](TargetInfo const& target)
|
||||
{
|
||||
return target.EffectMask & effectMask && target.MissCondition != SPELL_MISS_IMMUNE && target.MissCondition != SPELL_MISS_IMMUNE2;
|
||||
});
|
||||
|
||||
if (!anyNonImmuneTargetFound)
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_IMMUNE);
|
||||
finish(SPELL_FAILED_IMMUNE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_spellInfo->IsChanneled())
|
||||
@@ -798,6 +784,21 @@ void Spell::SelectSpellTargets()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE))
|
||||
{
|
||||
bool anyNonImmuneTargetFound = std::ranges::any_of(m_UniqueTargetInfo, [](TargetInfo const& target)
|
||||
{
|
||||
return target.MissCondition != SPELL_MISS_IMMUNE && target.MissCondition != SPELL_MISS_IMMUNE2;
|
||||
});
|
||||
|
||||
if (!anyNonImmuneTargetFound)
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_IMMUNE);
|
||||
finish(SPELL_FAILED_IMMUNE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_targets.HasDst())
|
||||
{
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR8_REQUIRES_LOCATION_TO_BE_ON_LIQUID_SURFACE))
|
||||
|
||||
Reference in New Issue
Block a user