mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Avoid aoe base
This commit is contained in:
@@ -88,6 +88,7 @@ class ActionContext : public NamedObjectContext<Action>
|
||||
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
|
||||
creators["flee"] = &ActionContext::flee;
|
||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||
creators["avoid aoe"] = &ActionContext::avoid_aoe;
|
||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["lifeblood"] = &ActionContext::lifeblood;
|
||||
@@ -263,6 +264,7 @@ class ActionContext : public NamedObjectContext<Action>
|
||||
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); }
|
||||
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||
static Action* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeAction(botAI); }
|
||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||
static Action* lifeblood(PlayerbotAI* botAI) { return new CastLifeBloodAction(botAI); }
|
||||
static Action* arcane_torrent(PlayerbotAI* botAI) { return new CastArcaneTorrentAction(botAI); }
|
||||
|
||||
@@ -1482,6 +1482,16 @@ bool FleeWithPetAction::Execute(Event event)
|
||||
return Flee(AI_VALUE(Unit*, "current target"));
|
||||
}
|
||||
|
||||
bool AvoidAoeAction::isUseful()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AvoidAoeAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RunAwayAction::Execute(Event event)
|
||||
{
|
||||
return Flee(AI_VALUE(Unit*, "master target"));
|
||||
|
||||
@@ -66,11 +66,20 @@ class FleeWithPetAction : public MovementAction
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AvoidAoeAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
AvoidAoeAction(PlayerbotAI* botAI) : MovementAction(botAI, "avoid aoe") { }
|
||||
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class RunAwayAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
RunAwayAction(PlayerbotAI* botAI) : MovementAction(botAI, "runaway") { }
|
||||
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "CombatStrategy.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Strategy.h"
|
||||
|
||||
void CombatStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
|
||||
{
|
||||
@@ -62,15 +63,22 @@ float AvoidAoeStrategyMultiplier::GetValue(Action* action)
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
NextAction** AvoidAoeStrategy::getDefaultActions()
|
||||
{
|
||||
return NextAction::array(0,
|
||||
new NextAction("avoid aoe", ACTION_EMERGENCY),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
|
||||
void AvoidAoeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
{
|
||||
triggers.push_back(new TriggerNode(
|
||||
"has area debuff",
|
||||
NextAction::array(0, new NextAction("flee", ACTION_EMERGENCY + 5), NULL)));
|
||||
// triggers.push_back(new TriggerNode(
|
||||
// "has area debuff",
|
||||
// NextAction::array(0, new NextAction("flee", ACTION_EMERGENCY + 5), NULL)));
|
||||
}
|
||||
|
||||
void AvoidAoeStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
|
||||
{
|
||||
multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI));
|
||||
// multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI));
|
||||
}
|
||||
@@ -23,6 +23,7 @@ class AvoidAoeStrategy : public Strategy
|
||||
public:
|
||||
explicit AvoidAoeStrategy(PlayerbotAI* ai);
|
||||
const std::string getName() override { return "avoid aoe"; }
|
||||
NextAction** getDefaultActions() override;
|
||||
void InitMultipliers(std::vector<Multiplier*>& multipliers) override;
|
||||
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||
};
|
||||
|
||||
@@ -80,7 +80,6 @@ class TriggerContext : public NamedObjectContext<Trigger>
|
||||
|
||||
creators["has area debuff"] = &TriggerContext::HasAreaDebuff;
|
||||
|
||||
|
||||
creators["enemy out of melee"] = &TriggerContext::EnemyOutOfMelee;
|
||||
creators["enemy out of spell"] = &TriggerContext::EnemyOutOfSpell;
|
||||
creators["enemy too close for spell"] = &TriggerContext::enemy_too_close_for_spell;
|
||||
|
||||
@@ -33,4 +33,14 @@ class ExpectedGroupDpsValue : public FloatCalculatedValue
|
||||
public:
|
||||
float Calculate() override;
|
||||
};
|
||||
|
||||
class AreaDebuffValue : public CalculatedValue<Aura*>
|
||||
{
|
||||
public:
|
||||
AreaDebuffValue(PlayerbotAI* botAI) :
|
||||
CalculatedValue<Aura*>(botAI, "area debuff", 20 * 1000) { }
|
||||
|
||||
Aura* Calculate() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -295,8 +295,9 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
creators["boss target"] = &ValueContext::boss_target;
|
||||
creators["nearest triggers"] = &ValueContext::nearest_triggers;
|
||||
creators["neglect threat"] = &ValueContext::neglect_threat;
|
||||
creators["expected lifetime"] = &ValueContext::expected_lifetime;
|
||||
creators["expected group dps"] = &ValueContext::expected_group_dps;
|
||||
creators["expected lifetime"] = &ValueContext::expected_lifetime;
|
||||
creators["expected group dps"] = &ValueContext::expected_group_dps;
|
||||
creators["area debuff"] = &ValueContext::area_debuff;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -497,7 +498,7 @@ class ValueContext : public NamedObjectContext<UntypedValue>
|
||||
static UntypedValue* neglect_threat(PlayerbotAI* ai) { return new NeglectThreatResetValue(ai); }
|
||||
static UntypedValue* expected_lifetime(PlayerbotAI* ai) { return new ExpectedLifetimeValue(ai); }
|
||||
static UntypedValue* expected_group_dps(PlayerbotAI* ai) { return new ExpectedGroupDpsValue(ai); }
|
||||
|
||||
static UntypedValue* area_debuff(PlayerbotAI* ai) { return new AreaDebuffValue(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user