Skip to content

Commit

Permalink
warrior update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lidocian authored and ConanHUN committed Nov 21, 2018
1 parent deee8ba commit e7573d5
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 79 deletions.
6 changes: 4 additions & 2 deletions playerbot/AiFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
case CLASS_WARRIOR:
if (tab == 2)
engine->addStrategies("tank", "tank aoe", NULL);
else
engine->addStrategies("dps", "dps assist", "threat", NULL);
else if (tab == 1)
engine->addStrategies("fury dps", "fury aoe", "dps assist", "threat", NULL);
else if (tab == 0)
engine->addStrategies("arms dps", "arms aoe", "dps assist", "threat", NULL);
break;
case CLASS_SHAMAN:
if (tab == 0)
Expand Down
98 changes: 58 additions & 40 deletions playerbot/strategy/warrior/ArmsWarriorStrategy.cpp
Original file line number Diff line number Diff line change
@@ -1,105 +1,123 @@
#include "botpch.h"
#include "../../playerbot.h"
#include "WarriorMultipliers.h"
#include "DpsWarriorStrategy.h"
#include "ArmsWarriorStrategy.h"

using namespace ai;

class DpsWarriorStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
class ArmsWarriorStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
DpsWarriorStrategyActionNodeFactory()
ArmsWarriorStrategyActionNodeFactory()
{
creators["overpower"] = &overpower;
creators["melee"] = &melee;
creators["charge"] = &charge;
creators["bloodthirst"] = &bloodthirst;
creators["rend"] = &rend;
creators["mocking blow"] = &mocking_blow;
creators["intercept"] = &intercept;
creators["mortal strike"] = &mortal_strike;
creators["slam"] = &slam;
creators["whirlwind"] = &whirlwind;
creators["death wish"] = &death_wish;
creators["execute"] = &execute;
creators["reach melee"] = &reach_melee;
}
private:
static ActionNode* overpower(PlayerbotAI* ai)
{
return new ActionNode("overpower",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("melee"), NULL),
/*C*/ NULL);
}

static ActionNode* melee(PlayerbotAI* ai)
{
return new ActionNode("melee",
return new ActionNode ("melee",
/*P*/ NextAction::array(0, new NextAction("charge"), NULL),
/*A*/ NULL,
/*A*/ NextAction::array(0, new NextAction("mortal strike"), NULL),
/*C*/ NULL);
}
static ActionNode* charge(PlayerbotAI* ai)
{
return new ActionNode("charge",
return new ActionNode ("charge",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("reach melee"), NULL),
/*C*/ NULL);
}
static ActionNode* bloodthirst(PlayerbotAI* ai)
static ActionNode* reach_melee(PlayerbotAI* ai)
{
return new ActionNode("bloodthirst",
return new ActionNode("reach melee",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("heroic strike"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* rend(PlayerbotAI* ai)
static ActionNode* intercept(PlayerbotAI* ai)
{
return new ActionNode("intercept",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("reach melee"), NULL),
/*C*/ NULL);
}
static ActionNode* mortal_strike(PlayerbotAI* ai)
{
return new ActionNode("rend",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NULL,
return new ActionNode ("mortal strike",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("whirlwind"), NULL),
/*C*/ NULL);
}
static ActionNode* mocking_blow(PlayerbotAI* ai)
static ActionNode* slam(PlayerbotAI* ai)
{
return new ActionNode("mocking blow",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NextAction::array(0, NULL),
return new ActionNode ("slam",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("whirlwind"), NULL),
/*C*/ NULL);
}
static ActionNode* whirlwind(PlayerbotAI* ai)
{
return new ActionNode ("whirlwind",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("slam"), NULL),
/*C*/ NULL);
}
static ActionNode* death_wish(PlayerbotAI* ai)
{
return new ActionNode("death wish",
return new ActionNode ("death wish",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("berserker rage"), NULL),
/*C*/ NULL);
}
static ActionNode* execute(PlayerbotAI* ai)
{
return new ActionNode("execute",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("heroic strike"), NULL),
return new ActionNode ("execute",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
};

DpsWarriorStrategy::DpsWarriorStrategy(PlayerbotAI* ai) : GenericWarriorStrategy(ai)
ArmsWarriorStrategy::ArmsWarriorStrategy(PlayerbotAI* ai) : GenericWarriorStrategy(ai)
{
actionNodeFactories.Add(new DpsWarriorStrategyActionNodeFactory());
actionNodeFactories.Add(new ArmsWarriorStrategyActionNodeFactory());
}

NextAction** DpsWarriorStrategy::getDefaultActions()
NextAction** ArmsWarriorStrategy::getDefaultActions()
{
return NextAction::array(0, new NextAction("bloodthirst", ACTION_NORMAL + 1), NULL);
return NextAction::array(0, new NextAction("mortal strike", ACTION_HIGH + 5), NULL);
}

void DpsWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
void ArmsWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
{
GenericWarriorStrategy::InitTriggers(triggers);

triggers.push_back(new TriggerNode(
"enemy out of melee",
NextAction::array(0, new NextAction("charge", ACTION_NORMAL + 9), NULL)));

triggers.push_back(new TriggerNode(
"intercept",
NextAction::array(0, new NextAction("intercept", ACTION_NORMAL + 9), NULL)));


triggers.push_back(new TriggerNode(
"target critical health",
NextAction::array(0, new NextAction("execute", ACTION_HIGH + 4), NULL)));

triggers.push_back(new TriggerNode(
"high rage available",
NextAction::array(0, new NextAction("heroic strike", ACTION_HIGH + 4), NULL)));

triggers.push_back(new TriggerNode(
"hamstring",
NextAction::array(0, new NextAction("hamstring", ACTION_INTERRUPT), NULL)));
Expand All @@ -114,17 +132,17 @@ void DpsWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
}


void DpsWarrirorAoeStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
void ArmsWarriorAoeStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
{
triggers.push_back(new TriggerNode(
"rend on attacker",
NextAction::array(0, new NextAction("rend on attacker", ACTION_HIGH + 1), NULL)));

triggers.push_back(new TriggerNode(
"light aoe",
NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 2), new NextAction("demoralizing shout", ACTION_HIGH + 2), NULL)));
NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 2), new NextAction("sweeping strike", ACTION_HIGH + 2), NULL)));

