[11535] More wide use IsFitToFamilyMask

Simplify check for one from cases base at recheck spell data.
This commit is contained in:
VladimirMangos 2011-05-25 04:00:47 +04:00
parent 2cbde12458
commit 78a4460501
6 changed files with 47 additions and 57 deletions

View file

@ -696,39 +696,38 @@ void Spell::prepareDataForTriggerSystem()
{
case SPELLFAMILY_MAGE:
// Arcane Missiles / Blizzard triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200080))
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000200080)))
m_canTrigger = true;
// Clearcasting trigger need do it
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000200000000) && m_spellInfo->SpellFamilyFlags2 & 0x8)
else if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000200000000)))
m_canTrigger = true;
// Replenish Mana, item spell with triggered cases (Mana Agate, etc mana gems)
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000010000000000))
else if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000010000000000)))
m_canTrigger = true;
break;
case SPELLFAMILY_WARLOCK:
// For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000060))
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000800000000060)))
m_canTrigger = true;
break;
case SPELLFAMILY_PRIEST:
// For Penance,Mind Sear,Mind Flay heal/damage triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001800000800000) || (m_spellInfo->SpellFamilyFlags2 & 0x00000040))
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0001800000800000), 0x00000040))
m_canTrigger = true;
break;
case SPELLFAMILY_ROGUE:
// For poisons need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000000101001E000))
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x000000101001E000)))
m_canTrigger = true;
break;
case SPELLFAMILY_HUNTER:
// Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot
if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0100200000000214)) ||
m_spellInfo->SpellFamilyFlags2 & 0x200)
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0100200000000214), 0x00000200))
m_canTrigger = true;
break;
case SPELLFAMILY_PALADIN:
// For Judgements (all) / Holy Shock triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001000900B80400))
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0001000900B80400)))
m_canTrigger = true;
break;
default:
@ -1587,7 +1586,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
case SPELLFAMILY_DRUID:
{
if (m_spellInfo->SpellFamilyFlags2 & 0x00000100)// Starfall
// Starfall
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000100))
unMaxTargets = 2;
break;
}

View file

