mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-17 00:54:35 +00:00
[Strategy] Focus strategy
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "ThreatStrategy.h"
|
||||
#include "GenericSpellActions.h"
|
||||
#include "Map.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
float ThreatMultiplier::GetValue(Action* action)
|
||||
@@ -36,3 +37,22 @@ void ThreatStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
|
||||
{
|
||||
multipliers.push_back(new ThreatMultiplier(botAI));
|
||||
}
|
||||
|
||||
float FocusMultiplier::GetValue(Action* action)
|
||||
{
|
||||
if (!action) {
|
||||
return 1.0f;
|
||||
}
|
||||
if (action->getThreatType() == Action::ActionThreatType::Aoe && !dynamic_cast<CastHealingSpellAction*>(action)) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (dynamic_cast<CastDebuffSpellOnAttackerAction*>(action)) {
|
||||
return 0.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void FocusStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
|
||||
{
|
||||
multipliers.push_back(new FocusMultiplier(botAI));
|
||||
}
|
||||
|
||||
@@ -26,4 +26,21 @@ class ThreatStrategy : public Strategy
|
||||
std::string const getName() override { return "threat"; }
|
||||
};
|
||||
|
||||
class FocusMultiplier : public Multiplier
|
||||
{
|
||||
public:
|
||||
FocusMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "focus") { }
|
||||
|
||||
float GetValue(Action* action) override;
|
||||
};
|
||||
|
||||
class FocusStrategy : public Strategy
|
||||
{
|
||||
public:
|
||||
FocusStrategy(PlayerbotAI* botAI) : Strategy(botAI) { }
|
||||
|
||||
void InitMultipliers(std::vector<Multiplier*>& multipliers) override;
|
||||
std::string const getName() override { return "focus"; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user