triggers.push_back(new TriggerNode(
"medium aoe",
NextAction::array(0, new NextAction("cleave", ACTION_HIGH + 3), NULL)));
NextAction::array(0, new NextAction("cleave", ACTION_HIGH + 3), new NextAction("sweeping strike", ACTION_HIGH + 3), NULL)));
}
12 changes: 6 additions & 6 deletions playerbot/strategy/warrior/ArmsWarriorStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@

namespace ai
{
class DpsWarriorStrategy : public GenericWarriorStrategy
class ArmsWarriorStrategy : public GenericWarriorStrategy
{
public:
DpsWarriorStrategy(PlayerbotAI* ai);
ArmsWarriorStrategy(PlayerbotAI* ai);

public:
virtual void InitTriggers(std::list<TriggerNode*> &triggers);
virtual string getName() { return "dps"; }
virtual string getName() { return "arms dps"; }
virtual NextAction** getDefaultActions();
virtual int GetType() { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; }
};

class DpsWarrirorAoeStrategy : public CombatStrategy
class ArmsWarriorAoeStrategy : public CombatStrategy
{
public:
DpsWarrirorAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {}
ArmsWarriorAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {}

public:
virtual void InitTriggers(std::list<TriggerNode*> &triggers);
virtual string getName() { return "aoe"; }
virtual string getName() { return "arms aoe"; }
};
}
57 changes: 33 additions & 24 deletions playerbot/strategy/warrior/FuryWarriorStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,22 @@ class FuryWarriorStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
public:
FuryWarriorStrategyActionNodeFactory()
{
creators["overpower"] = &overpower;
creators["melee"] = &melee;
creators["charge"] = &charge;
creators["bloodthirst"] = &bloodthirst;
creators["rend"] = &rend;
creators["mocking blow"] = &mocking_blow;
creators["rampage"] = &rampage;
creators["whirlwind"] = &whirlwind;
creators["slam"] = &slam;
creators["death wish"] = &death_wish;
creators["execute"] = &execute;
}
private:
static ActionNode* overpower(PlayerbotAI* ai)
{
return new ActionNode ("overpower",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("melee"), NULL),
/*C*/ NULL);
}

