/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it * and/or modify it under version 2 of the License, or (at your option), any later version. */ #include "PaladinActions.h" #include "AiFactory.h" #include "Event.h" #include "PlayerbotAI.h" #include "PlayerbotAIConfig.h" #include "PlayerbotFactory.h" #include "Playerbots.h" #include "SharedDefines.h" inline std::string const GetActualBlessingOfMight(Unit* target) { if (!target->ToPlayer()) { return "blessing of might"; } int tab = AiFactory::GetPlayerSpecTab(target->ToPlayer()); switch (target->getClass()) { case CLASS_MAGE: case CLASS_PRIEST: case CLASS_WARLOCK: return "blessing of wisdom"; break; case CLASS_SHAMAN: if (tab == SHAMAN_TAB_ELEMENTAL || tab == SHAMAN_TAB_RESTORATION) { return "blessing of wisdom"; } break; case CLASS_DRUID: if (tab == DRUID_TAB_RESTORATION || tab == DRUID_TAB_BALANCE) { return "blessing of wisdom"; } break; case CLASS_PALADIN: if (tab == PALADIN_TAB_HOLY) { return "blessing of wisdom"; } break; } return "blessing of might"; } inline std::string const GetActualBlessingOfWisdom(Unit* target) { if (!target->ToPlayer()) { return "blessing of might"; } int tab = AiFactory::GetPlayerSpecTab(target->ToPlayer()); switch (target->getClass()) { case CLASS_WARRIOR: case CLASS_ROGUE: case CLASS_DEATH_KNIGHT: case CLASS_HUNTER: return "blessing of might"; break; case CLASS_SHAMAN: if (tab == SHAMAN_TAB_ENHANCEMENT) { return "blessing of might"; } break; case CLASS_DRUID: if (tab == DRUID_TAB_FERAL) { return "blessing of might"; } break; case CLASS_PALADIN: if (tab == PALADIN_TAB_PROTECTION || tab == PALADIN_TAB_RETRIBUTION) { return "blessing of might"; } break; } return "blessing of wisdom"; } Value* CastBlessingOnPartyAction::GetTargetValue() { return context->GetValue("party member without aura", name); } bool CastBlessingOfMightAction::Execute(Event event) { Unit* target = GetTarget(); if (!target) return false; return botAI->CastSpell(GetActualBlessingOfMight(target), target); } Value* CastBlessingOfMightOnPartyAction::GetTargetValue() { return context->GetValue("party member without aura", "blessing of might,blessing of wisdom"); } bool CastBlessingOfMightOnPartyAction::Execute(Event event) { Unit* target = GetTarget(); if (!target) return false; return botAI->CastSpell(GetActualBlessingOfMight(target), target); } bool CastBlessingOfWisdomAction::Execute(Event event) { Unit* target = GetTarget(); if (!target) return false; return botAI->CastSpell(GetActualBlessingOfWisdom(target), target); } Value* CastBlessingOfWisdomOnPartyAction::GetTargetValue() { return context->GetValue("party member without aura", "blessing of might,blessing of wisdom"); } bool CastBlessingOfWisdomOnPartyAction::Execute(Event event) { Unit* target = GetTarget(); if (!target) return false; return botAI->CastSpell(GetActualBlessingOfWisdom(target), target); } bool CastSealSpellAction::isUseful() { return AI_VALUE2(bool, "combat", "self target"); } Value* CastTurnUndeadAction::GetTargetValue() { return context->GetValue("cc target", getName()); } Unit* CastRighteousDefenseAction::GetTarget() { Unit* current_target = AI_VALUE(Unit*, "current target"); if (!current_target) { return NULL; } return current_target->GetVictim(); } bool CastDivineSacrificeAction::isUseful() { return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura("divine guardian", GetTarget(), false, false, -1, true); } bool CastCancelDivineSacrificeAction::Execute(Event event) { botAI->RemoveAura("divine sacrifice"); return true; } bool CastCancelDivineSacrificeAction::isUseful() { return botAI->HasAura("divine sacrifice", GetTarget(), false, true, -1, true); }