[Spell] Minor refactoring
Like HasSpellEffect method here, other now global-scoped methods from SpellMgr.h should be transfered into corresponding classes/structures (TODO).
This commit is contained in:
parent
f26fb7adc6
commit
ef4564adfa
@ -3522,7 +3522,7 @@ bool ChatHandler::HandleAuraCommand(char* args)
|
||||
{ return false; }
|
||||
|
||||
if (!IsSpellAppliesAura(spellInfo, (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) &&
|
||||
!IsSpellHaveEffect(spellInfo, SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
||||
!spellInfo->HasSpellEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
||||
{
|
||||
PSendSysMessage(LANG_SPELL_NO_HAVE_AURAS, spellID);
|
||||
SetSentErrorMessage(true);
|
||||
|
@ -1794,16 +1794,7 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim)
|
||||
continue;
|
||||
}
|
||||
|
||||
bool bcontinue = true;
|
||||
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||
{
|
||||
if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL))
|
||||
{
|
||||
bcontinue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bcontinue)
|
||||
if (!spellInfo->HasSpellEffect(SPELL_EFFECT_HEAL))
|
||||
{ continue; }
|
||||
|
||||
if (spellInfo->manaCost > GetPower(POWER_MANA))
|
||||
|
@ -667,7 +667,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
|
||||
// used TARGET_T_ACTION_INVOKER, but likely should be _INVOKER_OWNER instead
|
||||
if (action.cast.target == TARGET_T_ACTION_INVOKER &&
|
||||
(IsSpellHaveEffect(spell, SPELL_EFFECT_QUEST_COMPLETE) || IsSpellHaveEffect(spell, SPELL_EFFECT_DUMMY)))
|
||||
(spell->HasSpellEffect(SPELL_EFFECT_QUEST_COMPLETE) || spell->HasSpellEffect(SPELL_EFFECT_DUMMY)))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u has TARGET_T_ACTION_INVOKER(%u) target type, but should have TARGET_T_ACTION_INVOKER_OWNER(%u).", i, j + 1, TARGET_T_ACTION_INVOKER, TARGET_T_ACTION_INVOKER_OWNER); }
|
||||
|
||||
// Spell that should only target players, but could get any
|
||||
|
@ -636,7 +636,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
||||
}
|
||||
|
||||
// Must be Aura, but also allow dummy/script effect spells, as they are used sometimes to select a random aura or similar
|
||||
if (!IsSpellAppliesAura(AdditionalSpellInfo) && !IsSpellHaveEffect(AdditionalSpellInfo, SPELL_EFFECT_DUMMY) && !IsSpellHaveEffect(AdditionalSpellInfo, SPELL_EFFECT_SCRIPT_EFFECT) && !IsSpellHaveEffect(AdditionalSpellInfo, SPELL_EFFECT_TRIGGER_SPELL))
|
||||
if (!IsSpellAppliesAura(AdditionalSpellInfo) && !AdditionalSpellInfo->HasSpellEffect(SPELL_EFFECT_DUMMY) && !AdditionalSpellInfo->HasSpellEffect(SPELL_EFFECT_SCRIPT_EFFECT) && !AdditionalSpellInfo->HasSpellEffect(SPELL_EFFECT_TRIGGER_SPELL))
|
||||
{
|
||||
sLog.outErrorDb("Creature (%s: %u) has spell %u defined in `auras` field in `%s, but spell doesn't apply an aura`.", guidEntryStr, addon->guidOrEntry, cAura, table);
|
||||
continue;
|
||||
|
@ -235,7 +235,7 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||
{ continue; }
|
||||
|
||||
// not allow instant kill autocasts as full health cost
|
||||
if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_INSTAKILL))
|
||||
if (spellInfo->HasSpellEffect(SPELL_EFFECT_INSTAKILL))
|
||||
{ continue; }
|
||||
}
|
||||
}
|
||||
|
@ -3008,7 +3008,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||
|
||||
// cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned)
|
||||
// note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive
|
||||
if (talentPos && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_LEARN_SPELL))
|
||||
if (talentPos && spellInfo->HasSpellEffect(SPELL_EFFECT_LEARN_SPELL))
|
||||
{
|
||||
// ignore stance requirement for talent learn spell (stance set for spell only for client spell description show)
|
||||
CastSpell(this, spell_id, true);
|
||||
@ -3018,7 +3018,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||
{
|
||||
CastSpell(this, spell_id, true);
|
||||
}
|
||||
else if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_SKILL_STEP))
|
||||
else if (spellInfo->HasSpellEffect(SPELL_EFFECT_SKILL_STEP))
|
||||
{
|
||||
CastSpell(this, spell_id, true);
|
||||
return false;
|
||||
@ -6956,7 +6956,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
|
||||
}
|
||||
|
||||
// not allow proc extra attack spell at extra attack
|
||||
if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
if (m_extraAttacks && spellInfo->HasSpellEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
{ return; }
|
||||
|
||||
float chance = (float)spellInfo->procChance;
|
||||
|
@ -513,13 +513,9 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
|
||||
if ((spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000020180400))) && spellInfo->baseLevel != 0)
|
||||
{ return SPELL_JUDGEMENT; }
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (spellInfo->HasSpellEffect(SPELL_EFFECT_APPLY_AREA_AURA_PARTY))
|
||||
// only paladin auras have this
|
||||
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
|
||||
{ return SPELL_AURA; }
|
||||
}
|
||||
break;
|
||||
{ return SPELL_AURA; }
|
||||
}
|
||||
case SPELLFAMILY_SHAMAN:
|
||||
{
|
||||
@ -3418,7 +3414,7 @@ void SpellMgr::LoadSpellLearnSpells()
|
||||
// talent or passive spells or skill-step spells auto-casted and not need dependent learning,
|
||||
// pet teaching spells don't must be dependent learning (casted)
|
||||
// other required explicit dependent learning
|
||||
dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(entry) || IsSpellHaveEffect(entry, SPELL_EFFECT_SKILL_STEP);
|
||||
dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(entry) || entry->HasSpellEffect(SPELL_EFFECT_SKILL_STEP);
|
||||
|
||||
SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
|
||||
|
||||
@ -4191,7 +4187,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (effectType >= 0 && !IsSpellHaveEffect(spellEntry, SpellEffects(effectType)))
|
||||
if (effectType >= 0 && !spellEntry->HasSpellEffect(SpellEffects(effectType)))
|
||||
{
|
||||
sLog.outError("Spell %u '%s' not have effect %u but used in %s.", spell, name.c_str(), effectType, code.c_str());
|
||||
continue;
|
||||
@ -4251,7 +4247,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (effectType >= 0 && !IsSpellHaveEffect(spellEntry, SpellEffects(effectType)))
|
||||
if (effectType >= 0 && !spellEntry->HasSpellEffect(SpellEffects(effectType)))
|
||||
{ continue; }
|
||||
|
||||
if (auraType >= 0 && !IsSpellHaveAura(spellEntry, AuraType(auraType)))
|
||||
|
@ -98,14 +98,6 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo);
|
||||
uint16 GetSpellAuraMaxTicks(uint32 spellId);
|
||||
WeaponAttackType GetWeaponAttackType(SpellEntry const* spellInfo);
|
||||
|
||||
inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect)
|
||||
{
|
||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
if (SpellEffects(spellInfo->Effect[i]) == effect)
|
||||
{ return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effecIdx)
|
||||
{
|
||||
switch (spellInfo->Effect[effecIdx])
|
||||
@ -202,7 +194,7 @@ inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)
|
||||
if (!IsPassiveSpell(spellProto))
|
||||
{ return false; }
|
||||
|
||||
return !IsSpellHaveEffect(spellProto, SPELL_EFFECT_APPLY_AURA);
|
||||
return !spellProto->HasSpellEffect(SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
|
||||
|
||||
@ -410,7 +402,7 @@ inline bool IsOnlySelfTargeting(SpellEntry const* spellInfo)
|
||||
|
||||
inline bool IsDispelSpell(SpellEntry const* spellInfo)
|
||||
{
|
||||
return IsSpellHaveEffect(spellInfo, SPELL_EFFECT_DISPEL);
|
||||
return spellInfo->HasSpellEffect(SPELL_EFFECT_DISPEL);
|
||||
}
|
||||
|
||||
inline bool isSpellBreakStealth(SpellEntry const* spellInfo)
|
||||
|
@ -6066,7 +6066,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
|
||||
{ return pdamage; }
|
||||
|
||||
// differentiate for weapon damage based spells
|
||||
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
|
||||
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || spellProto->HasSpellEffect(SPELL_EFFECT_SCHOOL_DAMAGE)));
|
||||
Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType, true, false) : NULL;
|
||||
uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
|
||||
uint32 schoolMask = spellProto ? GetSpellSchoolMask(spellProto) : uint32(GetMeleeDamageSchoolMask());
|
||||
@ -6156,7 +6156,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
|
||||
// weapon damage based spells
|
||||
else if (APbonus || DoneFlat)
|
||||
{
|
||||
bool normalized = spellProto ? IsSpellHaveEffect(spellProto, SPELL_EFFECT_NORMALIZED_WEAPON_DMG) : false;
|
||||
bool normalized = spellProto ? spellProto->HasSpellEffect(SPELL_EFFECT_NORMALIZED_WEAPON_DMG) : false;
|
||||
DoneTotal += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
|
||||
|
||||
// for weapon damage based spells we still have to apply damage done percent mods
|
||||
@ -6206,7 +6206,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* pCaster, uint32 pdamage, WeaponAttackTy
|
||||
{ return pdamage; }
|
||||
|
||||
// differentiate for weapon damage based spells
|
||||
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
|
||||
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || spellProto->HasSpellEffect(SPELL_EFFECT_SCHOOL_DAMAGE)));
|
||||
uint32 schoolMask = spellProto ? GetSpellSchoolMask(spellProto) : uint32(GetMeleeDamageSchoolMask());
|
||||
|
||||
// FLAT damage bonus auras
|
||||
|
@ -921,7 +921,7 @@ struct SpellEntry
|
||||
*/
|
||||
inline bool HasAttribute(SpellAttributesEx4 attribute) const { return AttributesEx4 & attribute; }
|
||||
|
||||
inline bool HasSpellEffect(uint16 effect) const
|
||||
inline bool HasSpellEffect(SpellEffects effect) const
|
||||
{
|
||||
for (uint8 i = EFFECT_INDEX_0; i <= EFFECT_INDEX_2; ++i)
|
||||
if (Effect[i] == effect)
|
||||
|
@ -4041,8 +4041,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
case SPELLFAMILY_SHAMAN:
|
||||
case SPELLFAMILY_PALADIN:
|
||||
{
|
||||
if (IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_HEAL) || IsSpellHaveAura(m_spellInfo, SPELL_AURA_PERIODIC_HEAL) ||
|
||||
IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_DISPEL))
|
||||
if (m_spellInfo->HasSpellEffect(SPELL_EFFECT_HEAL) || IsSpellHaveAura(m_spellInfo, SPELL_AURA_PERIODIC_HEAL) ||
|
||||
m_spellInfo->HasSpellEffect(SPELL_EFFECT_DISPEL))
|
||||
{
|
||||
Unit::AuraList const& auraClassScripts = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (Unit::AuraList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
|
||||
@ -4086,7 +4086,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
|
||||
// give error message when applying lower hot rank to higher hot rank on target
|
||||
if (!IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_HEAL) && IsSpellHaveAura(m_spellInfo, SPELL_AURA_PERIODIC_HEAL))
|
||||
if (!m_spellInfo->HasSpellEffect(SPELL_EFFECT_HEAL) && IsSpellHaveAura(m_spellInfo, SPELL_AURA_PERIODIC_HEAL))
|
||||
{
|
||||
Unit::AuraList const& mPeriodicHeal = target->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
|
||||
for (Unit::AuraList::const_iterator i = mPeriodicHeal.begin(); i != mPeriodicHeal.end(); ++i)
|
||||
|
@ -1161,7 +1161,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
|
||||
}
|
||||
|
||||
// not allow proc extra attack spell at extra attack
|
||||
if (m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
if (m_extraAttacks && triggerEntry->HasSpellEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
{ return SPELL_AURA_PROC_FAILED; }
|
||||
|
||||
// Custom basepoints/target for exist spell
|
||||
|
Loading…
x
Reference in New Issue
Block a user