Core/Spells: Implement HasAttribute() helper for SpellInfo for easier readability
Original code by @Shocker (6.x branch)
This commit is contained in:
1 parent
e96676aedd
commit
2ac40775a2
18 files changed
+220
-210
No files matched your search
@@ -324,7 +324,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
case SPELLFAMILY_GENERIC:
|
||||
{
|
||||
// Meteor like spells (divided damage to targets)
|
||||
if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_SHARE_DAMAGE)
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_SHARE_DAMAGE))
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
@@ -1755,7 +1755,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
return;
|
||||
|
||||
if (unitTarget->GetMaxPower(power) == 0)
|
||||
@@ -1870,7 +1870,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
|
||||
return;
|
||||
|
||||
uint32 maxPower = unitTarget->GetMaxPower(power);
|
||||
@@ -5344,13 +5344,13 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
|
||||
if ((aura->GetSpellInfo()->GetDispelMask()) & dispelMask)
|
||||
{
|
||||
// Need check for passive? this
|
||||
if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_NOT_STEALABLE)
|
||||
if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_NOT_STEALABLE))
|
||||
continue;
|
||||
|
||||
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
|
||||
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
|
||||
// Polymorph instead of 1 / (5 + 1) -> 16%.
|
||||
bool dispel_charges = (aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES) != 0;
|
||||
bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_CHARGES);
|
||||
uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
|
||||
if (charges > 0)
|
||||
steal_list.push_back(std::make_pair(aura, charges));
|
||||
@@ -5852,7 +5852,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
|
||||
if (!p_caster->HasSpell(spell_id) || p_caster->HasSpellCooldown(spell_id))
|
||||
continue;
|
||||
|
||||
if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
|
||||
if (!spellInfo->HasAttribute(SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
|
||||
continue;
|
||||
|
||||
uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
|
||||
|
||||
Reference in new issue
Block a user