aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-01-01 00:14:19 +0100
committerShauren <shauren.trinity@gmail.com>2017-01-01 00:14:19 +0100
commit3d3d0492ab8dad40d5590e80f45bdfbdbcbe7497 (patch)
treeced1eb16bd46d497bb874a9b6f9835e9e164c27b /src
parent4df1b28054e6712954dceb8c71b18b4b2ef2e972 (diff)
Core/Spells: Check both main and offhand weapons if spell attributes require that (see Stormstrike)
* This restores the check probably unintentionally dropped in 14c2b2d6cd2303609f1a1859e727ace7b8ea649c * Build fix
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Spell.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index f1af42021ae..3e9702a9589 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -6551,25 +6551,9 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 /
// check weapon presence in slots for main/offhand weapons
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT) && m_spellInfo->EquippedItemClass >= 0)
{
- SpellCastResult itemRes = [this]() -> SpellCastResult
+ auto weaponCheck = [this](WeaponAttackType attackType) -> SpellCastResult
{
- switch (m_attackType)
- {
- case BASE_ATTACK:
- // main hand weapon required
- if (!m_spellInfo->HasAttribute(SPELL_ATTR3_MAIN_HAND))
- return SPELL_CAST_OK;
- break;
- case OFF_ATTACK:
- // offhand hand weapon required
- if (!m_spellInfo->HasAttribute(SPELL_ATTR3_REQ_OFFHAND))
- return SPELL_CAST_OK;
- break;
- default:
- return SPELL_CAST_OK;
- }
-
- Item const* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
+ Item const* item = m_caster->ToPlayer()->GetWeaponForAttack(attackType);
// skip spell if no weapon in slot or broken
if (!item || item->IsBroken())
@@ -6578,10 +6562,23 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 /
// skip spell if weapon not fit to triggered spell
if (!item->IsFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
- }();
- if (itemRes != SPELL_CAST_OK)
- return itemRes;
+ return SPELL_CAST_OK;
+ };
+
+ if (m_spellInfo->HasAttribute(SPELL_ATTR3_MAIN_HAND))
+ {
+ SpellCastResult mainHandResult = weaponCheck(BASE_ATTACK);
+ if (mainHandResult != SPELL_CAST_OK)
+ return mainHandResult;
+ }
+
+ if (m_spellInfo->HasAttribute(SPELL_ATTR3_REQ_OFFHAND))
+ {
+ SpellCastResult offHandResult = weaponCheck(OFF_ATTACK);
+ if (offHandResult != SPELL_CAST_OK)
+ return offHandResult;
+ }
}
return SPELL_CAST_OK;