mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Hand of Freedom support (#2233)
<!-- Thank you for contributing to mod-playerbots, please make sure that you... 1. Submit your PR to the test-staging branch, not master. 2. Read the guidelines below before submitting. 3. Don't delete parts of this template. DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND PREDICTABILITY over behavioral realism. Every action and decision executes PER BOT AND PER TRIGGER. Small increases in logic complexity scale poorly across thousands of bots and negatively affect all. We prioritize a stable system over a smarter one. Bots don't need to behave perfectly; believable behavior is the goal, not human simulation. Default behavior must be cheap in processing; expensive behavior must be opt-in. Before submitting, make sure your changes aligns with these principles. --> ## Pull Request Description Added Hand of Freedom action for paladin. Related with: #2002 ## How to Test the Changes <!-- - Step-by-step instructions to test the change. - Any required setup (e.g. multiple players, number of bots, specific configuration). - Expected behavior and how to verify it. --> - invite paladin bot to party - start fight (can use dummy target) - apply some snare effect to bot or yourself (for example `.aura 1715`) - bot should use hand of freedom ## Impact Assessment <!-- As a generic test, before and after measure of pmon (playerbot pmon tick) can help you here. --> - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [ ] No - - [x] Yes (**explain why**) Yes, paladin bots start using Hand of Freedom - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## Messages to Translate <!-- Bot messages have to be translatable, but you don't need to do the translations here. You only need to make sure the message is in a translatable format, and list in the table the message_key and the default English message. Search for GetBotTextOrDefault in the codebase for examples. --> - Does this change add bot messages to translate? - - [x] No - - [ ] Yes (**list messages in the table**) | Message key | Default message | | --------------- | ------------------ | | | | | | | ## AI Assistance <!-- AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. We expect contributors to be honest about what they do and do not understand. --> - Was AI assistance used while working on this change? - - [ ] No - - [x] Yes (**explain below**) <!-- If yes, please specify: - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation). - Which parts of the change were influenced or generated, and whether it was thoroughly reviewed. --> OpenCode, as helper to create and review code ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers <!-- Anything else that's helpful to review or test your pull request. --> <img width="424" height="93" alt="obraz" src="https://github.com/user-attachments/assets/3cac4454-35af-474d-8ea0-67c462973c79" />
This commit is contained in:
parent
496d6c9e4c
commit
76dd91c4fa
64
src/Ai/Base/Value/PartyMemberSnaredTargetValue.cpp
Normal file
64
src/Ai/Base/Value/PartyMemberSnaredTargetValue.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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 "PartyMemberSnaredTargetValue.h"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
#include "PlayerbotAIAware.h"
|
||||||
|
#include "Playerbots.h"
|
||||||
|
|
||||||
|
class PartyMemberSnaredTargetPredicate : public FindPlayerPredicate, public PlayerbotAIAware
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PartyMemberSnaredTargetPredicate(PlayerbotAI* botAI)
|
||||||
|
: PlayerbotAIAware(botAI)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Check(Unit* unit) override
|
||||||
|
{
|
||||||
|
if (!unit || !unit->IsAlive() || !unit->IsInWorld() || unit == botAI->GetBot())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (unit->GetMapId() != botAI->GetBot()->GetMapId())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!botAI->GetBot()->IsWithinLOSInMap(unit))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return botAI->IsMovementImpaired(unit);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Unit* PartyMemberSnaredTargetValue::Calculate()
|
||||||
|
{
|
||||||
|
Group* group = bot->GetGroup();
|
||||||
|
if (!group)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
PartyMemberSnaredTargetPredicate predicate(botAI);
|
||||||
|
Player* bestTarget = nullptr;
|
||||||
|
float closestDistanceSq = std::numeric_limits<float>::max();
|
||||||
|
|
||||||
|
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||||
|
{
|
||||||
|
Player* member = gref->GetSource();
|
||||||
|
if (!member)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!predicate.Check(member))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
float const distanceSq = bot->GetExactDist2dSq(member->GetPositionX(), member->GetPositionY());
|
||||||
|
if (distanceSq < closestDistanceSq)
|
||||||
|
{
|
||||||
|
closestDistanceSq = distanceSq;
|
||||||
|
bestTarget = member;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bestTarget;
|
||||||
|
}
|
||||||
24
src/Ai/Base/Value/PartyMemberSnaredTargetValue.h
Normal file
24
src/Ai/Base/Value/PartyMemberSnaredTargetValue.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PLAYERBOT_PARTYMEMBERSNAREDTARGETVALUE_H
|
||||||
|
#define _PLAYERBOT_PARTYMEMBERSNAREDTARGETVALUE_H
|
||||||
|
|
||||||
|
#include "NamedObjectContext.h"
|
||||||
|
#include "PartyMemberValue.h"
|
||||||
|
|
||||||
|
class PartyMemberSnaredTargetValue : public PartyMemberValue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PartyMemberSnaredTargetValue(PlayerbotAI* botAI, std::string const name = "party member snared target")
|
||||||
|
: PartyMemberValue(botAI, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Unit* Calculate() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -66,6 +66,7 @@
|
|||||||
#include "PartyMemberToDispel.h"
|
#include "PartyMemberToDispel.h"
|
||||||
#include "PartyMemberToHeal.h"
|
#include "PartyMemberToHeal.h"
|
||||||
#include "PartyMemberToResurrect.h"
|
#include "PartyMemberToResurrect.h"
|
||||||
|
#include "PartyMemberSnaredTargetValue.h"
|
||||||
#include "PartyMemberWithoutAuraValue.h"
|
#include "PartyMemberWithoutAuraValue.h"
|
||||||
#include "PartyMemberWithoutItemValue.h"
|
#include "PartyMemberWithoutItemValue.h"
|
||||||
#include "PetTargetValue.h"
|
#include "PetTargetValue.h"
|
||||||
@ -152,6 +153,7 @@ public:
|
|||||||
creators["duel target"] = &ValueContext::duel_target;
|
creators["duel target"] = &ValueContext::duel_target;
|
||||||
creators["party member to dispel"] = &ValueContext::party_member_to_dispel;
|
creators["party member to dispel"] = &ValueContext::party_member_to_dispel;
|
||||||
creators["party member to protect"] = &ValueContext::party_member_to_protect;
|
creators["party member to protect"] = &ValueContext::party_member_to_protect;
|
||||||
|
creators["party member snared target"] = &ValueContext::party_member_snared_target;
|
||||||
creators["health"] = &ValueContext::health;
|
creators["health"] = &ValueContext::health;
|
||||||
creators["rage"] = &ValueContext::rage;
|
creators["rage"] = &ValueContext::rage;
|
||||||
creators["energy"] = &ValueContext::energy;
|
creators["energy"] = &ValueContext::energy;
|
||||||
@ -450,6 +452,7 @@ private:
|
|||||||
static UntypedValue* party_member_to_resurrect(PlayerbotAI* botAI) { return new PartyMemberToResurrect(botAI); }
|
static UntypedValue* party_member_to_resurrect(PlayerbotAI* botAI) { return new PartyMemberToResurrect(botAI); }
|
||||||
static UntypedValue* party_member_to_dispel(PlayerbotAI* botAI) { return new PartyMemberToDispel(botAI); }
|
static UntypedValue* party_member_to_dispel(PlayerbotAI* botAI) { return new PartyMemberToDispel(botAI); }
|
||||||
static UntypedValue* party_member_to_protect(PlayerbotAI* botAI) { return new PartyMemberToProtect(botAI); }
|
static UntypedValue* party_member_to_protect(PlayerbotAI* botAI) { return new PartyMemberToProtect(botAI); }
|
||||||
|
static UntypedValue* party_member_snared_target(PlayerbotAI* botAI) { return new PartyMemberSnaredTargetValue(botAI); }
|
||||||
static UntypedValue* current_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
|
static UntypedValue* current_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
|
||||||
static UntypedValue* old_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
|
static UntypedValue* old_target(PlayerbotAI* botAI) { return new CurrentTargetValue(botAI); }
|
||||||
static UntypedValue* self_target(PlayerbotAI* botAI) { return new SelfTargetValue(botAI); }
|
static UntypedValue* self_target(PlayerbotAI* botAI) { return new SelfTargetValue(botAI); }
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
#include "PaladinHelper.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
@ -468,6 +469,39 @@ bool CastSealSpellAction::isUseful() { return AI_VALUE2(bool, "combat", "self ta
|
|||||||
|
|
||||||
Value<Unit*>* CastTurnUndeadAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
Value<Unit*>* CastTurnUndeadAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
||||||
|
|
||||||
|
Unit* CastHandOfFreedomOnPartyAction::GetTarget()
|
||||||
|
{
|
||||||
|
bool const selfImpaired = botAI->IsMovementImpaired(bot);
|
||||||
|
bool const hasSelfHand = selfImpaired && ai::paladin::HasAnyPaladinHandFromCaster(bot, bot);
|
||||||
|
|
||||||
|
if (!bot->GetGroup())
|
||||||
|
{
|
||||||
|
if (selfImpaired && !hasSelfHand)
|
||||||
|
return bot;
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selfImpaired && !hasSelfHand)
|
||||||
|
return bot;
|
||||||
|
|
||||||
|
return CastBuffSpellAction::GetTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
Value<Unit*>* CastHandOfFreedomOnPartyAction::GetTargetValue()
|
||||||
|
{
|
||||||
|
return context->GetValue<Unit*>("party member snared target");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CastHandOfFreedomOnPartyAction::isUseful()
|
||||||
|
{
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (!target)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return CastBuffSpellAction::isUseful() && !ai::paladin::HasAnyPaladinHandFromCaster(target, bot);
|
||||||
|
}
|
||||||
|
|
||||||
Unit* CastRighteousDefenseAction::GetTarget()
|
Unit* CastRighteousDefenseAction::GetTarget()
|
||||||
{
|
{
|
||||||
Unit* current_target = AI_VALUE(Unit*, "current target");
|
Unit* current_target = AI_VALUE(Unit*, "current target");
|
||||||
|
|||||||
@ -371,6 +371,19 @@ public:
|
|||||||
Value<Unit*>* GetTargetValue() override;
|
Value<Unit*>* GetTargetValue() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CastHandOfFreedomOnPartyAction : public CastBuffSpellAction, public PartyMemberActionNameSupport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CastHandOfFreedomOnPartyAction(PlayerbotAI* botAI)
|
||||||
|
: CastBuffSpellAction(botAI, "hand of freedom"), PartyMemberActionNameSupport("hand of freedom") {}
|
||||||
|
|
||||||
|
Unit* GetTarget() override;
|
||||||
|
Value<Unit*>* GetTargetValue() override;
|
||||||
|
std::string const GetTargetName() override { return "party member snared target"; }
|
||||||
|
std::string const getName() override { return PartyMemberActionNameSupport::getName(); }
|
||||||
|
bool isUseful() override;
|
||||||
|
};
|
||||||
|
|
||||||
PROTECT_ACTION(CastBlessingOfProtectionProtectAction, "blessing of protection");
|
PROTECT_ACTION(CastBlessingOfProtectionProtectAction, "blessing of protection");
|
||||||
|
|
||||||
class CastDivinePleaAction : public CastBuffSpellAction
|
class CastDivinePleaAction : public CastBuffSpellAction
|
||||||
|
|||||||
@ -142,6 +142,7 @@ public:
|
|||||||
creators["repentance interrupt"] = &PaladinTriggerFactoryInternal::repentance_interrupt;
|
creators["repentance interrupt"] = &PaladinTriggerFactoryInternal::repentance_interrupt;
|
||||||
creators["beacon of light on main tank"] = &PaladinTriggerFactoryInternal::beacon_of_light_on_main_tank;
|
creators["beacon of light on main tank"] = &PaladinTriggerFactoryInternal::beacon_of_light_on_main_tank;
|
||||||
creators["sacred shield on main tank"] = &PaladinTriggerFactoryInternal::sacred_shield_on_main_tank;
|
creators["sacred shield on main tank"] = &PaladinTriggerFactoryInternal::sacred_shield_on_main_tank;
|
||||||
|
creators["hand of freedom on party"] = &PaladinTriggerFactoryInternal::hand_of_freedom_on_party;
|
||||||
|
|
||||||
creators["blessing of kings on party"] = &PaladinTriggerFactoryInternal::blessing_of_kings_on_party;
|
creators["blessing of kings on party"] = &PaladinTriggerFactoryInternal::blessing_of_kings_on_party;
|
||||||
creators["blessing of wisdom on party"] = &PaladinTriggerFactoryInternal::blessing_of_wisdom_on_party;
|
creators["blessing of wisdom on party"] = &PaladinTriggerFactoryInternal::blessing_of_wisdom_on_party;
|
||||||
@ -207,6 +208,7 @@ private:
|
|||||||
static Trigger* repentance_interrupt(PlayerbotAI* botAI) { return new RepentanceInterruptTrigger(botAI); }
|
static Trigger* repentance_interrupt(PlayerbotAI* botAI) { return new RepentanceInterruptTrigger(botAI); }
|
||||||
static Trigger* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new BeaconOfLightOnMainTankTrigger(ai); }
|
static Trigger* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new BeaconOfLightOnMainTankTrigger(ai); }
|
||||||
static Trigger* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new SacredShieldOnMainTankTrigger(ai); }
|
static Trigger* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new SacredShieldOnMainTankTrigger(ai); }
|
||||||
|
static Trigger* hand_of_freedom_on_party(PlayerbotAI* botAI) { return new HandOfFreedomOnPartyTrigger(botAI); }
|
||||||
|
|
||||||
static Trigger* blessing_of_kings_on_party(PlayerbotAI* botAI) { return new BlessingOfKingsOnPartyTrigger(botAI); }
|
static Trigger* blessing_of_kings_on_party(PlayerbotAI* botAI) { return new BlessingOfKingsOnPartyTrigger(botAI); }
|
||||||
static Trigger* blessing_of_wisdom_on_party(PlayerbotAI* botAI)
|
static Trigger* blessing_of_wisdom_on_party(PlayerbotAI* botAI)
|
||||||
@ -308,6 +310,7 @@ public:
|
|||||||
creators["divine illumination"] = &PaladinAiObjectContextInternal::divine_illumination;
|
creators["divine illumination"] = &PaladinAiObjectContextInternal::divine_illumination;
|
||||||
creators["divine sacrifice"] = &PaladinAiObjectContextInternal::divine_sacrifice;
|
creators["divine sacrifice"] = &PaladinAiObjectContextInternal::divine_sacrifice;
|
||||||
creators["cancel divine sacrifice"] = &PaladinAiObjectContextInternal::cancel_divine_sacrifice;
|
creators["cancel divine sacrifice"] = &PaladinAiObjectContextInternal::cancel_divine_sacrifice;
|
||||||
|
creators["hand of freedom on party"] = &PaladinAiObjectContextInternal::hand_of_freedom_on_party;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -414,6 +417,7 @@ private:
|
|||||||
static Action* divine_illumination(PlayerbotAI* ai) { return new CastDivineIlluminationAction(ai); }
|
static Action* divine_illumination(PlayerbotAI* ai) { return new CastDivineIlluminationAction(ai); }
|
||||||
static Action* divine_sacrifice(PlayerbotAI* ai) { return new CastDivineSacrificeAction(ai); }
|
static Action* divine_sacrifice(PlayerbotAI* ai) { return new CastDivineSacrificeAction(ai); }
|
||||||
static Action* cancel_divine_sacrifice(PlayerbotAI* ai) { return new CastCancelDivineSacrificeAction(ai); }
|
static Action* cancel_divine_sacrifice(PlayerbotAI* ai) { return new CastCancelDivineSacrificeAction(ai); }
|
||||||
|
static Action* hand_of_freedom_on_party(PlayerbotAI* ai) { return new CastHandOfFreedomOnPartyAction(ai); }
|
||||||
};
|
};
|
||||||
|
|
||||||
SharedNamedObjectContextList<Strategy> PaladinAiObjectContext::sharedStrategyContexts;
|
SharedNamedObjectContextList<Strategy> PaladinAiObjectContext::sharedStrategyContexts;
|
||||||
|
|||||||
@ -35,6 +35,9 @@ void GenericPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|||||||
triggers.push_back(new TriggerNode(
|
triggers.push_back(new TriggerNode(
|
||||||
"protect party member",
|
"protect party member",
|
||||||
{ NextAction("blessing of protection on party", ACTION_EMERGENCY + 2) }));
|
{ NextAction("blessing of protection on party", ACTION_EMERGENCY + 2) }));
|
||||||
|
triggers.push_back(new TriggerNode(
|
||||||
|
"hand of freedom on party",
|
||||||
|
{ NextAction("hand of freedom on party", ACTION_HIGH + 4) }));
|
||||||
triggers.push_back(
|
triggers.push_back(
|
||||||
new TriggerNode("high mana", { NextAction("divine plea", ACTION_HIGH) }));
|
new TriggerNode("high mana", { NextAction("divine plea", ACTION_HIGH) }));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "PaladinActions.h"
|
#include "PaladinActions.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "PaladinHelper.h"
|
||||||
|
|
||||||
bool SealTrigger::IsActive()
|
bool SealTrigger::IsActive()
|
||||||
{
|
{
|
||||||
@ -31,6 +32,40 @@ bool BlessingTrigger::IsActive()
|
|||||||
"blessing of kings", "blessing of sanctuary", nullptr);
|
"blessing of kings", "blessing of sanctuary", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit* HandOfFreedomOnPartyTrigger::GetTarget()
|
||||||
|
{
|
||||||
|
bool const selfImpaired = botAI->IsMovementImpaired(bot);
|
||||||
|
bool const hasSelfHand = selfImpaired && ai::paladin::HasAnyPaladinHandFromCaster(bot, bot);
|
||||||
|
|
||||||
|
if (!bot->GetGroup())
|
||||||
|
{
|
||||||
|
if (selfImpaired && !hasSelfHand)
|
||||||
|
return bot;
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selfImpaired && !hasSelfHand)
|
||||||
|
return bot;
|
||||||
|
|
||||||
|
return Trigger::GetTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HandOfFreedomOnPartyTrigger::IsActive()
|
||||||
|
{
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (!target)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (target != bot && bot->GetExactDist2dSq(target->GetPositionX(), target->GetPositionY()) > 30.0f * 30.0f)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!botAI->CanCastSpell("hand of freedom", target))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !ai::paladin::HasAnyPaladinHandFromCaster(target, bot) && botAI->IsMovementImpaired(target);
|
||||||
|
}
|
||||||
|
|
||||||
bool NotSensingUndeadTrigger::IsActive()
|
bool NotSensingUndeadTrigger::IsActive()
|
||||||
{
|
{
|
||||||
return !botAI->HasAura("sense undead", bot);
|
return !botAI->HasAura("sense undead", bot);
|
||||||
|
|||||||
@ -242,6 +242,16 @@ public:
|
|||||||
: BuffOnPartyTrigger(botAI, "blessing of sanctuary", 2 * 2000) {}
|
: BuffOnPartyTrigger(botAI, "blessing of sanctuary", 2 * 2000) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class HandOfFreedomOnPartyTrigger : public Trigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HandOfFreedomOnPartyTrigger(PlayerbotAI* botAI) : Trigger(botAI, "hand of freedom on party", 1) {}
|
||||||
|
|
||||||
|
Unit* GetTarget() override;
|
||||||
|
std::string const GetTargetName() override { return "party member snared target"; }
|
||||||
|
bool IsActive() override;
|
||||||
|
};
|
||||||
|
|
||||||
class AvengingWrathTrigger : public BoostTrigger
|
class AvengingWrathTrigger : public BoostTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
43
src/Ai/Class/Paladin/Util/PaladinHelper.h
Normal file
43
src/Ai/Class/Paladin/Util/PaladinHelper.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PLAYERBOT_PALADINHELPER_H
|
||||||
|
#define _PLAYERBOT_PALADINHELPER_H
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
#include "Unit.h"
|
||||||
|
|
||||||
|
class Player;
|
||||||
|
|
||||||
|
namespace ai::paladin
|
||||||
|
{
|
||||||
|
static constexpr uint32 SPELL_HAND_OF_PROTECTION = 1022;
|
||||||
|
static constexpr uint32 SPELL_HAND_OF_SALVATION = 1038;
|
||||||
|
static constexpr uint32 SPELL_HAND_OF_FREEDOM = 1044;
|
||||||
|
static constexpr uint32 SPELL_HAND_OF_SACRIFICE = 6940;
|
||||||
|
|
||||||
|
inline bool HasHandFromCaster(Unit* target, Player* caster, std::initializer_list<uint32> spellIds)
|
||||||
|
{
|
||||||
|
if (!target || !caster)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (uint32 spellId : spellIds)
|
||||||
|
{
|
||||||
|
if (target->HasAura(spellId, caster->GetGUID()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool HasAnyPaladinHandFromCaster(Unit* target, Player* caster)
|
||||||
|
{
|
||||||
|
return HasHandFromCaster(target, caster,
|
||||||
|
{ SPELL_HAND_OF_PROTECTION, SPELL_HAND_OF_SALVATION, SPELL_HAND_OF_FREEDOM, SPELL_HAND_OF_SACRIFICE });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1962,6 +1962,11 @@ bool PlayerbotAI::HasAggro(Unit* unit)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlayerbotAI::IsMovementImpaired(Unit* unit)
|
||||||
|
{
|
||||||
|
return unit && (unit->HasAuraType(SPELL_AURA_MOD_ROOT) || unit->IsRooted() || unit->GetSpeedRate(MOVE_RUN) < 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
int32 PlayerbotAI::GetAssistTankIndex(Player* player)
|
int32 PlayerbotAI::GetAssistTankIndex(Player* player)
|
||||||
{
|
{
|
||||||
Group* group = player->GetGroup();
|
Group* group = player->GetGroup();
|
||||||
|
|||||||
@ -430,6 +430,7 @@ public:
|
|||||||
static bool IsAssistHealOfIndex(Player* player, uint8 index, bool ignoreDeadPlayers = false);
|
static bool IsAssistHealOfIndex(Player* player, uint8 index, bool ignoreDeadPlayers = false);
|
||||||
static bool IsAssistRangedDpsOfIndex(Player* player, uint8 index, bool ignoreDeadPlayers = false);
|
static bool IsAssistRangedDpsOfIndex(Player* player, uint8 index, bool ignoreDeadPlayers = false);
|
||||||
bool HasAggro(Unit* unit);
|
bool HasAggro(Unit* unit);
|
||||||
|
bool IsMovementImpaired(Unit* unit);
|
||||||
static int32 GetAssistTankIndex(Player* player);
|
static int32 GetAssistTankIndex(Player* player);
|
||||||
int32 GetGroupSlotIndex(Player* player);
|
int32 GetGroupSlotIndex(Player* player);
|
||||||
int32 GetRangedIndex(Player* player);
|
int32 GetRangedIndex(Player* player);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user