mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Magic focus magic on party
This commit is contained in:
@@ -5,8 +5,10 @@
|
||||
|
||||
#include "MageActions.h"
|
||||
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
Value<Unit*>* CastPolymorphAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
||||
|
||||
@@ -42,4 +44,47 @@ bool CastBlastWaveAction::isUseful()
|
||||
return false;
|
||||
bool targetClose = bot->IsWithinCombatRange(target, 10.0f);
|
||||
return targetClose;
|
||||
}
|
||||
|
||||
Unit* CastFocusMagicOnPartyAction::GetTarget()
|
||||
{
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group)
|
||||
return nullptr;
|
||||
|
||||
Unit* casterDps = nullptr;
|
||||
Unit* healer = nullptr;
|
||||
Unit* target = nullptr;
|
||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||
{
|
||||
Player* member = ref->GetSource();
|
||||
if (!member || member == bot || !member->IsAlive())
|
||||
continue;
|
||||
|
||||
if (member->GetMap() != bot->GetMap() || bot->GetDistance(member) > sPlayerbotAIConfig->spellDistance)
|
||||
continue;
|
||||
|
||||
if (member->HasAura(54646))
|
||||
continue;
|
||||
|
||||
if (member->getClass() == CLASS_MAGE)
|
||||
return member;
|
||||
|
||||
if (!casterDps && botAI->IsCaster(member) && botAI->IsDps(member))
|
||||
casterDps = member;
|
||||
|
||||
if (!healer && botAI->IsHeal(member))
|
||||
healer = member;
|
||||
|
||||
if (!target)
|
||||
target = member;
|
||||
}
|
||||
|
||||
if (casterDps)
|
||||
return casterDps;
|
||||
|
||||
if (healer)
|
||||
return healer;
|
||||
|
||||
return target;
|
||||
}
|
||||
Reference in New Issue
Block a user