static ActionNode* melee(PlayerbotAI* ai)
{
return new ActionNode ("melee",
/*P*/ NextAction::array(0, new NextAction("charge"), NULL),
/*A*/ NULL,
/*A*/ NextAction::array(0, new NextAction("bloodthirst"), NULL),
/*C*/ NULL);
}
static ActionNode* charge(PlayerbotAI* ai)
Expand All @@ -44,22 +38,29 @@ class FuryWarriorStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
static ActionNode* bloodthirst(PlayerbotAI* ai)
{
return new ActionNode ("bloodthirst",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("heroic strike"), NULL),
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("whirlwind"), NULL),
/*C*/ NULL);
}
static ActionNode* rend(PlayerbotAI* ai)
static ActionNode* rampage(PlayerbotAI* ai)
{
return new ActionNode ("rend",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
return new ActionNode ("rampage",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* mocking_blow(PlayerbotAI* ai)
static ActionNode* whirlwind(PlayerbotAI* ai)
{
return new ActionNode ("mocking blow",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NextAction::array(0, NULL),
return new ActionNode ("whirlwind",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* slam(PlayerbotAI* ai)
{
return new ActionNode ("slam",
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* death_wish(PlayerbotAI* ai)
Expand All @@ -72,8 +73,8 @@ class FuryWarriorStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
static ActionNode* execute(PlayerbotAI* ai)
{
return new ActionNode ("execute",
/*P*/ NextAction::array(0, new NextAction("battle stance"), NULL),
/*A*/ NextAction::array(0, new NextAction("heroic strike"), NULL),
/*P*/ NextAction::array(0, new NextAction("berserker stance"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
};
Expand All @@ -85,7 +86,7 @@ FuryWarriorStrategy::FuryWarriorStrategy(PlayerbotAI* ai) : GenericWarriorStrate

NextAction** FuryWarriorStrategy::getDefaultActions()
{
return NextAction::array(0, new NextAction("bloodthirst", ACTION_NORMAL + 1), NULL);
return NextAction::array(0, new NextAction("bloodthirst", ACTION_HIGH + 5), NULL);
}

void FuryWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
Expand All @@ -96,6 +97,10 @@ void FuryWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
"enemy out of melee",
NextAction::array(0, new NextAction("charge", ACTION_NORMAL + 9), NULL)));

triggers.push_back(new TriggerNode(
"high rage available",
NextAction::array(0, new NextAction("heroic strike", ACTION_HIGH + 4), NULL)));

triggers.push_back(new TriggerNode(
"target critical health",
NextAction::array(0, new NextAction("execute", ACTION_HIGH + 4), NULL)));
Expand All @@ -104,6 +109,10 @@ void FuryWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
"hamstring",
NextAction::array(0, new NextAction("hamstring", ACTION_INTERRUPT), NULL)));

triggers.push_back(new TriggerNode(
"rampage",
NextAction::array(0, new NextAction("rampage", ACTION_HIGH + 4), NULL)));

triggers.push_back(new TriggerNode(
"victory rush",
NextAction::array(0, new NextAction("victory rush", ACTION_HIGH + 3), NULL)));
Expand All @@ -114,7 +123,7 @@ void FuryWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
}


void FuryWarrirorAoeStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
void FuryWarriorAoeStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
{
triggers.push_back(new TriggerNode(
"rend on attacker",
Expand Down
6 changes: 3 additions & 3 deletions playerbot/strategy/warrior/FuryWarriorStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace ai
virtual int GetType() { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; }
};

class FuryWarrirorAoeStrategy : public CombatStrategy
class FuryWarriorAoeStrategy : public CombatStrategy
{
public:
FuryWarrirorAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {}
FuryWarriorAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {}

public:
virtual void InitTriggers(std::list<TriggerNode*> &triggers);
virtual string getName() { return "aoe"; }
virtual string getName() { return "fury aoe"; }
};
}
11 changes: 11 additions & 0 deletions playerbot/strategy/warrior/TankWarriorStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,14 @@ void TankWarriorStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
"concussion blow",
NextAction::array(0, new NextAction("concussion blow", ACTION_INTERRUPT), NULL)));
}

void TankWarriorAoeStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
{
triggers.push_back(new TriggerNode(
"light aoe",
NextAction::array(0, new NextAction("thunder clap", ACTION_HIGH + 2), new NextAction("demoralizing shout", ACTION_HIGH + 2), NULL)));

triggers.push_back(new TriggerNode(
"medium aoe",
NextAction::array(0, new NextAction("cleave", ACTION_HIGH + 3), NULL)));
}
10 changes: 10 additions & 0 deletions playerbot/strategy/warrior/TankWarriorStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ namespace ai
virtual NextAction** getDefaultActions();
virtual int GetType() { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; }
};

class TankWarriorAoeStrategy : public CombatStrategy
{
public:
TankWarriorAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {}

public:
virtual void InitTriggers(std::list<TriggerNode*> &triggers);
virtual string getName() { return "tank aoe"; }
};
}
Loading

0 comments on commit e7573d5

Please sign in to comment.