aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index b2ab5a8a57e..64f089cf56a 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1363,14 +1363,14 @@ bool SpellInfo::NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell, uin
bool SpellInfo::IsPassive() const
{
- return (Attributes & SPELL_ATTR0_PASSIVE) != 0;
+ return HasAttribute(SPELL_ATTR0_PASSIVE);
}
bool SpellInfo::IsAutocastable() const
{
- if (Attributes & SPELL_ATTR0_PASSIVE)
+ if (IsPassive())
return false;
- if (AttributesEx & SPELL_ATTR1_UNAUTOCASTABLE_BY_PET)
+ if (HasAttribute(SPELL_ATTR1_UNAUTOCASTABLE_BY_PET))
return false;
return true;
}
@@ -1419,12 +1419,12 @@ bool SpellInfo::IsMultiSlotAura() const
bool SpellInfo::IsStackableOnOneSlotWithDifferentCasters() const
{
/// TODO: Re-verify meaning of SPELL_ATTR3_STACK_FOR_DIFF_CASTERS and update conditions here
- return StackAmount > 1 && !IsChanneled() && !(AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS);
+ return StackAmount > 1 && !IsChanneled() && !HasAttribute(SPELL_ATTR3_STACK_FOR_DIFF_CASTERS);
}
bool SpellInfo::IsCooldownStartedOnEvent() const
{
- if (Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (HasAttribute(SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
return true;
SpellCategoryEntry const* category = sSpellCategoryStore.LookupEntry(CategoryId);
@@ -1433,27 +1433,27 @@ bool SpellInfo::IsCooldownStartedOnEvent() const
bool SpellInfo::IsDeathPersistent() const
{
- return (AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT) != 0;
+ return HasAttribute(SPELL_ATTR3_DEATH_PERSISTENT);
}
bool SpellInfo::IsRequiringDeadTarget() const
{
- return (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0;
+ return HasAttribute(SPELL_ATTR3_ONLY_TARGET_GHOSTS);
}
bool SpellInfo::IsAllowingDeadTarget() const
{
- return AttributesEx2 & SPELL_ATTR2_CAN_TARGET_DEAD || Targets & (TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_DEAD);
+ return HasAttribute(SPELL_ATTR2_CAN_TARGET_DEAD) || Targets & (TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_DEAD);
}
bool SpellInfo::CanBeUsedInCombat() const
{
- return !(Attributes & SPELL_ATTR0_CANT_USED_IN_COMBAT);
+ return !HasAttribute(SPELL_ATTR0_CANT_USED_IN_COMBAT);
}
bool SpellInfo::IsPositive() const
{
- return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE);
+ return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE);
}
bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
@@ -1462,27 +1462,27 @@ bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
{
default:
case 0:
- return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF0);
+ return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF0);
case 1:
- return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF1);
+ return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF1);
case 2:
- return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF2);
+ return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF2);
}
}
bool SpellInfo::IsChanneled() const
{
- return (AttributesEx & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2)) != 0;
+ return HasAttribute(SPELL_ATTR1_CHANNELED_1) || HasAttribute(SPELL_ATTR1_CHANNELED_2);
}
bool SpellInfo::NeedsComboPoints() const
{
- return (AttributesEx & (SPELL_ATTR1_REQ_COMBO_POINTS1 | SPELL_ATTR1_REQ_COMBO_POINTS2)) != 0;
+ return HasAttribute(SPELL_ATTR1_REQ_COMBO_POINTS1) || HasAttribute(SPELL_ATTR1_REQ_COMBO_POINTS2);
}
bool SpellInfo::IsBreakingStealth() const
{
- return !(AttributesEx & SPELL_ATTR1_NOT_BREAK_STEALTH);
+ return !HasAttribute(SPELL_ATTR1_NOT_BREAK_STEALTH);
}
bool SpellInfo::IsRangedWeaponSpell() const
@@ -1493,7 +1493,7 @@ bool SpellInfo::IsRangedWeaponSpell() const
bool SpellInfo::IsAutoRepeatRangedSpell() const
{
- return (AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) != 0;
+ return HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG);
}
bool SpellInfo::HasInitialAggro() const
@@ -1503,7 +1503,7 @@ bool SpellInfo::HasInitialAggro() const
bool SpellInfo::IsAffectedBySpellMods() const
{
- return !(AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS);
+ return !HasAttribute(SPELL_ATTR3_NO_DONE_BONUS);
}
bool SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
@@ -1526,11 +1526,11 @@ bool SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
{
// these spells pierce all avalible spells (Resurrection Sickness for example)
- if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
+ if (HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
return true;
// these spells (Cyclone for example) can pierce all... // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
- if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || aura->Mechanic == MECHANIC_BANISH)))
+ if (HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || aura->Mechanic == MECHANIC_BANISH)))
return true;
return false;
@@ -1539,7 +1539,7 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
{
// These spells (like Mass Dispel) can dispell all auras, except death persistent ones (like Dungeon and Battleground Deserter)
- if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY && !aura->IsDeathPersistent())
+ if (HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && !aura->IsDeathPersistent())
return true;
// These auras (like Divine Shield) can't be dispelled
@@ -1556,7 +1556,7 @@ bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
bool SpellInfo::IsSingleTarget() const
{
// all other single target spells have if it has AttributesEx5
- if (AttributesEx5 & SPELL_ATTR5_SINGLE_TARGET_SPELL)
+ if (HasAttribute(SPELL_ATTR5_SINGLE_TARGET_SPELL))
return true;
switch (GetSpellSpecific())
@@ -1657,7 +1657,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
if (actAsShifted)
{
- if (Attributes & SPELL_ATTR0_NOT_SHAPESHIFT || (shapeInfo && shapeInfo->Flags & SHAPESHIFT_FORM_PREVENT_USING_OWN_SKILLS)) // not while shapeshifted
+ if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT) || (shapeInfo && shapeInfo->Flags & SHAPESHIFT_FORM_PREVENT_USING_OWN_SKILLS)) // not while shapeshifted
return SPELL_FAILED_NOT_SHAPESHIFT;
else if (Stances != 0) // needs other shapeshift
return SPELL_FAILED_ONLY_SHAPESHIFT;
@@ -1665,7 +1665,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
else
{
// needs shapeshift
- if (!(AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && Stances != 0)
+ if (!HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && Stances != 0)
return SPELL_FAILED_ONLY_SHAPESHIFT;
}
@@ -1693,7 +1693,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
}
// continent limitation (virtual continent)
- if (AttributesEx4 & SPELL_ATTR4_CAST_ONLY_IN_OUTLAND)
+ if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
{
uint32 v_map = sDB2Manager.GetVirtualMapForMapAndZone(map_id, zone_id);
MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
@@ -1702,7 +1702,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
}
// raid instance limitation
- if (AttributesEx6 & SPELL_ATTR6_NOT_IN_RAID_INSTANCE)
+ if (HasAttribute(SPELL_ATTR6_NOT_IN_RAID_INSTANCE))
{
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if (!mapEntry || mapEntry->IsRaid())
@@ -1825,11 +1825,11 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* target, bool implicit) const
{
- if (AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF && caster == target)
+ if (HasAttribute(SPELL_ATTR1_CANT_TARGET_SELF) && caster == target)
return SPELL_FAILED_BAD_TARGETS;
// check visibility - ignore stealth for implicit (area) targets
- if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->CanSeeOrDetect(target, implicit))
+ if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->CanSeeOrDetect(target, implicit))
return SPELL_FAILED_BAD_TARGETS;
Unit const* unitTarget = target->ToUnit();
@@ -1837,7 +1837,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
// creature/player specific target checks
if (unitTarget)
{
- if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT)
+ if (HasAttribute(SPELL_ATTR1_CANT_TARGET_IN_COMBAT))
{
if (unitTarget->IsInCombat())
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
@@ -1849,9 +1849,9 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
}
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
- if (((AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST))
+ if (HasAttribute(SPELL_ATTR3_ONLY_TARGET_GHOSTS) != unitTarget->HasAuraType(SPELL_AURA_GHOST))
{
- if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS)
+ if (HasAttribute(SPELL_ATTR3_ONLY_TARGET_GHOSTS))
return SPELL_FAILED_TARGET_NOT_GHOST;
else
return SPELL_FAILED_BAD_TARGETS;
@@ -1862,12 +1862,12 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (caster->GetTypeId() == TYPEID_PLAYER)
{
// Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
- if (AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED)
+ if (HasAttribute(SPELL_ATTR2_CANT_TARGET_TAPPED))
if (Creature const* targetCreature = unitTarget->ToCreature())
if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
- if (AttributesCu & SPELL_ATTR0_CU_PICKPOCKET)
+ if (HasAttribute(SPELL_ATTR0_CU_PICKPOCKET))
{
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
@@ -1907,21 +1907,21 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
else return SPELL_CAST_OK;
// corpseOwner and unit specific target checks
- if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS && !unitTarget->ToPlayer())
+ if (HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS) && unitTarget->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_TARGET_NOT_PLAYER;
if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
return SPELL_FAILED_TARGETS_DEAD;
// check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
- if (implicit && AttributesEx6 & SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED && !unitTarget->CanFreeMove())
+ if (implicit && HasAttribute(SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED) && !unitTarget->CanFreeMove())
return SPELL_FAILED_BAD_TARGETS;
// checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
- //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
+ //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
// return SPELL_FAILED_BAD_TARGETS;
- //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS)
+ //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS))
if (!CheckTargetCreatureType(unitTarget))
{
@@ -1942,7 +1942,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
}
// not allow casting on flying player
- if (unitTarget->HasUnitState(UNIT_STATE_IN_FLIGHT) && !(AttributesCu & SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET))
+ if (unitTarget->HasUnitState(UNIT_STATE_IN_FLIGHT) && !HasAttribute(SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET))
return SPELL_FAILED_BAD_TARGETS;
/* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to
@@ -2044,7 +2044,7 @@ SpellCastResult SpellInfo::CheckVehicle(Unit const* caster) const
checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster);
- if (!(AttributesEx6 & SPELL_ATTR6_CASTABLE_WHILE_ON_VEHICLE) && !(Attributes & SPELL_ATTR0_CASTABLE_WHILE_MOUNTED)
+ if (!HasAttribute(SPELL_ATTR6_CASTABLE_WHILE_ON_VEHICLE) && !HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED)
&& (vehicleSeat->Flags[0] & checkMask) != checkMask)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
@@ -2491,7 +2491,7 @@ uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= NULL*/) const
if (spell)
spell->GetCaster()->ModSpellCastTime(this, castTime, spell);
- if (Attributes & SPELL_ATTR0_REQ_AMMO && (!IsAutoRepeatRangedSpell()) && !(AttributesEx9 & SPELL_ATTR9_AIMED_SHOT))
+ if (HasAttribute(SPELL_ATTR0_REQ_AMMO) && !IsAutoRepeatRangedSpell() && !HasAttribute(SPELL_ATTR9_AIMED_SHOT))
castTime += 500;
return (castTime > 0) ? uint32(castTime) : 0;
@@ -2544,7 +2544,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
continue;
// Spell drain all exist power on cast (Only paladin lay of Hands)
- if (AttributesEx & SPELL_ATTR1_DRAIN_ALL_POWER)
+ if (HasAttribute(SPELL_ATTR1_DRAIN_ALL_POWER))
{
// If power type - health drain all
if (power->PowerType == POWER_HEALTH)
@@ -2612,7 +2612,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
}
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
- if (AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST)
+ if (HasAttribute(SPELL_ATTR4_SPELL_VS_EXTEND_COST))
{
uint32 speed = 0;
if (SpellShapeshiftFormEntry const* ss = sSpellShapeshiftFormStore.LookupEntry(caster->GetShapeshiftForm()))
@@ -2620,7 +2620,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
else
{
WeaponAttackType slot = BASE_ATTACK;
- if (AttributesEx3 & SPELL_ATTR3_REQ_OFFHAND)
+ if (HasAttribute(SPELL_ATTR3_REQ_OFFHAND))
slot = OFF_ATTACK;
speed = caster->GetAttackTime(slot);
@@ -2640,7 +2640,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
if (!caster->IsControlledByPlayer() && G3D::fuzzyEq(power->ManaCostPercentage, 0.0f) && SpellLevel)
{
- if (Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)
+ if (HasAttribute(SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION))
{
GtNpcManaCostScalerEntry const* spellScaler = sNpcManaCostScalerGameTable.GetRow(SpellLevel);
GtNpcManaCostScalerEntry const* casterScaler = sNpcManaCostScalerGameTable.GetRow(caster->getLevel());
@@ -3015,7 +3015,7 @@ void SpellInfo::_InitializeExplicitTargetMask()
bool SpellInfo::_IsPositiveEffect(uint32 effIndex, bool deep) const
{
// not found a single positive spell with this attribute
- if (Attributes & SPELL_ATTR0_NEGATIVE_1)
+ if (HasAttribute(SPELL_ATTR0_NEGATIVE_1))
return false;
switch (SpellFamilyName)
@@ -3208,7 +3208,7 @@ bool SpellInfo::_IsPositiveEffect(uint32 effIndex, bool deep) const
if (effect->TargetA.GetTarget() != TARGET_UNIT_CASTER)
return false;
// but not this if this first effect (didn't find better check)
- if (Attributes & SPELL_ATTR0_NEGATIVE_1 && effIndex == 0)
+ if (HasAttribute(SPELL_ATTR0_NEGATIVE_1) && effIndex == 0)
return false;
break;
case SPELL_AURA_MECHANIC_IMMUNITY: