avoid AOE strategy (WIP)

This commit is contained in:
郑佩茹
2023-03-23 12:22:58 -06:00
parent 352969a0c8
commit 53395b64ed
9 changed files with 137 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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