refactor(Core/SpellMgr): Remove nested ifs for binary evaluation. (#19762)

* Init.

Co-Authored-By: Anton Popovichenko <walkline.ua@gmail.com>

* Whitespace.

* Tiny nitpick.

Co-Authored-By: Anton Popovichenko <walkline.ua@gmail.com>

* Tiny nitpick.*

Today Bench learns the difference between break and continue.

Co-Authored-By: Anton Popovichenko <walkline.ua@gmail.com>

* Parentheses warnings.

* Apply suggestion.

Co-Authored-By: Anton Popovichenko <walkline.ua@gmail.com>

---------

Co-authored-by: Anton Popovichenko <walkline.ua@gmail.com>
This commit is contained in:
Benjamin Jackson
2024-08-28 07:13:42 -04:00
committed by GitHub
parent 5ffbfdd5d6
commit b595586bf0

View File

@@ -3065,17 +3065,27 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
continue;
[[fallthrough]]; /// @todo: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
default:
if (spellInfo->Effects[j].CalcValue() || ((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH)) && !spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES)))
if (spellInfo->Id != 69649 && spellInfo->Id != 71056 && spellInfo->Id != 71057 && spellInfo->Id != 71058 && spellInfo->Id != 73061 && spellInfo->Id != 73062 && spellInfo->Id != 73063 && spellInfo->Id != 73064) // Sindragosa Frost Breath
if (spellInfo->SpellFamilyName != SPELLFAMILY_MAGE || !(spellInfo->SpellFamilyFlags[0] & 0x20)) // frostbolt
if (spellInfo->Id != 55095) // frost fever
if (spellInfo->SpellFamilyName != SPELLFAMILY_WARLOCK || !(spellInfo->SpellFamilyFlags[1] & 0x40000)) // Haunt
if (spellInfo->SpellFamilyName != SPELLFAMILY_WARLOCK || !(spellInfo->SpellFamilyFlags[0] & 0x4000)) // Drain Soul
{
spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL;
break;
}
continue;
if (!(spellInfo->Effects[j].CalcValue() &&
((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH)) &&
!spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))))
continue;
if (spellInfo->Id == 69649 || spellInfo->Id == 71056 || spellInfo->Id == 71057 || spellInfo->Id == 71058 ||
spellInfo->Id == 73061 || spellInfo->Id == 73062 || spellInfo->Id == 73063 || spellInfo->Id == 73064)
continue;
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->SpellFamilyFlags[0] & 0x20)) // Frostbolt
continue;
if (spellInfo->Id == 55095) // Frost Fever
continue;
if (spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK &&
((spellInfo->SpellFamilyFlags[1] & 0x40000) || (spellInfo->SpellFamilyFlags[0] & 0x4000))) // Haunt/Drain Soul
continue;
spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL;
break;
}
}
}