mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
reduce target calculation overhead
This commit is contained in:
@@ -11,8 +11,8 @@ Unit* CurrentTargetValue::Get()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
Unit* unit = ObjectAccessor::GetUnit(*bot, selection);
|
Unit* unit = ObjectAccessor::GetUnit(*bot, selection);
|
||||||
if (unit && !bot->IsWithinLOSInMap(unit))
|
// if (unit && !bot->IsWithinLOSInMap(unit))
|
||||||
return nullptr;
|
// return nullptr;
|
||||||
|
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class NearestEnemyPlayersValue : public PossibleTargetsValue
|
|||||||
class EnemyPlayerValue : public UnitCalculatedValue
|
class EnemyPlayerValue : public UnitCalculatedValue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EnemyPlayerValue(PlayerbotAI* botAI, std::string const name = "enemy player") : UnitCalculatedValue(botAI, name, 2 * 1000) { }
|
EnemyPlayerValue(PlayerbotAI* botAI, std::string const name = "enemy player") : UnitCalculatedValue(botAI, name, 5 * 1000) { }
|
||||||
|
|
||||||
Unit* Calculate() override;
|
Unit* Calculate() override;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Unit;
|
|||||||
class SnareTargetValue : public UnitCalculatedValue, public Qualified
|
class SnareTargetValue : public UnitCalculatedValue, public Qualified
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target") { }
|
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target", 1 * 1000) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Unit* Calculate() override;
|
Unit* Calculate() override;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class ManaValue : public Uint8CalculatedValue, public Qualified
|
|||||||
class HasManaValue : public BoolCalculatedValue, public Qualified
|
class HasManaValue : public BoolCalculatedValue, public Qualified
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HasManaValue(PlayerbotAI* botAI, std::string const name = "has mana") : BoolCalculatedValue(botAI, name) { }
|
HasManaValue(PlayerbotAI* botAI, std::string const name = "has mana") : BoolCalculatedValue(botAI, name, 2 * 1000) { }
|
||||||
|
|
||||||
Unit* GetTarget();
|
Unit* GetTarget();
|
||||||
bool Calculate() override;
|
bool Calculate() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user