mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
refactor(Core/Spells): Add helpers for HasAuraType (#20802)
This commit is contained in:
@@ -1536,7 +1536,7 @@ void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY_DETECT))
|
||||
if (!target->HasInvisibilityDetectAura())
|
||||
target->m_invisibilityDetect.DelFlag(type);
|
||||
|
||||
target->m_invisibilityDetect.AddValue(type, -GetAmount());
|
||||
@@ -1565,7 +1565,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
|
||||
if (!target->HasInvisibilityAura())
|
||||
{
|
||||
// if not have different invisibility auras.
|
||||
// always remove glow vision
|
||||
@@ -1628,7 +1628,7 @@ void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mod
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH_DETECT))
|
||||
if (!target->HasStealthDetectAura())
|
||||
target->m_stealthDetect.DelFlag(type);
|
||||
|
||||
target->m_stealthDetect.AddValue(type, -GetAmount());
|
||||
@@ -1666,7 +1666,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
|
||||
{
|
||||
target->m_stealth.AddValue(type, -GetAmount());
|
||||
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
|
||||
if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
|
||||
{
|
||||
target->m_stealth.DelFlag(type);
|
||||
|
||||
@@ -1723,7 +1723,7 @@ void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bo
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->HasAuraType(SPELL_AURA_DETECT_AMORE))
|
||||
if (target->HasDetectAmoreAura())
|
||||
{
|
||||
Unit::AuraEffectList const& amoreAuras = target->GetAuraEffectsByType(SPELL_AURA_DETECT_AMORE);
|
||||
for (AuraEffect const* aurEff : amoreAuras)
|
||||
@@ -1790,7 +1790,7 @@ void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->HasAuraType(SPELL_AURA_GHOST))
|
||||
if (target->HasGhostAura())
|
||||
return;
|
||||
|
||||
target->ToPlayer()->RemovePlayerFlag(PLAYER_FLAGS_GHOST);
|
||||
@@ -2025,7 +2025,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
|
||||
{
|
||||
// reset model id if no other auras present
|
||||
// may happen when aura is applied on linked event on aura removal
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
|
||||
if (!target->HasShapeshiftAura())
|
||||
{
|
||||
target->SetShapeshiftForm(FORM_NONE);
|
||||
if (target->IsClass(CLASS_DRUID, CLASS_CONTEXT_ABILITY))
|
||||
@@ -2933,7 +2933,7 @@ void AuraEffect::HandleModUnattackable(AuraApplication const* aurApp, uint8 mode
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
|
||||
if (!apply && target->HasUnattackableAura())
|
||||
return;
|
||||
|
||||
target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, apply);
|
||||
@@ -3035,7 +3035,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode,
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(SPELL_AURA_MOD_SILENCE) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
|
||||
if (target->HasSilenceAura() || target->HasPacifySilenceAura())
|
||||
return;
|
||||
|
||||
target->RemoveUnitFlag(UNIT_FLAG_SILENCED);
|
||||
@@ -3057,7 +3057,7 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode,
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(SPELL_AURA_MOD_PACIFY) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
|
||||
if (target->HasPacifyAura() || target->HasPacifySilenceAura())
|
||||
return;
|
||||
target->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
|
||||
}
|
||||
@@ -3073,7 +3073,7 @@ void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, ui
|
||||
if (!(apply))
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
|
||||
if (target->HasPacifySilenceAura())
|
||||
return;
|
||||
}
|
||||
HandleAuraModPacify(aurApp, mode, apply);
|
||||
@@ -3094,7 +3094,7 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
|
||||
if (target->HasAllowOnlyAbilityAura())
|
||||
return;
|
||||
target->ToPlayer()->RemovePlayerFlag(PLAYER_ALLOW_ONLY_ABILITY);
|
||||
}
|
||||
@@ -3312,7 +3312,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
||||
if (!apply)
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
|
||||
if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3526,7 +3526,7 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
// Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
|
||||
if (target->IsPlayer() || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
|
||||
if (target->IsPlayer() || !apply || target->HasFearAura())
|
||||
return;
|
||||
/// @todo: find a way to cancel fleeing for assistance.
|
||||
/// Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards.
|
||||
@@ -3721,7 +3721,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
|
||||
if (GetAuraType() == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
|
||||
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasIncreaseMountedFlightSpeedAura() && !target->HasFlyAura())))
|
||||
{
|
||||
target->SetCanFly(apply);
|
||||
|
||||
@@ -5767,12 +5767,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
}
|
||||
break;
|
||||
case 62061: // Festive Holiday Mount
|
||||
if (target->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
if (target->HasMountedAura())
|
||||
{
|
||||
uint32 creatureEntry = 0;
|
||||
if (apply)
|
||||
{
|
||||
if (target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
|
||||
if (target->HasIncreaseMountedFlightSpeedAura())
|
||||
creatureEntry = 24906;
|
||||
else
|
||||
creatureEntry = 15665;
|
||||
@@ -5790,7 +5790,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
}
|
||||
break;
|
||||
case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
|
||||
if (target->HasAuraType(SPELL_AURA_MOUNTED) && !target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
|
||||
if (target->HasMountedAura() && !target->HasIncreaseMountedFlightSpeedAura())
|
||||
{
|
||||
uint32 creatureEntry = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user