mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Better too close distance calculation
This commit is contained in:
@@ -49,7 +49,7 @@ It's essential to note that there is still a significant amount of work to be do
|
||||
|
||||
For enhanced control over the bots and to simplify command usage, you can also make use of our addon: [Unbot Addon](https://github.com/liyunfan1223/unbot-addon). Currently, this addon offers better support only for Simplified Chinese client.
|
||||
|
||||
## FAQ (Frequently Asked Questions)
|
||||
## Frequently Asked Questions
|
||||
|
||||
**Why won't my bot cast spells?**
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ void GenericHunterStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
{
|
||||
CombatStrategy::InitTriggers(triggers);
|
||||
|
||||
// triggers.push_back(new TriggerNode("enemy too close for auto shot", NextAction::array(0, new NextAction("switch to melee", ACTION_HIGH), nullptr)));
|
||||
triggers.push_back(new TriggerNode("enemy is close",
|
||||
NextAction::array(0,
|
||||
new NextAction("wing clip", ACTION_HIGH + 1),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "RangeTriggers.h"
|
||||
#include "MoveSplineInit.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
@@ -17,7 +18,7 @@ bool EnemyTooCloseForSpellTrigger::IsActive()
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
return target && (target->GetVictim() != bot || target->isFrozen() || !target->CanFreeMove()) &&
|
||||
target->GetObjectSize() <= 10.0f &&
|
||||
AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->tooCloseDistance;
|
||||
target->IsWithinCombatRange(bot, MIN_MELEE_REACH);
|
||||
// Unit* target = AI_VALUE(Unit*, "current target");
|
||||
// if (!target) {
|
||||
// return false;
|
||||
@@ -79,7 +80,9 @@ bool EnemyTooCloseForAutoShotTrigger::IsActive()
|
||||
bool EnemyTooCloseForShootTrigger::IsActive()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
return target && (target->GetVictim() != bot || target->isFrozen() || !target->CanFreeMove()) && AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->shootDistance;
|
||||
// target->IsWithinCombatRange()
|
||||
|
||||
return target && (target->GetVictim() != bot || target->isFrozen() || !target->CanFreeMove()) && target->IsWithinCombatRange(bot, MIN_MELEE_REACH);
|
||||
|
||||
// Unit* target = AI_VALUE(Unit*, "current target");
|
||||
// if (!target)
|
||||
|
||||
Reference in New Issue
Block a user