mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Auras: define and implement attribute SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK
Closes #20148
This commit is contained in:
@@ -438,7 +438,7 @@ enum SpellAttr2
|
||||
enum SpellAttr3
|
||||
{
|
||||
SPELL_ATTR3_UNK0 = 0x00000001, // 0
|
||||
SPELL_ATTR3_UNK1 = 0x00000002, // 1
|
||||
SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK = 0x00000002, // 1 Ignores subclass mask check when checking proc
|
||||
SPELL_ATTR3_UNK2 = 0x00000004, // 2
|
||||
SPELL_ATTR3_BLOCKABLE_SPELL = 0x00000008, // 3 Only dmg class melee in 3.1.3
|
||||
SPELL_ATTR3_IGNORE_RESURRECTION_TIMER = 0x00000010, // 4 you don't have to wait to be resurrected with these spells
|
||||
|
||||
@@ -1803,31 +1803,37 @@ uint8 Aura::GetProcEffectMask(AuraApplication* aurApp, ProcEventInfo& eventInfo,
|
||||
Unit* target = aurApp->GetTarget();
|
||||
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
|
||||
if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK))
|
||||
{
|
||||
if (target->ToPlayer()->IsInFeralForm())
|
||||
return 0;
|
||||
|
||||
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
|
||||
Item* item = nullptr;
|
||||
if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
|
||||
{
|
||||
WeaponAttackType attType = damageInfo->GetAttackType();
|
||||
Item* item = nullptr;
|
||||
if (attType == BASE_ATTACK)
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
else if (attType == OFF_ATTACK)
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
else
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
|
||||
|
||||
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
|
||||
if (target->ToPlayer()->IsInFeralForm())
|
||||
return 0;
|
||||
|
||||
if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
|
||||
{
|
||||
switch (damageInfo->GetAttackType())
|
||||
{
|
||||
case BASE_ATTACK:
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
break;
|
||||
case OFF_ATTACK:
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
break;
|
||||
default:
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
|
||||
{
|
||||
// Check if player is wearing shield
|
||||
Item* item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
|
||||
else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
|
||||
{
|
||||
// Check if player is wearing shield
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
}
|
||||
|
||||
if (!item || item->IsBroken() || !item->IsFitToSpellRequirements(GetSpellInfo()))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user