reduce target calculation overhead

This commit is contained in:
Yunfan Li
2023-08-25 03:46:15 +08:00
parent 54462b79c5
commit 563760d92b
4 changed files with 5 additions and 5 deletions

View File

@@ -11,8 +11,8 @@ Unit* CurrentTargetValue::Get()
return nullptr;
Unit* unit = ObjectAccessor::GetUnit(*bot, selection);
if (unit && !bot->IsWithinLOSInMap(unit))
return nullptr;
// if (unit && !bot->IsWithinLOSInMap(unit))
// return nullptr;
return unit;
}

View File

@@ -24,7 +24,7 @@ class NearestEnemyPlayersValue : public PossibleTargetsValue
class EnemyPlayerValue : public UnitCalculatedValue
{
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;

View File

@@ -14,7 +14,7 @@ class Unit;
class SnareTargetValue : public UnitCalculatedValue, public Qualified
{
public:
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target") { }
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target", 1 * 1000) { }
protected:
Unit* Calculate() override;

View File

@@ -75,7 +75,7 @@ class ManaValue : public Uint8CalculatedValue, public Qualified
class HasManaValue : public BoolCalculatedValue, public Qualified
{
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();
bool Calculate() override;