mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-19 03:35:43 +00:00
avoid AOE strategy (WIP)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "AoeValues.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
GuidVector FindMaxDensity(Player* bot)
|
||||
{
|
||||
@@ -85,3 +86,34 @@ uint8 AoeCountValue::Calculate()
|
||||
{
|
||||
return FindMaxDensity(bot).size();
|
||||
}
|
||||
|
||||
bool HasAreaDebuffValue::Calculate()
|
||||
{
|
||||
for (uint32 auraType = SPELL_AURA_BIND_SIGHT; auraType < TOTAL_AURAS; auraType++)
|
||||
{
|
||||
Unit::AuraEffectList const& auras = botAI->GetBot()->GetAuraEffectsByType((AuraType)auraType);
|
||||
|
||||
if (auras.empty())
|
||||
continue;
|
||||
|
||||
for (AuraEffect const* aurEff : auras)
|
||||
{
|
||||
SpellInfo const* proto = aurEff->GetSpellInfo();
|
||||
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
uint32 trigger_spell_id = proto->Effects[aurEff->GetEffIndex()].TriggerSpell;
|
||||
if (trigger_spell_id == 29767) //Overload
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (!proto->IsPositive() && aurEff->IsPeriodic() && proto->HasAreaAuraEffect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Object.h"
|
||||
#include "Value.h"
|
||||
#include "AiObjectContext.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
@@ -26,4 +27,18 @@ class AoeCountValue : public CalculatedValue<uint8>
|
||||
uint8 Calculate() override;
|
||||
};
|
||||
|
||||
class HasAreaDebuffValue : public BoolCalculatedValue, public Qualified
|
||||
{
|
||||
public:
|
||||
HasAreaDebuffValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI) {}
|
||||
|
||||
Unit* GetTarget()
|
||||
{
|
||||
AiObjectContext* ctx = AiObject::context;
|
||||
|
||||
return ctx->GetValue<Unit*>(qualifier)->Get();
|
||||
}
|
||||
virtual bool Calculate();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -283,6 +283,8 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
creators["RTSC selected"] = &ValueContext::RTSC_selected;
|
||||
creators["RTSC next spell action"] = &ValueContext::RTSC_next_spell_action;
|
||||
creators["RTSC saved location"] = &ValueContext::RTSC_saved_location;
|
||||
|
||||
creators["has area debuff"] = &ValueContext::has_area_debuff;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -471,6 +473,8 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
static UntypedValue* RTSC_selected(PlayerbotAI* botAI) { return new RTSCSelectedValue(botAI); }
|
||||
static UntypedValue* RTSC_next_spell_action(PlayerbotAI* botAI) { return new RTSCNextSpellActionValue(botAI); }
|
||||
static UntypedValue* RTSC_saved_location(PlayerbotAI* botAI) { return new RTSCSavedLocationValue(botAI); }
|
||||
|
||||
static UntypedValue* has_area_debuff(PlayerbotAI* botAI) { return new HasAreaDebuffValue(botAI); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user