fix(Core/Spells): Don't remove item-dependent auras on disarm/weapon swap (#25170)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com> Co-authored-by: ariel- <ariel-@users.noreply.github.com>
This commit is contained in:
parent
6d83465ad2
commit
749a31c3fa
1 changed files with 36 additions and 5 deletions
|
|
@ -12499,21 +12499,52 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
|
|||
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
|
||||
// Keep active non-passive auras (e.g. Bladestorm) when disarmed
|
||||
if (!spellInfo->IsPassive())
|
||||
{
|
||||
bool hasWeaponInSlot = false;
|
||||
for (uint8 i = EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i)
|
||||
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
{
|
||||
hasWeaponInSlot = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hasWeaponInSlot)
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (spellInfo->Effects[i].IsAura())
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ITEM_CLASS_ARMOR:
|
||||
{
|
||||
// most used check: shield only
|
||||
if (spellInfo->EquippedItemSubClassMask & (1 << ITEM_SUBCLASS_ARMOR_SHIELD))
|
||||
{
|
||||
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
|
||||
// Keep active non-passive auras (e.g. Shield Wall) when disarmed
|
||||
Item* offhand = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
if (!spellInfo->IsPassive() && offhand && offhand != ignoreItem)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (spellInfo->Effects[i].IsAura())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// tabard not have dependent spells
|
||||
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_MAINHAND; ++i)
|
||||
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
|
||||
// shields can be equipped to offhand slot
|
||||
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
|
||||
// ranged slot can have some armor subclasses
|
||||
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue