diff --git a/README.md b/README.md index e93a6da9..f657b34e 100644 --- a/README.md +++ b/README.md @@ -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?** diff --git a/src/strategy/hunter/GenericHunterStrategy.cpp b/src/strategy/hunter/GenericHunterStrategy.cpp index 848d843c..c13aad34 100644 --- a/src/strategy/hunter/GenericHunterStrategy.cpp +++ b/src/strategy/hunter/GenericHunterStrategy.cpp @@ -79,7 +79,6 @@ void GenericHunterStrategy::InitTriggers(std::vector& 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), diff --git a/src/strategy/triggers/RangeTriggers.cpp b/src/strategy/triggers/RangeTriggers.cpp index 64089665..2d02ee5f 100644 --- a/src/strategy/triggers/RangeTriggers.cpp +++ b/src/strategy/triggers/RangeTriggers.cpp @@ -4,6 +4,7 @@ #include "RangeTriggers.h" #include "MoveSplineInit.h" +#include "PlayerbotAIConfig.h" #include "Playerbots.h" #include "ServerFacade.h" @@ -16,8 +17,8 @@ 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->GetObjectSize() <= 10.0f && + 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)