/* * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license, you may redistribute it * and/or modify it under version 3 of the License, or (at your option), any later version. */ #include "MageTriggers.h" #include "Playerbots.h" #include "Player.h" #include "Spell.h" #include "DynamicObject.h" #include "Value.h" #include "SpellAuraEffects.h" #include "ServerFacade.h" bool NoManaGemTrigger::IsActive() { static const std::vector gemIds = { 33312, // Mana Sapphire 22044, // Mana Emerald 8008, // Mana Ruby 8007, // Mana Citrine 5513, // Mana Jade 5514 // Mana Agate }; for (uint32 gemId : gemIds) { if (bot->GetItemCount(gemId, false) > 0) // false = only in bags return false; } return true; } bool ArcaneIntellectOnPartyTrigger::IsActive() { return BuffOnPartyTrigger::IsActive() && !botAI->HasAura("arcane brilliance", GetTarget()); } bool ArcaneIntellectTrigger::IsActive() { return BuffTrigger::IsActive() && !botAI->HasAura("arcane brilliance", GetTarget()); } bool MageArmorTrigger::IsActive() { Unit* target = GetTarget(); if (botAI->HasAura("mage armor", target)) return false; if (AI_VALUE2(uint32, "spell id", "mage armor")) return true; return !botAI->HasAura("ice armor", target) && !botAI->HasAura("frost armor", target) && !botAI->HasAura("molten armor", target); } bool MoltenArmorTrigger::IsActive() { Unit* target = GetTarget(); if (botAI->HasAura("molten armor", target)) return false; if (AI_VALUE2(uint32, "spell id", "molten armor")) return true; return !botAI->HasAura("ice armor", target) && !botAI->HasAura("frost armor", target) && !botAI->HasAura("mage armor", target); } bool FrostNovaOnTargetTrigger::IsActive() { Unit* target = GetTarget(); if (!target || !target->IsAlive() || !target->IsInWorld()) return false; return botAI->HasAura(spell, target); } bool FrostbiteOnTargetTrigger::IsActive() { Unit* target = GetTarget(); if (!target || !target->IsAlive() || !target->IsInWorld()) return false; return botAI->HasAura(spell, target); } bool NoFocusMagicTrigger::IsActive() { if (!bot->HasSpell(54646)) // Focus Magic return false; Group* group = bot->GetGroup(); if (!group) return false; for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) { Player* member = ref->GetSource(); if (!member || member == bot || !member->IsAlive()) continue; if (member->HasAura(54646, bot->GetGUID())) return false; } return true; } bool DeepFreezeCooldownTrigger::IsActive() { // If the bot does NOT have Deep Freeze, treat as "on cooldown" if (!bot->HasSpell(44572)) // Deep Freeze return true; return SpellCooldownTrigger::IsActive(); } const std::unordered_set FlamestrikeNearbyTrigger::FLAMESTRIKE_SPELL_IDS = { 2120, 2121, 8422, 8423, 10215, 10216, 27086, 42925, 42926 }; bool FlamestrikeNearbyTrigger::IsActive() { for (uint32 spellId : FLAMESTRIKE_SPELL_IDS) { Aura* aura = bot->GetAura(spellId, bot->GetGUID()); if (!aura) continue; DynamicObject* dynObj = aura->GetDynobjOwner(); if (!dynObj) continue; float dist = bot->GetDistance2d(dynObj->GetPositionX(), dynObj->GetPositionY()); if (dist <= radius) return true; } return false; } bool ImprovedScorchTrigger::IsActive() { Unit* target = GetTarget(); if (!target || !target->IsAlive() || !target->IsInWorld()) return false; static const uint32 ImprovedScorchExclusiveDebuffs[] = {// Shadow Mastery 17794, 17797, 17798, 17799, 17800, // Winter's Chill 12579, // Improved Scorch 22959}; for (uint32 spellId : ImprovedScorchExclusiveDebuffs) { if (target->HasAura(spellId)) return false; } return DebuffTrigger::IsActive(); } const std::unordered_set BlizzardChannelCheckTrigger::BLIZZARD_SPELL_IDS = { 10, // Blizzard Rank 1 6141, // Blizzard Rank 2 8427, // Blizzard Rank 3 10185, // Blizzard Rank 4 10186, // Blizzard Rank 5 10187, // Blizzard Rank 6 27085, // Blizzard Rank 7 42938, // Blizzard Rank 8 42939 // Blizzard Rank 9 }; bool BlizzardChannelCheckTrigger::IsActive() { if (Spell* spell = bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL); spell && BLIZZARD_SPELL_IDS.count(spell->m_spellInfo->Id)) { uint8 attackerCount = AI_VALUE(uint8, "attacker count"); return attackerCount < minEnemies; } return false; }