mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-17 10:45:43 +00:00
Avoie aoe strategy
This commit is contained in:
@@ -116,4 +116,27 @@ bool HasAreaDebuffValue::Calculate()
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Aura* AreaDebuffValue::Calculate()
|
||||
{
|
||||
Unit::AuraApplicationMap& map = bot->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator i = map.begin(); i != map.end(); ++i)
|
||||
{
|
||||
Aura *aura = i->second->GetBase();
|
||||
if (!aura)
|
||||
continue;
|
||||
|
||||
AuraObjectType type = aura->GetType();
|
||||
// bool is_area = aura->IsArea();
|
||||
bool isPositive = aura->GetSpellInfo()->IsPositive();
|
||||
if (type == DYNOBJ_AURA_TYPE && !isPositive) {
|
||||
DynamicObject* dynOwner = aura->GetDynobjOwner();
|
||||
if (!dynOwner) {
|
||||
continue;
|
||||
}
|
||||
return aura;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -41,4 +41,13 @@ class HasAreaDebuffValue : public BoolCalculatedValue, public Qualified
|
||||
virtual bool Calculate();
|
||||
};
|
||||
|
||||
class AreaDebuffValue : public CalculatedValue<Aura*>
|
||||
{
|
||||
public:
|
||||
AreaDebuffValue(PlayerbotAI* botAI) :
|
||||
CalculatedValue<Aura*>(botAI, "area debuff", 1 * 1000) { }
|
||||
|
||||
Aura* Calculate() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,13 +34,4 @@ class ExpectedGroupDpsValue : public FloatCalculatedValue
|
||||
float Calculate() override;
|
||||
};
|
||||
|
||||
class AreaDebuffValue : public CalculatedValue<Aura*>
|
||||
{
|
||||
public:
|
||||
AreaDebuffValue(PlayerbotAI* botAI) :
|
||||
CalculatedValue<Aura*>(botAI, "area debuff", 20 * 1000) { }
|
||||
|
||||
Aura* Calculate() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Unit.h"
|
||||
|
||||
void PossibleTargetsValue::FindUnits(std::list<Unit*>& targets)
|
||||
{
|
||||
@@ -20,3 +21,17 @@ bool PossibleTargetsValue::AcceptUnit(Unit* unit)
|
||||
{
|
||||
return AttackersValue::IsPossibleTarget(unit, bot, range);
|
||||
}
|
||||
|
||||
void PossibleTriggersValue::FindUnits(std::list<Unit*>& targets)
|
||||
{
|
||||
Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, bot, range);
|
||||
Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(bot, targets, u_check);
|
||||
Cell::VisitAllObjects(bot, searcher, range);
|
||||
}
|
||||
|
||||
bool PossibleTriggersValue::AcceptUnit(Unit* unit)
|
||||
{
|
||||
return unit->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE) && unit->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
return true; // AttackersValue::IsPossibleTarget(unit, bot, range);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,4 +27,14 @@ class AllTargetsValue : public PossibleTargetsValue
|
||||
AllTargetsValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance) : PossibleTargetsValue(botAI, "all targets", range, true) { }
|
||||
};
|
||||
|
||||
class PossibleTriggersValue : public NearestUnitsValue
|
||||
{
|
||||
public:
|
||||
PossibleTriggersValue(PlayerbotAI* botAI, std::string const name = "possible targets", float range = sPlayerbotAIConfig->sightDistance, bool ignoreLos = true):
|
||||
NearestUnitsValue(botAI, name, range, ignoreLos) { }
|
||||
|
||||
protected:
|
||||
void FindUnits(std::list<Unit*>& targets) override;
|
||||
bool AcceptUnit(Unit* unit) override;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -110,6 +110,7 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
creators["nearest enemy players"] = &ValueContext::nearest_enemy_players;
|
||||
creators["possible targets"] = &ValueContext::possible_targets;
|
||||
creators["possible targets no los"] = &ValueContext::possible_targets_no_los;
|
||||
creators["possible triggers"] = &ValueContext::possible_triggers;
|
||||
creators["possible adds"] = &ValueContext::possible_adds;
|
||||
creators["all targets"] = &ValueContext::all_targets;
|
||||
creators["possible rpg targets"] = &ValueContext::possible_rpg_targets;
|
||||
@@ -377,6 +378,7 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
static UntypedValue* nearest_corpses(PlayerbotAI* botAI) { return new NearestCorpsesValue(botAI); }
|
||||
static UntypedValue* possible_rpg_targets(PlayerbotAI* botAI) { return new PossibleRpgTargetsValue(botAI); }
|
||||
static UntypedValue* possible_targets(PlayerbotAI* botAI) { return new PossibleTargetsValue(botAI); }
|
||||
static UntypedValue* possible_triggers(PlayerbotAI* botAI) { return new PossibleTriggersValue(botAI); }
|
||||
static UntypedValue* possible_targets_no_los(PlayerbotAI* botAI) { return new PossibleTargetsValue(botAI, "possible targets", sPlayerbotAIConfig->sightDistance, true); }
|
||||
static UntypedValue* possible_adds(PlayerbotAI* botAI) { return new PossibleAddsValue(botAI); }
|
||||
static UntypedValue* all_targets(PlayerbotAI* botAI) { return new AllTargetsValue(botAI); }
|
||||
|
||||
Reference in New Issue
Block a user