aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-01-01 00:14:19 +0100
committerDoctorKraft <DoctorKraft@users.noreply.github.com>2018-03-18 00:19:48 +0100
commit111d205a6aac48f54fe59f46bfaa8f8dbd2b72e7 (patch)
tree5d3d66a2cae850cd5061b192145b114fe5b81997
parent8cff0d4a9062a2eedd0391e21e2cadb363d47904 (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 (cherry picked from commit 3d3d0492ab8dad40d5590e80f45bdfbdbcbe7497)
-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 558ff1907c8..e0623e54554 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -6693,25 +6693,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())
@@ -6720,10 +6704,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;