refactor(Core/Spells): Add helpers for HasAuraType (#20802)

This commit is contained in:
Kitzunu
2024-12-01 12:50:59 +01:00
committed by GitHub
parent 55f6bd0972
commit ed008a8780
41 changed files with 183 additions and 140 deletions

View File

@@ -1373,7 +1373,7 @@ class spell_dk_death_grip : public SpellScript
float casterZ = GetCaster()->GetPositionZ(); // for Ring of Valor
WorldLocation gripPos = *GetExplTargetDest();
if (Unit* target = GetHitUnit())
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS) || target->HasUnitState(UNIT_STATE_STUNNED)) // Deterrence
if (!target->HasDetectSpellsAura() || target->HasUnitState(UNIT_STATE_STUNNED)) // Deterrence
{
if (target != GetCaster())
{

View File

@@ -517,7 +517,7 @@ class spell_gen_grow_flower_patch : public SpellScript
SpellCastResult CheckCast()
{
if (GetCaster()->HasAuraType(SPELL_AURA_MOD_STEALTH) || GetCaster()->HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
if (GetCaster()->HasStealthAura() || GetCaster()->HasInvisibilityAura())
return SPELL_FAILED_DONT_REPORT;
return SPELL_CAST_OK;

View File

@@ -2881,7 +2881,7 @@ class spell_item_reindeer_transformation : public SpellScript
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
if (caster->HasMountedAura())
{
float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
float speed = caster->GetSpeedRate(MOVE_RUN);
@@ -3172,7 +3172,7 @@ class spell_item_brewfest_mount_transformation : public SpellScript
return;
}
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
if (caster->HasMountedAura())
{
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
uint32 spell_id;

View File

@@ -1830,7 +1830,7 @@ class spell_q11010_q11102_q11023_aggro_check : public SpellScript
{
if (Player* playerTarget = GetHitPlayer())
// Check if found player target is on fly mount or using flying form
if (playerTarget->HasAuraType(SPELL_AURA_FLY) || playerTarget->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
if (playerTarget->HasFlyAura() || playerTarget->HasIncreaseMountedFlightSpeedAura())
playerTarget->CastSpell(playerTarget, SPELL_FLAK_CANNON_TRIGGER, TRIGGERED_FULL_MASK);
}
@@ -1873,7 +1873,7 @@ class spell_q11010_q11102_q11023_choose_loc : public SpellScript
Cell::VisitWorldObjects(caster, searcher, 65.0f);
for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
// Check if found player target is on fly mount or using flying form
if ((*itr)->HasAuraType(SPELL_AURA_FLY) || (*itr)->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
if ((*itr)->HasFlyAura() || (*itr)->HasIncreaseMountedFlightSpeedAura())
// Summom Fel Cannon (bunny version) at found player
caster->SummonCreature(NPC_FEL_CANNON2, (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ());
}
@@ -1894,7 +1894,7 @@ class spell_q11010_q11102_q11023_q11008_check_fly_mount : public SpellScript
{
Unit* caster = GetCaster();
// This spell will be cast only if caster has one of these auras
if (!(caster->HasAuraType(SPELL_AURA_FLY) || caster->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)))
if (!(caster->HasFlyAura() || caster->HasIncreaseMountedFlightSpeedAura()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}