mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Spells): Disarmed creatures should no cast spells that requi… (#7171)
* fix(Core/Spells): Disarmed creatures should no cast spells that requires weapon. Fixed #6404 Fixed #6764. * codestyle. Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -6518,6 +6518,12 @@ SpellCastResult Spell::CheckItems()
|
||||
Player* player = m_caster->ToPlayer();
|
||||
if (!player)
|
||||
{
|
||||
// Non-player case: Check if creature is disarmed
|
||||
if (!m_caster->CanUseAttackType(m_attackType) && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
|
||||
{
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
@@ -7048,11 +7054,11 @@ SpellCastResult Spell::CheckItems()
|
||||
|
||||
// skip spell if no weapon in slot or broken
|
||||
if (!item || item->IsBroken())
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND;
|
||||
|
||||
// skip spell if weapon not fit to triggered spell
|
||||
if (!item->IsFitToSpellRequirements(m_spellInfo))
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND;
|
||||
}
|
||||
|
||||
// offhand hand weapon required
|
||||
@@ -7062,11 +7068,11 @@ SpellCastResult Spell::CheckItems()
|
||||
|
||||
// skip spell if no weapon in slot or broken
|
||||
if (!item || item->IsBroken())
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND;
|
||||
|
||||
// skip spell if weapon not fit to triggered spell
|
||||
if (!item->IsFitToSpellRequirements(m_spellInfo))
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user