diff --git a/src/strategy/actions/ActionContext.h b/src/strategy/actions/ActionContext.h index 0b5568ef..6cdc68b1 100644 --- a/src/strategy/actions/ActionContext.h +++ b/src/strategy/actions/ActionContext.h @@ -88,6 +88,7 @@ class ActionContext : public NamedObjectContext 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 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); } diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index faf6a328..d4419670 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -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")); diff --git a/src/strategy/actions/MovementActions.h b/src/strategy/actions/MovementActions.h index 2a605cb1..4865d7e1 100644 --- a/src/strategy/actions/MovementActions.h +++ b/src/strategy/actions/MovementActions.h @@ -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; }; diff --git a/src/strategy/generic/CombatStrategy.cpp b/src/strategy/generic/CombatStrategy.cpp index 483fbe00..3b72af7f 100644 --- a/src/strategy/generic/CombatStrategy.cpp +++ b/src/strategy/generic/CombatStrategy.cpp @@ -4,6 +4,7 @@ #include "CombatStrategy.h" #include "Playerbots.h" +#include "Strategy.h" void CombatStrategy::InitTriggers(std::vector &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& 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& multipliers) { - multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI)); + // multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI)); } \ No newline at end of file diff --git a/src/strategy/generic/CombatStrategy.h b/src/strategy/generic/CombatStrategy.h index 0ac9e3f3..33813615 100644 --- a/src/strategy/generic/CombatStrategy.h +++ b/src/strategy/generic/CombatStrategy.h @@ -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& multipliers) override; void InitTriggers(std::vector& triggers) override; }; diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index 1abed160..92fb96a2 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -80,7 +80,6 @@ class TriggerContext : public NamedObjectContext 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; diff --git a/src/strategy/values/ExpectedLifetimeValue.h b/src/strategy/values/ExpectedLifetimeValue.h index e9f432f2..65780bed 100644 --- a/src/strategy/values/ExpectedLifetimeValue.h +++ b/src/strategy/values/ExpectedLifetimeValue.h @@ -33,4 +33,14 @@ class ExpectedGroupDpsValue : public FloatCalculatedValue public: float Calculate() override; }; + +class AreaDebuffValue : public CalculatedValue +{ + public: + AreaDebuffValue(PlayerbotAI* botAI) : + CalculatedValue(botAI, "area debuff", 20 * 1000) { } + + Aura* Calculate() override; +}; + #endif diff --git a/src/strategy/values/ValueContext.h b/src/strategy/values/ValueContext.h index 38f37840..c90dbd49 100644 --- a/src/strategy/values/ValueContext.h +++ b/src/strategy/values/ValueContext.h @@ -295,8 +295,9 @@ class ValueContext : public NamedObjectContext 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 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