mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
Auto avoid aoe config
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#ifndef _PLAYERBOT_AOEVALUES_H
|
||||
#define _PLAYERBOT_AOEVALUES_H
|
||||
|
||||
#include "GameObject.h"
|
||||
#include "Object.h"
|
||||
#include "Value.h"
|
||||
#include "AiObjectContext.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Playerbots.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class AnyGameObjectInObjectRangeCheck
|
||||
{
|
||||
@@ -42,3 +43,30 @@ GuidVector NearestGameObjects::Calculate()
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
GuidVector NearestTrapWithDamageValue::Calculate()
|
||||
{
|
||||
std::list<GameObject*> targets;
|
||||
AnyGameObjectInObjectRangeCheck u_check(bot, range);
|
||||
Acore::GameObjectListSearcher<AnyGameObjectInObjectRangeCheck> searcher(bot, targets, u_check);
|
||||
Cell::VisitAllObjects(bot, searcher, range);
|
||||
|
||||
GuidVector result;
|
||||
for (GameObject* go : targets)
|
||||
{
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_TRAP)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
uint32 spellId = go->GetSpellId();
|
||||
if (!spellId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// if (ignoreLos || bot->IsWithinLOSInMap(go))
|
||||
result.push_back(go->GetGUID());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,4 +24,17 @@ class NearestGameObjects : public ObjectGuidListCalculatedValue
|
||||
bool ignoreLos;
|
||||
};
|
||||
|
||||
class NearestTrapWithDamageValue : public ObjectGuidListCalculatedValue
|
||||
{
|
||||
public:
|
||||
NearestTrapWithDamageValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance) :
|
||||
ObjectGuidListCalculatedValue(botAI, "nearest trap with damage", 1 * 1000), range(range) { }
|
||||
|
||||
protected:
|
||||
GuidVector Calculate() override;
|
||||
|
||||
private:
|
||||
float range;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -299,6 +299,7 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
creators["expected lifetime"] = &ValueContext::expected_lifetime;
|
||||
creators["expected group dps"] = &ValueContext::expected_group_dps;
|
||||
creators["area debuff"] = &ValueContext::area_debuff;
|
||||
creators["nearest trap with damage"] = &ValueContext::nearest_trap_with_damange;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -501,6 +502,7 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
static UntypedValue* expected_lifetime(PlayerbotAI* ai) { return new ExpectedLifetimeValue(ai); }
|
||||
static UntypedValue* expected_group_dps(PlayerbotAI* ai) { return new ExpectedGroupDpsValue(ai); }
|
||||
static UntypedValue* area_debuff(PlayerbotAI* ai) { return new AreaDebuffValue(ai); }
|
||||
static UntypedValue* nearest_trap_with_damange(PlayerbotAI* ai) { return new NearestTrapWithDamageValue(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user