mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
refactor(Core/Spells): Add helpers for HasAuraType (#20802)
This commit is contained in:
@@ -117,7 +117,7 @@ public:
|
||||
uint8 powerType = classEntry->powerType;
|
||||
|
||||
// reset m_form if no aura
|
||||
if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
|
||||
if (!player->HasShapeshiftAura())
|
||||
player->SetShapeshiftForm(FORM_NONE);
|
||||
|
||||
player->SetFactionForRace(player->getRace());
|
||||
|
||||
@@ -259,7 +259,7 @@ class spell_suppression_aura : public SpellScript
|
||||
targets.remove_if([&](WorldObject* target) -> bool
|
||||
{
|
||||
Unit* unit = target->ToUnit();
|
||||
return !unit || unit->HasAuraType(SPELL_AURA_MOD_STEALTH);
|
||||
return !unit || unit->HasStealthAura();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -725,7 +725,7 @@ struct npc_hallows_end_soh : public ScriptedAI
|
||||
bool checkBurningTriggers = false;
|
||||
for (ObjectGuid const& guid : unitList)
|
||||
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
|
||||
if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
|
||||
if (c->HasPeriodicDummyAura())
|
||||
{
|
||||
checkBurningTriggers = true;
|
||||
break;
|
||||
@@ -743,7 +743,7 @@ struct npc_hallows_end_soh : public ScriptedAI
|
||||
bool failed = false;
|
||||
for (ObjectGuid const& guid : unitList)
|
||||
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
|
||||
if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
|
||||
if (c->HasPeriodicDummyAura())
|
||||
{
|
||||
failed = true;
|
||||
break;
|
||||
@@ -791,7 +791,7 @@ struct npc_hallows_end_soh : public ScriptedAI
|
||||
{
|
||||
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
|
||||
{
|
||||
if (!c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
|
||||
if (!c->HasPeriodicDummyAura())
|
||||
{
|
||||
tmpList.push_back(c);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class spell_winter_wondervolt_trap : public SpellScript
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
// check presence
|
||||
if (target->HasAuraType(SPELL_AURA_TRANSFORM))
|
||||
if (target->HasTransformAura())
|
||||
return;
|
||||
|
||||
uint32 spellId = 0;
|
||||
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
Map::PlayerList const& playerList = me->GetMap()->GetPlayers();
|
||||
for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
|
||||
if (Player* player = itr->GetSource())
|
||||
if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasAuraType(SPELL_AURA_MOD_INVISIBILITY) && !player->HasAuraType(SPELL_AURA_MOD_STEALTH) && !player->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
|
||||
if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasInvisibilityAura() && !player->HasStealthAura() && !player->HasUnattackableAura())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ struct boss_faction_championsAI : public ScriptedAI
|
||||
{
|
||||
// check for stun, fear, etc.
|
||||
// for casting, silence, disarm check individually in the ai
|
||||
if (me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasFearAura() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
{
|
||||
if (!IsHeroic())
|
||||
return true;
|
||||
|
||||
@@ -831,7 +831,7 @@ class spell_valkyr_touch_aura : public AuraScript
|
||||
Map::PlayerList const& pl = caster->GetMap()->GetPlayers();
|
||||
for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
|
||||
if (Player* plr = itr->GetSource())
|
||||
if (plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasSpiritOfRedemptionAura())
|
||||
{
|
||||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
|
||||
@@ -957,7 +957,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -1065,7 +1065,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -1219,7 +1219,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -1324,7 +1324,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -1418,7 +1418,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -2152,7 +2152,7 @@ public:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
if (!leaped)
|
||||
@@ -2211,7 +2211,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
@@ -2280,7 +2280,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
{
|
||||
if (Unit* trapped = summ->GetSummonerUnit())
|
||||
{
|
||||
if (!trapped->IsOnVehicle(me) || !trapped->IsAlive() || !me->GetInstanceScript() || me->GetInstanceScript()->GetBossState(DATA_LORD_MARROWGAR) != IN_PROGRESS || trapped->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (!trapped->IsOnVehicle(me) || !trapped->IsAlive() || !me->GetInstanceScript() || me->GetInstanceScript()->GetBossState(DATA_LORD_MARROWGAR) != IN_PROGRESS || trapped->HasSpiritOfRedemptionAura())
|
||||
{
|
||||
DoAction(-1337);
|
||||
return;
|
||||
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
if (target->HasAura(SPELL_FROST_IMBUED_BLADE))
|
||||
return false;
|
||||
|
||||
if (target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL) || target->HasAura(SPELL_ICE_TOMB_UNTARGETABLE) || target->HasAura(SPELL_ICE_TOMB_DAMAGE) || target->HasAura(SPELL_TANK_MARKER_AURA) || target->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL) || target->HasAura(SPELL_ICE_TOMB_UNTARGETABLE) || target->HasAura(SPELL_ICE_TOMB_DAMAGE) || target->HasAura(SPELL_TANK_MARKER_AURA) || target->HasSpiritOfRedemptionAura())
|
||||
return false;
|
||||
|
||||
return target != _source->GetVictim();
|
||||
|
||||
@@ -1684,7 +1684,7 @@ public:
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) || ((me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) && me->HasUnitFlag(UNIT_FLAG_SILENCED)))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasFearAura() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) || ((me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) && me->HasUnitFlag(UNIT_FLAG_SILENCED)))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
|
||||
@@ -1129,7 +1129,7 @@ public:
|
||||
DoMeleeAttackIfReady();
|
||||
|
||||
Unit* cannon = GetS3();
|
||||
if (!cannon || cannon->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CASTING) || me->HasAuraType(SPELL_AURA_MOD_SILENCE))
|
||||
if (!cannon || cannon->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CASTING) || me->HasSilenceAura())
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
|
||||
@@ -2603,7 +2603,7 @@ class spell_yogg_saron_insane_periodic_trigger : public SpellScript
|
||||
{
|
||||
std::list<WorldObject*> tmplist;
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
|
||||
if ((*itr)->IsPlayer() && !(*itr)->ToPlayer()->HasAuraType(SPELL_AURA_AOE_CHARM) && !(*itr)->ToPlayer()->HasAura(SPELL_SANITY))
|
||||
if ((*itr)->IsPlayer() && !(*itr)->ToPlayer()->HasAOECharmAura() && !(*itr)->ToPlayer()->HasAura(SPELL_SANITY))
|
||||
tmplist.push_back(*itr);
|
||||
|
||||
targets.clear();
|
||||
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
{
|
||||
if (switching || me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
if (switching || me->HasControlVehicleAura())
|
||||
return;
|
||||
ScriptedAI::EnterEvadeMode(why);
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ struct npc_pet_gen_wind_rider_cub : public NullCreatureAI
|
||||
checkTimer2 = 0;
|
||||
if (Unit* owner = me->GetOwner())
|
||||
{
|
||||
if (owner->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || owner->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED))
|
||||
if (owner->HasIncreaseMountedFlightSpeedAura() || owner->HasIncreaseMountedSpeedAura())
|
||||
{
|
||||
isFlying = true;
|
||||
me->SetCanFly(true);
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user