mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-21 12:37:05 +00:00
Stay strategy improvement (#1072)
* - Stay Strategy work in combat and with RTSC * - Fixed summon with stay strategy * - Added new stay strategy support for chat commands
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "ThreatMgr.h"
|
||||
@@ -507,11 +508,22 @@ bool IsBehindTargetTrigger::IsActive()
|
||||
|
||||
bool IsNotBehindTargetTrigger::IsActive()
|
||||
{
|
||||
if (botAI->HasStrategy("stay", botAI->GetState()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
return target && !AI_VALUE2(bool, "behind", "current target");
|
||||
}
|
||||
|
||||
bool IsNotFacingTargetTrigger::IsActive() { return !AI_VALUE2(bool, "facing", "current target"); }
|
||||
bool IsNotFacingTargetTrigger::IsActive()
|
||||
{
|
||||
if (botAI->HasStrategy("stay", botAI->GetState()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !AI_VALUE2(bool, "facing", "current target");
|
||||
}
|
||||
|
||||
bool HasCcTargetTrigger::IsActive()
|
||||
{
|
||||
@@ -599,6 +611,18 @@ bool NewPlayerNearbyTrigger::IsActive() { return AI_VALUE(ObjectGuid, "new playe
|
||||
|
||||
bool CollisionTrigger::IsActive() { return AI_VALUE2(bool, "collision", "self target"); }
|
||||
|
||||
bool ReturnToStayPositionTrigger::IsActive()
|
||||
{
|
||||
PositionInfo stayPosition = AI_VALUE(PositionMap&, "position")["stay"];
|
||||
if (stayPosition.isSet())
|
||||
{
|
||||
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
||||
return distance > sPlayerbotAIConfig->followDistance;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GiveItemTrigger::IsActive()
|
||||
{
|
||||
return AI_VALUE2(Unit*, "party member without item", item) && AI_VALUE2(uint32, "item count", item);
|
||||
|
||||
Reference in New Issue
Block a user