mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
refactor(Core/Misc): Define & Rename Attributes (#5311)
This commit is contained in:
@@ -449,7 +449,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
|
||||
// amount multiplication based on caster's level
|
||||
if (!caster->IsControlledByPlayer() &&
|
||||
_spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->getLevel() &&
|
||||
!basePointsPerLevel && _spellInfo->HasAttribute(SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION))
|
||||
!basePointsPerLevel && _spellInfo->HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL))
|
||||
{
|
||||
bool canEffectScale = false;
|
||||
switch (Effect)
|
||||
@@ -1082,7 +1082,7 @@ bool SpellInfo::IsAutocastable() const
|
||||
{
|
||||
if (Attributes & SPELL_ATTR0_PASSIVE)
|
||||
return false;
|
||||
if (AttributesEx & SPELL_ATTR1_UNAUTOCASTABLE_BY_PET)
|
||||
if (AttributesEx & SPELL_ATTR1_NO_AUTOCAST_AI)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -1189,27 +1189,27 @@ bool SpellInfo::IsMultiSlotAura() const
|
||||
|
||||
bool SpellInfo::IsCooldownStartedOnEvent() const
|
||||
{
|
||||
return Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE || (CategoryEntry && CategoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT);
|
||||
return Attributes & SPELL_ATTR0_COOLDOWN_ON_EVENT || (CategoryEntry && CategoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsDeathPersistent() const
|
||||
{
|
||||
return AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT;
|
||||
return AttributesEx3 & SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD;
|
||||
}
|
||||
|
||||
bool SpellInfo::IsRequiringDeadTarget() const
|
||||
{
|
||||
return AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS;
|
||||
return AttributesEx3 & SPELL_ATTR3_ONLY_ON_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 AttributesEx2 & SPELL_ATTR2_ALLOW_DEAD_TARGET || 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 !(Attributes & SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsPositive() const
|
||||
@@ -1233,39 +1233,39 @@ bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
|
||||
|
||||
bool SpellInfo::IsChanneled() const
|
||||
{
|
||||
return (AttributesEx & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2));
|
||||
return (AttributesEx & (SPELL_ATTR1_IS_CHANNELED | SPELL_ATTR1_IS_SELF_CHANNELED));
|
||||
}
|
||||
|
||||
bool SpellInfo::IsMoveAllowedChannel() const
|
||||
{
|
||||
return IsChanneled() && (HasAttribute(SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING) || (!(ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING))));
|
||||
return IsChanneled() && (HasAttribute(SPELL_ATTR5_ALLOW_ACTION_DURING_CHANNEL) || (!(ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING))));
|
||||
}
|
||||
|
||||
bool SpellInfo::NeedsComboPoints() const
|
||||
{
|
||||
return (AttributesEx & (SPELL_ATTR1_REQ_COMBO_POINTS1 | SPELL_ATTR1_REQ_COMBO_POINTS2));
|
||||
return (AttributesEx & (SPELL_ATTR1_FINISHING_MOVE_DAMAGE | SPELL_ATTR1_FINISHING_MOVE_DURATION));
|
||||
}
|
||||
|
||||
bool SpellInfo::IsBreakingStealth() const
|
||||
{
|
||||
return !(AttributesEx & SPELL_ATTR1_NOT_BREAK_STEALTH);
|
||||
return !(AttributesEx & SPELL_ATTR1_ALLOW_WHILE_STEALTHED);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsRangedWeaponSpell() const
|
||||
{
|
||||
return (SpellFamilyName == SPELLFAMILY_HUNTER && !(SpellFamilyFlags[1] & 0x10000000)) // for 53352, cannot find better way
|
||||
|| (EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED)
|
||||
|| (Attributes & SPELL_ATTR0_REQ_AMMO); // Xinef: added
|
||||
|| (Attributes & SPELL_ATTR0_USES_RANGED_SLOT); // Xinef: added
|
||||
}
|
||||
|
||||
bool SpellInfo::IsAutoRepeatRangedSpell() const
|
||||
{
|
||||
return AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG;
|
||||
return AttributesEx2 & SPELL_ATTR2_AUTO_REPEAT;
|
||||
}
|
||||
|
||||
bool SpellInfo::IsAffectedBySpellMods() const
|
||||
{
|
||||
return !(AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS);
|
||||
return !(AttributesEx3 & SPELL_ATTR3_IGNORE_CASTER_MODIFIERS);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
|
||||
@@ -1290,13 +1290,13 @@ 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 (Attributes & SPELL_ATTR0_NO_IMMUNITIES)
|
||||
return true;
|
||||
|
||||
// these spells (Cyclone for example) can pierce all...
|
||||
if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)
|
||||
if ((AttributesEx & SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS)
|
||||
// ...but not these (Divine shield for example) // xinef: banish exception, banish can override banish to cancel itself
|
||||
&& !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || (aura->Mechanic == MECHANIC_BANISH && (Mechanic != MECHANIC_BANISH || !(AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED))))))
|
||||
&& !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || (aura->Mechanic == MECHANIC_BANISH && (Mechanic != MECHANIC_BANISH || !(AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED))))))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1310,19 +1310,19 @@ bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
|
||||
|
||||
// Xinef: At frist we check non-player auras, that should be never dispellable
|
||||
// Xinef: Eg. Mark of the Fallen Champion
|
||||
if (aura->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && aura->SpellFamilyName == SPELLFAMILY_GENERIC)
|
||||
if (aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && aura->SpellFamilyName == SPELLFAMILY_GENERIC)
|
||||
return false;
|
||||
|
||||
// These spells (like Mass Dispel) can dispell all auras
|
||||
if (HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
|
||||
if (HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
|
||||
return true;
|
||||
|
||||
// These auras (like Divine Shield) can't be dispelled
|
||||
if (aura->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
|
||||
if (aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
|
||||
return false;
|
||||
|
||||
// These auras (Cyclone for example) are not dispelable
|
||||
if (aura->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
|
||||
if (aura->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1331,7 +1331,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 (AttributesEx5 & SPELL_ATTR5_LIMIT_N)
|
||||
return true;
|
||||
|
||||
switch (GetSpellSpecific())
|
||||
@@ -1427,7 +1427,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
|
||||
|
||||
if (actAsShifted)
|
||||
{
|
||||
if (Attributes & SPELL_ATTR0_NOT_SHAPESHIFT) // not while shapeshifted
|
||||
if (Attributes & SPELL_ATTR0_NOT_SHAPESHIFTED) // not while shapeshifted
|
||||
return SPELL_FAILED_NOT_SHAPESHIFT;
|
||||
else if (Stances != 0) // needs other shapeshift
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
@@ -1435,7 +1435,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
|
||||
else
|
||||
{
|
||||
// needs shapeshift
|
||||
if (!(AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && Stances != 0)
|
||||
if (!(AttributesEx2 & SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED) && Stances != 0)
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
}
|
||||
|
||||
@@ -1474,7 +1474,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
|
||||
}
|
||||
|
||||
// continent limitation (virtual continent)
|
||||
if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
|
||||
if (HasAttribute(SPELL_ATTR4_ONLY_FLYING_AREAS))
|
||||
{
|
||||
if (strict)
|
||||
{
|
||||
@@ -1501,7 +1501,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
|
||||
}
|
||||
|
||||
// raid instance limitation
|
||||
if (HasAttribute(SPELL_ATTR6_NOT_IN_RAID_INSTANCE))
|
||||
if (HasAttribute(SPELL_ATTR6_NOT_IN_RAID_INSTANCES))
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry || mapEntry->IsRaid())
|
||||
@@ -1708,7 +1708,7 @@ bool SpellInfo::IsAuraEffectEqual(SpellInfo const* otherSpellInfo) const
|
||||
bool SpellInfo::ValidateAttribute6SpellDamageMods(const Unit* caster, const AuraEffect* auraEffect, bool isDot) const
|
||||
{
|
||||
// Xinef: no attribute
|
||||
if (!(AttributesEx6 & SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS))
|
||||
if (!(AttributesEx6 & SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
|
||||
return true;
|
||||
|
||||
// Xinef we have a hook to decide which auras should profit to the spell, by default no profits
|
||||
@@ -1729,11 +1729,11 @@ bool SpellInfo::ValidateAttribute6SpellDamageMods(const Unit* caster, const Aura
|
||||
|
||||
SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* target, bool implicit) const
|
||||
{
|
||||
if (AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF && caster == target)
|
||||
if (AttributesEx & SPELL_ATTR1_EXCLUDE_CASTER && 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 (!(AttributesEx6 & SPELL_ATTR6_IGNORE_PHASE_SHIFT) && !caster->CanSeeOrDetect(target, implicit))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Unit const* unitTarget = target->ToUnit();
|
||||
@@ -1742,13 +1742,13 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
||||
if (unitTarget)
|
||||
{
|
||||
// xinef: spells cannot be cast if player is in fake combat also
|
||||
if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && (unitTarget->IsInCombat() || unitTarget->IsPetInCombat()))
|
||||
if (AttributesEx & SPELL_ATTR1_ONLY_PEACEFUL_TARGETS && (unitTarget->IsInCombat() || unitTarget->IsPetInCombat()))
|
||||
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
||||
|
||||
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
|
||||
// only spells with SPELL_ATTR3_ONLY_ON_GHOSTS can target ghosts
|
||||
if (((IsRequiringDeadTarget() != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST)) && !(IsDeathPersistent() && IsAllowingDeadTarget()))
|
||||
{
|
||||
if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS)
|
||||
if (AttributesEx3 & SPELL_ATTR3_ONLY_ON_GHOSTS)
|
||||
return SPELL_FAILED_TARGET_NOT_GHOST;
|
||||
else
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
@@ -1759,7 +1759,7 @@ 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 (AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED)
|
||||
if (Creature const* targetCreature = unitTarget->ToCreature())
|
||||
if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
|
||||
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
|
||||
@@ -1804,21 +1804,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 (AttributesEx3 & SPELL_ATTR3_ONLY_ON_PLAYER && !unitTarget->ToPlayer())
|
||||
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 && AttributesEx6 & SPELL_ATTR6_DO_NOT_CHAIN_TO_CROWD_CONTROLLED_TARGETS && !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))
|
||||
// return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
//if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS)
|
||||
//if (!(AttributesEx6 & SPELL_ATTR6_NO_AURA_LOG)
|
||||
|
||||
if (!CheckTargetCreatureType(unitTarget))
|
||||
{
|
||||
@@ -2291,7 +2291,7 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const
|
||||
return 0;
|
||||
|
||||
int32 castTime = CastTimeEntry->CastTime;
|
||||
if (Attributes & SPELL_ATTR0_REQ_AMMO && (!IsAutoRepeatRangedSpell()))
|
||||
if (Attributes & SPELL_ATTR0_USES_RANGED_SLOT && (!IsAutoRepeatRangedSpell()))
|
||||
castTime += 500;
|
||||
|
||||
if (caster)
|
||||
@@ -2335,7 +2335,7 @@ uint32 SpellInfo::GetRecoveryTime() const
|
||||
int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, Spell* spell) const
|
||||
{
|
||||
// Spell drain all exist power on cast (Only paladin lay of Hands)
|
||||
if (AttributesEx & SPELL_ATTR1_DRAIN_ALL_POWER)
|
||||
if (AttributesEx & SPELL_ATTR1_USE_ALL_MANA)
|
||||
{
|
||||
// If power type - health drain all
|
||||
if (PowerType == POWER_HEALTH)
|
||||
@@ -2383,7 +2383,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
|
||||
powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
|
||||
|
||||
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
|
||||
if (AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST)
|
||||
if (AttributesEx4 & SPELL_ATTR4_WEAPON_SPEED_COST_SCALING)
|
||||
{
|
||||
uint32 speed = 0;
|
||||
if (SpellShapeshiftEntry const* ss = sSpellShapeshiftStore.LookupEntry(caster->GetShapeshiftForm()))
|
||||
@@ -2391,7 +2391,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
|
||||
else
|
||||
{
|
||||
WeaponAttackType slot = BASE_ATTACK;
|
||||
if (AttributesEx3 & SPELL_ATTR3_REQ_OFFHAND)
|
||||
if (AttributesEx3 & SPELL_ATTR3_REQUIRES_OFF_HAND_WEAPON)
|
||||
slot = OFF_ATTACK;
|
||||
|
||||
speed = caster->GetAttackTime(slot);
|
||||
@@ -2406,7 +2406,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
|
||||
|
||||
if (!caster->IsControlledByPlayer())
|
||||
{
|
||||
if (Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)
|
||||
if (Attributes & SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL)
|
||||
{
|
||||
GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(SpellLevel - 1);
|
||||
GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1);
|
||||
@@ -2556,7 +2556,7 @@ uint32 SpellInfo::_GetExplicitTargetMask() const
|
||||
bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
|
||||
{
|
||||
// not found a single positive spell with this attribute
|
||||
if (Attributes & SPELL_ATTR0_NEGATIVE_1)
|
||||
if (Attributes & SPELL_ATTR0_AURA_IS_DEBUFF)
|
||||
return false;
|
||||
|
||||
switch (Mechanic)
|
||||
@@ -2697,7 +2697,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
|
||||
if (Effects[effIndex].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 (Attributes & SPELL_ATTR0_AURA_IS_DEBUFF && effIndex == 0)
|
||||
return false;
|
||||
break;
|
||||
case SPELL_AURA_MECHANIC_IMMUNITY:
|
||||
|
||||
Reference in New Issue
Block a user