@ -6812,24 +6812,24 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
break;
case SPELLFAMILY_MAGE:
// Frost Ward, Fire Ward
if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108))
if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000108)))
//+10% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.1f;
// Ice Barrier
else if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000))
else if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000100000000)))
//+80.67% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.8067f;
break;
case SPELLFAMILY_WARLOCK:
// Shadow Ward
if (spellProto->SpellFamilyFlags2 & 0x00000040)
if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000040))
//+30% from +spell bonus
DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.30f;
break;
case SPELLFAMILY_PALADIN:
// Sacred Shield
// (check not strictly needed, only Sacred Shield has SPELL_AURA_SCHOOL_ABSORB in SPELLFAMILY_PALADIN at this time)
if (spellProto->SpellFamilyFlags & UI64LIT(0x0008000000000000))
if (spellProto->IsFitToFamilyMask(UI64LIT(0x0008000000000000)))
{
// +75% from spell power
DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)) * 0.75f;
@ -8484,27 +8484,23 @@ void SpellAuraHolder::_AddSpellAuraHolder()
m_target->ModifyAuraState(AURA_STATE_JUDGEMENT, true);
// Conflagrate aura state on Immolate and Shadowflame
if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK &&
// Immolate
((m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) ||
// Shadowflame
(m_spellProto->SpellFamilyFlags2 & 0x00000002)))
if (m_spellProto->IsFitToFamily(SPELLFAMILY_WARLOCK, UI64LIT(0x0000000000000004), 0x00000002))
m_target->ModifyAuraState(AURA_STATE_CONFLAGRATE, true);
// Faerie Fire (druid versions)
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400)))
if (m_spellProto->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000000000000400)))
m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE, true);
// Victorious
if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0004000000000000)))
if (m_spellProto->IsFitToFamily(SPELLFAMILY_WARRIOR, UI64LIT(0x0004000000000000)))
m_target->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, true);
// Swiftmend state on Regrowth & Rejuvenation
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && (m_spellProto->SpellFamilyFlags & UI64LIT(0x50)))
if (m_spellProto->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000000000000050)))
m_target->ModifyAuraState(AURA_STATE_SWIFTMEND, true);
// Deadly poison aura state
if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x10000)))
if (m_spellProto->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000010000)))
m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON, true);
// Enrage aura state
@ -8598,8 +8594,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder()
break;
case SPELLFAMILY_WARLOCK:
// Conflagrate aura state on Immolate and Shadowflame,
if ((m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) ||
(m_spellProto->SpellFamilyFlags2 & 0x00000002))
if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000004), 0x00000002))
{
removeFamilyFlag = UI64LIT(0x0000000000000004);
removeFamilyFlag2 = 0x00000002;
@ -8607,24 +8602,24 @@ void SpellAuraHolder::_RemoveSpellAuraHolder()
}
break;
case SPELLFAMILY_DRUID:
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400))
if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000400)))
removeState = AURA_STATE_FAERIE_FIRE; // Faerie Fire (druid versions)
else if(m_spellProto->SpellFamilyFlags & UI64LIT(0x50))
else if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000050)))
{
removeFamilyFlag = 0x50;
removeState = AURA_STATE_SWIFTMEND; // Swiftmend aura state
}
break;
case SPELLFAMILY_WARRIOR:
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0004000000000000))
if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0004000000000000)))
removeState = AURA_STATE_WARRIOR_VICTORY_RUSH; // Victorious
break;
case SPELLFAMILY_ROGUE:
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x10000))
if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000010000)))
removeState = AURA_STATE_DEADLY_POISON; // Deadly poison aura state
break;
case SPELLFAMILY_HUNTER:
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000))
if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x1000000000000000)))
removeState = AURA_STATE_FAERIE_FIRE; // Sting (hunter versions)
}
@ -8636,8 +8631,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder()
for (Unit::SpellAuraHolderMap::const_iterator i = holders.begin(); i != holders.end(); ++i)
{
SpellEntry const *auraSpellInfo = (*i).second->GetSpellProto();
if(auraSpellInfo->SpellFamilyName == m_spellProto->SpellFamilyName &&
(auraSpellInfo->SpellFamilyFlags & removeFamilyFlag || auraSpellInfo->SpellFamilyFlags2 & removeFamilyFlag2))
if (auraSpellInfo->IsFitToFamily(SpellFamily(m_spellProto->SpellFamilyName), removeFamilyFlag, removeFamilyFlag2))
{
found = true;
break;
@ -9031,7 +9025,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
return;
}
// Shadowflame (DoT)
else if (m_spellProto->SpellFamilyFlags2 & 0x00000002)
else if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000002))
{
// Glyph of Shadowflame
Unit* caster;
@ -9222,7 +9216,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
return;
}
// Aspect of the Dragonhawk dodge
else if (GetSpellProto()->SpellFamilyFlags2 & 0x00001000)
else if (GetSpellProto()->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00001000))
{
spellId1 = 61848;

View file

@ -508,14 +508,14 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
continue;
// Immolate
if ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000004))
if ((*i)->GetSpellProto()->IsFitToFamilyMask(UI64LIT(0x0000000000000004)))
{
aura = *i; // it selected always if exist
break;
}
// Shadowflame
if ((*i)->GetSpellProto()->SpellFamilyFlags2 & 0x00000002)
if ((*i)->GetSpellProto()->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000002))
aura = *i; // remember but wait possible Immolate as primary priority
}
@ -2681,7 +2681,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
case SPELLFAMILY_DRUID:
{
// Starfall
if (m_spellInfo->SpellFamilyFlags2 & 0x00000100)
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000100))
{
//Shapeshifting into an animal form or mounting cancels the effect.
if(m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted())
@ -3069,7 +3069,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
return;
}
// Lava Lash
if (m_spellInfo->SpellFamilyFlags2 & 0x00000004)
if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000004))
{
if (m_caster->GetTypeId()!=TYPEID_PLAYER)
return;

View file

@ -434,11 +434,11 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
return SPELL_CURSE;
// Warlock (Demon Armor | Demon Skin | Fel Armor)
if (spellInfo->SpellFamilyFlags & UI64LIT(0x2000002000000000) || spellInfo->SpellFamilyFlags2 & 0x00000010)
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x2000002000000000), 0x00000010))
return SPELL_WARLOCK_ARMOR;
// Unstable Affliction | Immolate
if (spellInfo->SpellFamilyFlags & UI64LIT(0x10000000004))
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x0000010000000004)))
return SPELL_UA_IMMOLATE;
break;
}
@ -458,7 +458,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
return SPELL_STING;
// only hunter aspects have this
if( spellInfo->SpellFamilyFlags & UI64LIT(0x0044000000380000) || spellInfo->SpellFamilyFlags2 & 0x00001010)
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x0044000000380000), 0x00001010))
return SPELL_ASPECT;
break;
@ -468,18 +468,18 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
if (IsSealSpell(spellInfo))
return SPELL_SEAL;
if (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000011010002))
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000011010002)))
return SPELL_BLESSING;
if (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002190))
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000002190)))
return SPELL_HAND;
// skip Heart of the Crusader that have also same spell family mask
if ((spellInfo->SpellFamilyFlags & UI64LIT(0x00000820180400)) && (spellInfo->AttributesEx3 & 0x200) && (spellInfo->SpellIconID != 237))
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x00000820180400)) && (spellInfo->AttributesEx3 & 0x200) && (spellInfo->SpellIconID != 237))
return SPELL_JUDGEMENT;
// only paladin auras have this (for palaldin class family)
if( spellInfo->SpellFamilyFlags2 & 0x00000020 )
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000020))
return SPELL_AURA;
break;

View file

@ -2224,7 +2224,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
// Fire Ward or Frost Ward or Ice Barrier (or Mana Shield)
// for Incanter's Absorption converting to spell power
if (spellProto->SpellFamilyName == SPELLFAMILY_MAGE && spellProto->SpellFamilyFlags2 & 0x000008)
if (spellProto->IsFitToFamily(SPELLFAMILY_MAGE, UI64LIT(0x0000000000000000), 0x00000008))
incanterAbsorption += currentAbsorb;
// Reduce shield amount
@ -2290,7 +2290,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
// Mana Shield (or Fire Ward or Frost Ward or Ice Barrier)
// for Incanter's Absorption converting to spell power
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && (*i)->GetSpellProto()->SpellFamilyFlags2 & 0x000008)
if ((*i)->GetSpellProto()->IsFitToFamily(SPELLFAMILY_MAGE, UI64LIT(0x0000000000000000), 0x000008))
incanterAbsorption += currentAbsorb;
(*i)->GetModifier()->m_amount -= currentAbsorb;
@ -5791,12 +5791,9 @@ bool Unit::HasAuraStateForCaster(AuraState flag, ObjectGuid casterGuid) const
Unit::AuraList const& dotList = GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for (Unit::AuraList::const_iterator i = dotList.begin(); i != dotList.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK &&
(*i)->GetCasterGuid() == casterGuid &&
// Immolate
(((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000004)) ||
// Shadowflame
((*i)->GetSpellProto()->SpellFamilyFlags2 & 0x00000002)))
if ((*i)->GetCasterGuid() == casterGuid &&
// Immolate or Shadowflame
(*i)->GetSpellProto()->IsFitToFamily(SPELLFAMILY_WARLOCK, UI64LIT(0x0000000000000004), 0x00000002))
{
return true;
}
@ -9792,8 +9789,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
{
if (spellProcEvent->spellFamilyMask[i] || spellProcEvent->spellFamilyMask2[i])
{
if ((spellProcEvent->spellFamilyMask[i] & procSpell->SpellFamilyFlags ) == 0 &&
(spellProcEvent->spellFamilyMask2[i] & procSpell->SpellFamilyFlags2) == 0)
if (!procSpell->IsFitToFamilyMask(spellProcEvent->spellFamilyMask[i], spellProcEvent->spellFamilyMask2[i]))
continue;
}
// don't check dbc FamilyFlags if schoolMask exists

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11534"
#define REVISION_NR "11535"
#endif // __REVISION_NR_H__