From bff594c4f5adc0b9508a694b061a2aea88c19434 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Thu, 26 Dec 2024 09:51:54 +0100 Subject: [PATCH] feat(Unit/Misc): HasAnyAuras() HasAllAuras() HasAuras() (#21040) --- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 23 +++++++++ src/server/game/Entities/Unit/Unit.h | 50 +++++++++++++++++++ .../BlackwingLair/boss_chromaggus.cpp | 5 +- .../TempleOfAhnQiraj/boss_twinemperors.cpp | 2 +- src/server/scripts/Kalimdor/zone_desolace.cpp | 4 +- .../IcecrownCitadel/boss_sindragosa.cpp | 2 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 4 +- .../IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../Northrend/Nexus/Oculus/boss_eregos.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_hodir.cpp | 4 +- src/server/scripts/Northrend/zone_dalaran.cpp | 3 +- .../scripts/Northrend/zone_icecrown.cpp | 2 +- .../MagtheridonsLair/boss_magtheridon.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 6 +-- src/server/scripts/Spells/spell_paladin.cpp | 2 +- .../scripts/World/achievement_scripts.cpp | 2 +- .../scripts/World/boss_emerald_dragons.cpp | 2 +- .../scripts/World/npc_stave_of_ancients.cpp | 6 +-- 19 files changed, 95 insertions(+), 30 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index fa38de8ca28b10..dfed1d21618d75 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2419,7 +2419,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward) // Favored experience increase START uint32 zone = GetZoneId(); float favored_exp_mult = 0; - if ((zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) && (HasAura(32096) || HasAura(32098))) + if ((zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) && HasAnyAuras(32096 /*Thrallmar's Favor*/, 32098 /*Honor Hold's Favor*/)) favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor xp = uint32(xp * (1 + favored_exp_mult)); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 2f7d6275b2a07d..85fe37b522987f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5695,6 +5695,29 @@ uint32 Unit::GetAuraCount(uint32 spellId) const return count; } +bool Unit::HasAuras(SearchMethod sm, std::vector& spellIds) const +{ + if (sm == SearchMethod::MatchAll) + { + for (auto const& spellId : spellIds) + if (!HasAura(spellId)) + return false; + return true; + } + else if (sm == SearchMethod::MatchAny) + { + for (auto const& spellId : spellIds) + if (HasAura(spellId)) + return true; + return false; + } + else + { + LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm); + return false; + } +} + bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const { if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask)) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 47a6af78dadc79..39898f578444b1 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -558,6 +558,12 @@ enum CommandStates : uint8 COMMAND_ABANDON = 3 }; +enum class SearchMethod +{ + MatchAll, + MatchAny +}; + typedef std::list SharedVisionList; struct AttackPosition { @@ -1367,6 +1373,50 @@ class Unit : public WorldObject [[nodiscard]] bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const; [[nodiscard]] uint32 GetAuraCount(uint32 spellId) const; + + /** + * @brief Check if unit has ANY or ALL specified auras. + * + * @param sm The search method to use + * - SearchMethod::MatchAll : The function checks for all of the spell id's on the unit. + * - SearchMethod::MatchAny : The function checks for any of the spell id's on the unit. + * + * @param spellIds List of spell id's to check for on the unit. + * + * @return Returns true if the search method condition is met. Otherwise false. + */ + bool HasAuras(SearchMethod sm, std::vector& spellIds) const; + + /** + * @brief Checks if the unit has ANY specified auras. + * + * @tparam Auras Can be any type convertible to uint32. + * @param spellIds List of spell id's to check for on the unit. + * + * @return Returns true if the unit has ANY of the specified auras. Otherwise false. + */ + template + bool HasAnyAuras(Auras... spellIds) const + { + std::vector spellList = { static_cast(spellIds)... }; + return HasAuras(SearchMethod::MatchAny, spellList); + } + + /** + * @brief Checks if the unit has ALL specified auras. + * + * @tparam Auras Can be any type convertible to uint32. + * @param spellIds List of spell id's to check for on the unit. + * + * @return Returns true if the unit has ALL of the specified auras. Otherwise false. + */ + template + bool HasAllAuras(Auras... spellIds) const + { + std::vector spellList = { static_cast(spellIds)... }; + return HasAuras(SearchMethod::MatchAll, spellList); + } + [[nodiscard]] bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const; [[nodiscard]] bool HasAuraType(AuraType auraType) const; [[nodiscard]] bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp index 9b69b0e7a1a1e4..cf39b53a1f6202 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp @@ -188,11 +188,8 @@ class boss_chromaggus : public CreatureScript { DoCast(player, afflictionSpellID, true); - if (player->HasAura(SPELL_BROODAF_BLUE) && player->HasAura(SPELL_BROODAF_BLACK) && player->HasAura(SPELL_BROODAF_RED) && - player->HasAura(SPELL_BROODAF_BRONZE) && player->HasAura(SPELL_BROODAF_GREEN)) - { + if (player->HasAllAuras(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN)) DoCast(player, SPELL_CHROMATIC_MUT_1); - } } } events.ScheduleEvent(EVENT_AFFLICTION, 10s); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 091bb2837fdff1..eab24db58ee821 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -447,7 +447,7 @@ class spell_mutate_explode_bug : public SpellScript if (target->GetEntry() != NPC_QIRAJI_SCARAB && target->GetEntry() != NPC_QIRAJI_SCORPION) return true; if (Creature const* creature = target->ToCreature()) - if (creature->HasAura(SPELL_EXPLODE_BUG) || creature->HasAura(SPELL_MUTATE_BUG)) + if (creature->HasAnyAuras(SPELL_EXPLODE_BUG, SPELL_MUTATE_BUG)) return true; return false; diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 8f1af105d0a62b..3abed38b968dea 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -473,7 +473,7 @@ class npc_aged_dying_ancient_kodo : public CreatureScript { if (spell->Id == SPELL_KODO_KOMBO_ITEM) { - if (!(caster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || me->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + if (!caster->HasAnyAuras(SPELL_KODO_KOMBO_PLAYER_BUFF, SPELL_KODO_KOMBO_DESPAWN_BUFF) && (me->GetEntry() == NPC_AGED_KODO || me->GetEntry() == NPC_DYING_KODO || me->GetEntry() == NPC_ANCIENT_KODO)) { me->UpdateEntry(NPC_TAMED_KODO, nullptr, false); @@ -494,7 +494,7 @@ class npc_aged_dying_ancient_kodo : public CreatureScript bool OnGossipHello(Player* player, Creature* creature) override { - if (player->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && creature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + if (player->HasAllAuras(SPELL_KODO_KOMBO_PLAYER_BUFF, SPELL_KODO_KOMBO_DESPAWN_BUFF)) { player->TalkedToCreature(creature->GetEntry(), ObjectGuid::Empty); player->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index d5107bdbc74b00..263b636d4f2abe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -260,7 +260,7 @@ struct LastPhaseIceTombTargetSelector 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->HasSpiritOfRedemptionAura()) + if (target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL) || target->HasAnyAuras(SPELL_ICE_TOMB_UNTARGETABLE, SPELL_ICE_TOMB_DAMAGE, SPELL_TANK_MARKER_AURA) || target->HasSpiritOfRedemptionAura()) return false; return target != _source->GetVictim(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 21e13a37aff722..5616b0e2d6d170 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -451,7 +451,7 @@ struct DefileTargetSelector return false; if (_source->GetExactDist(target) > 100.0f) return false; - if (target->HasAura(SPELL_HARVEST_SOUL_VALKYR) || target->HasAura(SPELL_VALKYR_TARGET_SEARCH)) + if (target->HasAnyAuras(SPELL_HARVEST_SOUL_VALKYR, SPELL_VALKYR_TARGET_SEARCH)) return false; if (!_source->IsWithinLOSInMap(target)) return false; @@ -603,7 +603,7 @@ class NecroticPlagueTargetCheck { if (!unit || !unit->IsPlayer() || unit == _sourceObj || _sourceObj->GetVictim() == unit || !unit->isTargetableForAttack()) return false; - if (unit->HasAura(SPELL_PLAGUE_AVOIDANCE) || unit->HasAura(SPELL_BOSS_HITTIN_YA_AURA) || unit->HasAura(_notAura1) || unit->HasAura(_notAura2)) + if (unit->HasAnyAuras(SPELL_PLAGUE_AVOIDANCE, SPELL_BOSS_HITTIN_YA_AURA, _notAura1, _notAura2)) return false; if (!_sourceObj->IsWithinLOSInMap(unit)) return false; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index fbc510668bed58..3d7970eadaa15f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1835,7 +1835,7 @@ class npc_alchemist_adrianna : public CreatureScript { if (InstanceScript* instance = creature->GetInstanceScript()) if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN) && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN25)) - if (player->HasAura(SPELL_ORANGE_BLIGHT_RESIDUE) && player->HasAura(SPELL_GREEN_BLIGHT_RESIDUE)) + if (player->HasAllAuras(SPELL_ORANGE_BLIGHT_RESIDUE, SPELL_GREEN_BLIGHT_RESIDUE)) creature->CastSpell(creature, SPELL_HARVEST_BLIGHT_SPECIMEN, false); return false; } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index 2a26a8492f0eb4..4b491b156d1ac5 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -178,7 +178,7 @@ class boss_eregos : public CreatureScript if (!UpdateVictim()) return; - if (me->HasAura(SPELL_PLANAR_SHIFT) || me->HasAura(SPELL_DRAKE_STOP_TIME)) + if (me->HasAnyAuras(SPELL_PLANAR_SHIFT, SPELL_DRAKE_STOP_TIME)) return; events.Update(diff); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 956763df85b045..fd974f452209f0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -1527,7 +1527,7 @@ class achievement_staying_buffed_all_winter_10 : public AchievementCriteriaScrip bool OnCheck(Player* player, Unit* /*target*/, uint32 /*criteria_id*/) override { - return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_10); + return player && player->HasAllAuras(SPELL_MAGE_TOASTY_FIRE_AURA, SPELL_DRUID_STARLIGHT_AREA_AURA, SPELL_SHAMAN_STORM_POWER_10); } }; @@ -1538,7 +1538,7 @@ class achievement_staying_buffed_all_winter_25 : public AchievementCriteriaScrip bool OnCheck(Player* player, Unit* /*target*/, uint32 /*criteria_id*/) override { - return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_25); + return player && player->HasAllAuras(SPELL_MAGE_TOASTY_FIRE_AURA, SPELL_DRUID_STARLIGHT_AREA_AURA, SPELL_SHAMAN_STORM_POWER_25); } }; diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 3c23fe2a988a17..6d2d5aeac98d21 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -454,8 +454,7 @@ class npc_mageguard_dalaran : public CreatureScript if (!player || player->IsGameMaster() || player->IsBeingTeleported() || (player->GetPositionZ() > 670 && player->GetVehicle()) || // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass - player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || - player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_MALE)) + player->HasAnyAuras(SPELL_SUNREAVER_DISGUISE_FEMALE, SPELL_SUNREAVER_DISGUISE_MALE, SPELL_SILVER_COVENANT_DISGUISE_FEMALE, SPELL_SILVER_COVENANT_DISGUISE_MALE)) return; switch (me->GetEntry()) diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 43ca3c21b6f343..c253a499b75714 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -1496,7 +1496,7 @@ class npc_guardian_pavilion : public CreatureScript if (!who || !who->IsPlayer() || !me->IsHostileTo(who) || !me->isInBackInMap(who, 5.0f)) return; - if (who->HasAura(SPELL_TRESPASSER_H) || who->HasAura(SPELL_TRESPASSER_A)) + if (who->HasAnyAuras(SPELL_TRESPASSER_H, SPELL_TRESPASSER_A)) return; if (who->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 897d01c1bde0c1..e37234663f21b2 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -416,7 +416,7 @@ class go_manticron_cube : public GameObjectScript bool OnGossipHello(Player* player, GameObject* /*go*/) override { - if (player->HasAura(SPELL_MIND_EXHAUSTION) || player->HasAura(SPELL_SHADOW_GRASP)) + if (player->HasAnyAuras(SPELL_MIND_EXHAUSTION, SPELL_SHADOW_GRASP)) return true; if (Creature* trigger = player->FindNearestCreature(NPC_HELLFIRE_RAID_TRIGGER, 10.0f)) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 0ec9a5fcddabbd..408ffc314a3e91 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1618,7 +1618,7 @@ class spell_dk_improved_blood_presence : public AuraScript void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if ((target->HasAura(SPELL_DK_FROST_PRESENCE) || target->HasAura(SPELL_DK_UNHOLY_PRESENCE)) && !target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) + if (target->HasAnyAuras(SPELL_DK_FROST_PRESENCE, SPELL_DK_UNHOLY_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), target, true, nullptr, aurEff); } @@ -1655,7 +1655,7 @@ class spell_dk_improved_frost_presence : public AuraScript void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if ((target->HasAura(SPELL_DK_BLOOD_PRESENCE) || target->HasAura(SPELL_DK_UNHOLY_PRESENCE)) && !target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED)) + if (target->HasAnyAuras(SPELL_DK_BLOOD_PRESENCE, SPELL_DK_UNHOLY_PRESENCE) && !target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED)) target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, nullptr, aurEff); } @@ -1700,7 +1700,7 @@ class spell_dk_improved_unholy_presence : public AuraScript target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints, &basePoints, &basePoints, true, nullptr, aurEff); } - if ((target->HasAura(SPELL_DK_BLOOD_PRESENCE) || target->HasAura(SPELL_DK_FROST_PRESENCE)) && !target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED)) + if (target->HasAnyAuras(SPELL_DK_BLOOD_PRESENCE, SPELL_DK_FROST_PRESENCE) && !target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED)) target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, nullptr, aurEff); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 5345782ac2faa9..04a596c616803f 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -969,7 +969,7 @@ class spell_pal_lay_on_hands : public SpellScript Unit* caster = GetCaster(); if (Unit* target = GetExplTargetUnit()) if (caster == target) - if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER)) + if (target->HasAnyAuras(SPELL_PALADIN_FORBEARANCE, SPELL_PALADIN_AVENGING_WRATH_MARKER, SPELL_PALADIN_IMMUNE_SHIELD_MARKER)) return SPELL_FAILED_TARGET_AURASTATE; // Xinef: Glyph of Divinity diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index bdcba3df3774bb..e365afdf57442b 100644 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -267,7 +267,7 @@ class achievement_flirt_with_disaster_perf_check : public AchievementCriteriaScr if (!player) return false; - if (player->HasAura(AURA_PERFUME_FOREVER) || player->HasAura(AURA_PERFUME_ENCHANTRESS) || player->HasAura(AURA_PERFUME_VICTORY)) + if (player->HasAnyAuras(AURA_PERFUME_FOREVER, AURA_PERFUME_ENCHANTRESS, AURA_PERFUME_VICTORY)) return true; return false; diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 4a1a28325f9e7c..814871ee1dd704 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -774,7 +774,7 @@ class MarkOfNatureTargetSelector { // return those not tagged or already under the influence of Aura of Nature if (Unit* unit = object->ToUnit()) - return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE)); + return !unit->HasAllAuras(SPELL_MARK_OF_NATURE, SPELL_AURA_OF_NATURE); return true; } }; diff --git a/src/server/scripts/World/npc_stave_of_ancients.cpp b/src/server/scripts/World/npc_stave_of_ancients.cpp index fede7e6fa3eb3e..20c64c492143bb 100644 --- a/src/server/scripts/World/npc_stave_of_ancients.cpp +++ b/src/server/scripts/World/npc_stave_of_ancients.cpp @@ -999,14 +999,10 @@ class npc_nelson : public CreatureScript void SpellHit(Unit* /*Caster*/, SpellInfo const* Spell) override { if (InNormalForm()) - { return; - } - if (me->HasAura(NELSON_SPELL_SOUL_FLAME) && me->HasAura(NELSON_WEAKNESS_FROST_TRAP)) - { + if (me->HasAllAuras(NELSON_SPELL_SOUL_FLAME, NELSON_WEAKNESS_FROST_TRAP)) me->RemoveAura(NELSON_SPELL_SOUL_FLAME); - } if (!me->HasAura(NELSON_SPELL_CRIPPLING_CLIP) && Spell->Id == NELSON_WEAKNESS_WING_CLIP) {