Core/Spells: rework part 1: Improved positive detection logic

# Conflicts:
#	src/server/game/Spells/SpellInfo.cpp
This commit is contained in:
ariel- authored and Ovahlord committed 2022-09-12 09:15:12 +02:00
1 parent 36b5e120af
commit 95bc5dcc40
5 files changed
+396 -228

No files matched your search

+15 -9
View File
@@ -2649,7 +2649,20 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
continue;
}
// TODO: validate attributes
if ((attributes & SPELL_ATTR0_CU_NEGATIVE) != 0)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effects[i].IsEffect())
continue;
if ((attributes & (SPELL_ATTR0_CU_NEGATIVE_EFF0 << i)) != 0)
{
TC_LOG_ERROR("sql.sql", "Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i));
continue;
}
}
}
spellInfo->AttributesCu |= attributes;
++count;
@@ -2849,14 +2862,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
spellInfo->AttributesCu |= SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC;
}
if (!spellInfo->_IsPositiveEffect(EFFECT_0, false))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
if (!spellInfo->_IsPositiveEffect(EFFECT_1, false))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF1;
if (!spellInfo->_IsPositiveEffect(EFFECT_2, false))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF2;
spellInfo->_InitializeSpellPositivity();
switch (spellInfo->SpellFamilyName)
{