aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rw-r--r--src/server/game/Spells/SpellMgr.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index a1e47697481..ec66d537640 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -2841,7 +2841,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
spellInfo->_InitializeExplicitTargetMask();
}
- // addition for binary spells, ommit spells triggering other spells
+ // addition for binary spells, omit spells triggering other spells
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
spellInfo = mSpellInfoMap[i];
@@ -2879,17 +2879,36 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
}
// remove attribute from spells that can't crit
+ // and mark triggering spell (instead of triggered spell) for spells with SPELL_ATTR4_INHERIT_CRIT_FROM_AURA
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
spellInfo = mSpellInfoMap[i];
if (!spellInfo)
continue;
- if (!spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
- continue;
-
if (spellInfo->HasAttribute(SPELL_ATTR2_CANT_CRIT))
spellInfo->AttributesCu &= ~SPELL_ATTR0_CU_CAN_CRIT;
+ else if (spellInfo->HasAttribute(SPELL_ATTR4_INHERIT_CRIT_FROM_AURA))
+ {
+ bool found = false;
+ for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ {
+ switch (spellInfo->Effects[j].ApplyAuraName)
+ {
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
+ if (SpellInfo* triggerSpell = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(spellInfo->Effects[j].TriggerSpell)))
+ if (triggerSpell->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
+ found = true;
+ break;
+ default:
+ continue;
+ }
+ }
+
+ if (found)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_CAN_CRIT;
+ }
}
TC_LOG_INFO("server.loading", ">> Loaded SpellInfo custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
@@ -4764,6 +4783,10 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->SpellFamilyFlags[0] |= 0x40;
break;
}
+
+ // allows those to calculate proper crit chance, that needs to be passed on to triggered spell
+ if (spellInfo->HasAttribute(SPELL_ATTR4_INHERIT_CRIT_FROM_AURA) && spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)
+ spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC;
}
if (SummonPropertiesEntry* properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121)))