mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 18:00:27 +00:00
Modify file structure
This commit is contained in:
172
src/strategy/classes/paladin/PaladinActions.cpp
Normal file
172
src/strategy/classes/paladin/PaladinActions.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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<Unit*>* CastBlessingOnPartyAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("party member without aura", name);
|
||||
}
|
||||
|
||||
bool CastBlessingOfMightAction::Execute(Event event)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
return botAI->CastSpell(GetActualBlessingOfMight(target), target);
|
||||
}
|
||||
|
||||
Value<Unit*>* CastBlessingOfMightOnPartyAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("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<Unit*>* CastBlessingOfWisdomOnPartyAction::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>("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<Unit*>* CastTurnUndeadAction::GetTargetValue() { return context->GetValue<Unit*>("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);
|
||||
}
|
||||
Reference in New Issue
Block a user