Revert classes folder

This commit is contained in:
Yunfan Li
2024-12-14 16:23:13 +08:00
parent be71872112
commit df5b10c9ad
179 changed files with 11 additions and 9 deletions

View File

@@ -0,0 +1,93 @@
#include "AssassinationRogueStrategy.h"
#include "Playerbots.h"
class AssassinationRogueStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
AssassinationRogueStrategyActionNodeFactory()
{
creators["mutilate"] = &mutilate;
creators["envenom"] = &envenom;
}
private:
static ActionNode* mutilate(PlayerbotAI* ai)
{
return new ActionNode("mutilate",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("sinister strike"), NULL),
/*C*/ NULL);
}
static ActionNode* envenom(PlayerbotAI* ai)
{
return new ActionNode("envenom",
/*P*/ NULL,
/*A*/ NextAction::array(0, new NextAction("eviscerate"), NULL),
/*C*/ NULL);
}
};
AssassinationRogueStrategy::AssassinationRogueStrategy(PlayerbotAI* ai) : MeleeCombatStrategy(ai)
{
actionNodeFactories.Add(new AssassinationRogueStrategyActionNodeFactory());
}
NextAction** AssassinationRogueStrategy::getDefaultActions()
{
return NextAction::array(0, new NextAction("melee", ACTION_DEFAULT), NULL);
}
void AssassinationRogueStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
MeleeCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("high energy available",
NextAction::array(0, new NextAction("garrote", ACTION_HIGH + 7),
new NextAction("ambush", ACTION_HIGH + 6), nullptr)));
triggers.push_back(new TriggerNode("high energy available",
NextAction::array(0, new NextAction("mutilate", ACTION_NORMAL + 3), NULL)));
triggers.push_back(new TriggerNode(
"hunger for blood", NextAction::array(0, new NextAction("hunger for blood", ACTION_HIGH + 6), NULL)));
triggers.push_back(new TriggerNode("slice and dice",
NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 5), NULL)));
triggers.push_back(new TriggerNode("combo points 3 available",
NextAction::array(0, new NextAction("envenom", ACTION_HIGH + 4), NULL)));
triggers.push_back(
new TriggerNode("expose armor", NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), NULL)));
triggers.push_back(
new TriggerNode("medium threat", NextAction::array(0, new NextAction("vanish", ACTION_HIGH), NULL)));
triggers.push_back(
new TriggerNode("low health", NextAction::array(0, new NextAction("evasion", ACTION_HIGH + 9),
new NextAction("feint", ACTION_HIGH + 8), nullptr)));
triggers.push_back(
new TriggerNode("critical health", NextAction::array(0, new NextAction("cloak of shadows", ACTION_HIGH + 7), nullptr)));
triggers.push_back(
new TriggerNode("kick", NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), NULL)));
triggers.push_back(
new TriggerNode("kick on enemy healer",
NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), NULL)));
triggers.push_back(
new TriggerNode("medium aoe", NextAction::array(0, new NextAction("fan of knives", ACTION_NORMAL + 5), NULL)));
triggers.push_back(new TriggerNode(
"low tank threat",
NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), NULL)));
triggers.push_back(new TriggerNode(
"enemy out of melee",
NextAction::array(0, new NextAction("stealth", ACTION_HIGH + 3), new NextAction("sprint", ACTION_HIGH + 2),
new NextAction("reach melee", ACTION_HIGH + 1), NULL)));
}

View File

@@ -0,0 +1,19 @@
#ifndef _PLAYERBOT_ASSASSINATIONROGUESTRATEGY_H
#define _PLAYERBOT_ASSASSINATIONROGUESTRATEGY_H
#include "MeleeCombatStrategy.h"
class AssassinationRogueStrategy : public MeleeCombatStrategy
{
public:
AssassinationRogueStrategy(PlayerbotAI* ai);
public:
virtual void InitTriggers(std::vector<TriggerNode*>& triggers) override;
virtual std::string const getName() override { return "melee"; }
virtual NextAction** getDefaultActions() override;
uint32 GetType() const override { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; }
};
#endif

View File

@@ -0,0 +1,263 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "DpsRogueStrategy.h"
#include "Playerbots.h"
class DpsRogueStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
DpsRogueStrategyActionNodeFactory()
{
creators["mutilate"] = &mutilate;
creators["sinister strike"] = &sinister_strike;
creators["kick"] = &kick;
creators["kidney shot"] = &kidney_shot;
creators["backstab"] = &backstab;
creators["melee"] = &melee;
creators["rupture"] = &rupture;
}
private:
static ActionNode* melee(PlayerbotAI* botAI)
{
return new ActionNode("melee",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("mutilate"), nullptr),
/*C*/ nullptr);
}
static ActionNode* mutilate(PlayerbotAI* botAI)
{
return new ActionNode("mutilate",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("sinister strike"), nullptr),
/*C*/ nullptr);
}
static ActionNode* sinister_strike(PlayerbotAI* botAI)
{
return new ActionNode("sinister strike",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("melee"), nullptr),
/*C*/ nullptr);
}
static ActionNode* kick(PlayerbotAI* botAI)
{
return new ActionNode("kick",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("kidney shot"), nullptr),
/*C*/ nullptr);
}
static ActionNode* kidney_shot(PlayerbotAI* botAI)
{
return new ActionNode("kidney shot",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ nullptr);
}
static ActionNode* backstab(PlayerbotAI* botAI)
{
return new ActionNode("backstab",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("mutilate"), nullptr),
/*C*/ nullptr);
}
static ActionNode* rupture(PlayerbotAI* botAI)
{
return new ActionNode("rupture",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("eviscerate"), nullptr),
/*C*/ nullptr);
}
};
DpsRogueStrategy::DpsRogueStrategy(PlayerbotAI* botAI) : MeleeCombatStrategy(botAI)
{
actionNodeFactories.Add(new DpsRogueStrategyActionNodeFactory());
}
NextAction** DpsRogueStrategy::getDefaultActions()
{
return NextAction::array(0, new NextAction("killing spree", ACTION_DEFAULT + 0.1f),
new NextAction("melee", ACTION_DEFAULT), nullptr);
}
void DpsRogueStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
MeleeCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("high energy available",
NextAction::array(0, new NextAction("garrote", ACTION_HIGH + 7),
new NextAction("ambush", ACTION_HIGH + 6), nullptr)));
triggers.push_back(new TriggerNode(
"high energy available", NextAction::array(0, new NextAction("sinister strike", ACTION_NORMAL + 3), nullptr)));
triggers.push_back(new TriggerNode(
"slice and dice", NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode("combo points available",
NextAction::array(0, new NextAction("rupture", ACTION_HIGH + 1),
new NextAction("eviscerate", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("target with combo points almost dead",
NextAction::array(0, new NextAction("eviscerate", ACTION_HIGH + 2), nullptr)));
triggers.push_back(
new TriggerNode("medium threat", NextAction::array(0, new NextAction("vanish", ACTION_HIGH), nullptr)));
triggers.push_back(
new TriggerNode("low health", NextAction::array(0, new NextAction("evasion", ACTION_HIGH + 9),
new NextAction("feint", ACTION_HIGH + 8), nullptr)));
triggers.push_back(new TriggerNode(
"critical health", NextAction::array(0, new NextAction("cloak of shadows", ACTION_HIGH + 7), nullptr)));
triggers.push_back(
new TriggerNode("kick", NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), nullptr)));
triggers.push_back(
new TriggerNode("kick on enemy healer",
NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), nullptr)));
// triggers.push_back(new TriggerNode(
// "behind target",
// NextAction::array(0, new NextAction("backstab", ACTION_NORMAL), nullptr)));
triggers.push_back(
new TriggerNode("light aoe", NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH + 3), nullptr)));
triggers.push_back(new TriggerNode("blade flurry",
NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode(
"enemy out of melee",
NextAction::array(0, new NextAction("stealth", ACTION_HIGH + 3), new NextAction("sprint", ACTION_HIGH + 2),
new NextAction("reach melee", ACTION_HIGH + 1), nullptr)));
triggers.push_back(new TriggerNode("expose armor",
NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), nullptr)));
triggers.push_back(new TriggerNode(
"low tank threat",
NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), nullptr)));
}
class StealthedRogueStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
StealthedRogueStrategyActionNodeFactory()
{
creators["ambush"] = &ambush;
creators["cheap shot"] = &cheap_shot;
creators["garrote"] = &garrote;
creators["sap"] = &sap;
creators["sinister strike"] = &sinister_strike;
}
private:
static ActionNode* ambush(PlayerbotAI* botAI)
{
return new ActionNode("ambush",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("garrote"), nullptr),
/*C*/ nullptr);
}
static ActionNode* cheap_shot(PlayerbotAI* botAI)
{
return new ActionNode("cheap shot",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ nullptr);
}
static ActionNode* garrote(PlayerbotAI* botAI)
{
return new ActionNode("garrote",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ nullptr);
}
static ActionNode* sap(PlayerbotAI* botAI)
{
return new ActionNode("sap",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ nullptr);
}
static ActionNode* sinister_strike(PlayerbotAI* botAI)
{
return new ActionNode("sinister strike",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("cheap shot"), nullptr),
/*C*/ nullptr);
}
};
StealthedRogueStrategy::StealthedRogueStrategy(PlayerbotAI* botAI) : Strategy(botAI)
{
actionNodeFactories.Add(new StealthedRogueStrategyActionNodeFactory());
}
NextAction** StealthedRogueStrategy::getDefaultActions()
{
return NextAction::array(
0, new NextAction("ambush", ACTION_NORMAL + 4), new NextAction("backstab", ACTION_NORMAL + 3),
new NextAction("cheap shot", ACTION_NORMAL + 2), new NextAction("sinister strike", ACTION_NORMAL + 1),
new NextAction("melee", ACTION_NORMAL), nullptr);
}
void StealthedRogueStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(new TriggerNode("combo points available",
NextAction::array(0, new NextAction("eviscerate", ACTION_HIGH), nullptr)));
triggers.push_back(
new TriggerNode("kick", NextAction::array(0, new NextAction("cheap shot", ACTION_INTERRUPT), nullptr)));
triggers.push_back(new TriggerNode("kick on enemy healer",
NextAction::array(0, new NextAction("cheap shot", ACTION_INTERRUPT), nullptr)));
triggers.push_back(
new TriggerNode("behind target", NextAction::array(0, new NextAction("ambush", ACTION_HIGH), nullptr)));
triggers.push_back(
new TriggerNode("not behind target", NextAction::array(0, new NextAction("cheap shot", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("enemy flagcarrier near",
NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr)));
triggers.push_back(
new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", ACTION_NORMAL), nullptr)));
/*triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", ACTION_EMERGENCY +
* 1), nullptr)));*/
triggers.push_back(new TriggerNode(
"no stealth", NextAction::array(0, new NextAction("check stealth", ACTION_EMERGENCY), nullptr)));
triggers.push_back(
new TriggerNode("sprint", NextAction::array(0, new NextAction("sprint", ACTION_INTERRUPT), nullptr)));
}
void StealthStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(
new TriggerNode("stealth", NextAction::array(0, new NextAction("stealth", ACTION_INTERRUPT), nullptr)));
}
void RogueAoeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(
new TriggerNode("light aoe", NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode(
"medium aoe", NextAction::array(0, new NextAction("fan of knives", ACTION_NORMAL + 5), nullptr)));
}
void RogueBoostStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(new TriggerNode(
"adrenaline rush", NextAction::array(0, new NextAction("adrenaline rush", ACTION_HIGH + 2), nullptr)));
}
void RogueCcStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(new TriggerNode("sap", NextAction::array(0, new NextAction("stealth", ACTION_INTERRUPT),
new NextAction("sap", ACTION_INTERRUPT), nullptr)));
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_DPSROGUESTRATEGY_H
#define _PLAYERBOT_DPSROGUESTRATEGY_H
#include "CombatStrategy.h"
#include "MeleeCombatStrategy.h"
class PlayerbotAI;
class DpsRogueStrategy : public MeleeCombatStrategy
{
public:
DpsRogueStrategy(PlayerbotAI* botAI);
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "dps"; }
NextAction** getDefaultActions() override;
uint32 GetType() const override { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; }
};
class StealthedRogueStrategy : public Strategy
{
public:
StealthedRogueStrategy(PlayerbotAI* botAI);
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "stealthed"; }
NextAction** getDefaultActions() override;
};
class StealthStrategy : public Strategy
{
public:
StealthStrategy(PlayerbotAI* botAI) : Strategy(botAI){};
// virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; }
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "stealth"; }
};
class RogueAoeStrategy : public Strategy
{
public:
RogueAoeStrategy(PlayerbotAI* botAI) : Strategy(botAI) {}
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "aoe"; }
};
class RogueBoostStrategy : public Strategy
{
public:
RogueBoostStrategy(PlayerbotAI* botAI) : Strategy(botAI) {}
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "boost"; }
};
class RogueCcStrategy : public Strategy
{
public:
RogueCcStrategy(PlayerbotAI* botAI) : Strategy(botAI) {}
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "cc"; }
};
#endif

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "GenericRogueNonCombatStrategy.h"
#include "Playerbots.h"
class GenericRogueNonCombatStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
GenericRogueNonCombatStrategyActionNodeFactory()
{
creators["use deadly poison on off hand"] = &use_deadly_poison_on_off_hand;
}
private:
static ActionNode* use_deadly_poison_on_off_hand(PlayerbotAI* botAI)
{
return new ActionNode("use deadly poison on off hand",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("use instant poison on off hand"), nullptr),
/*C*/ nullptr);
}
};
GenericRogueNonCombatStrategy::GenericRogueNonCombatStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI)
{
actionNodeFactories.Add(new GenericRogueNonCombatStrategyActionNodeFactory());
}
void GenericRogueNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("player has flag",
NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr)));
triggers.push_back(new TriggerNode("enemy flagcarrier near",
NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 2), nullptr)));
// triggers.push_back(new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", 1.0f),
// nullptr))); triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply
// poison", 1.0f), nullptr)));
triggers.push_back(
new TriggerNode("main hand weapon no enchant",
NextAction::array(0, new NextAction("use instant poison on main hand", 20.0f), NULL)));
triggers.push_back(
new TriggerNode("off hand weapon no enchant",
NextAction::array(0, new NextAction("use deadly poison on off hand", 19.0f), NULL)));
// triggers.push_back(new TriggerNode(
// "off hand weapon no enchant",
// NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL)));
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("unstealth", 30.0f), NULL)));
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_GENERICROGUENONCOMBATSTRATEGY_H
#define _PLAYERBOT_GENERICROGUENONCOMBATSTRATEGY_H
#include "NonCombatStrategy.h"
class PlayerbotAI;
class GenericRogueNonCombatStrategy : public NonCombatStrategy
{
public:
GenericRogueNonCombatStrategy(PlayerbotAI* botAI);
std::string const getName() override { return "nc"; }
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
};
#endif

View File

@@ -0,0 +1,168 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueActions.h"
#include "Event.h"
#include "ObjectGuid.h"
#include "Player.h"
#include "Playerbots.h"
bool CastStealthAction::isPossible()
{
// do not use with WSG flag or EYE flag
return !botAI->HasAura(23333, bot) && !botAI->HasAura(23335, bot) && !botAI->HasAura(34976, bot);
}
bool UnstealthAction::Execute(Event event)
{
botAI->RemoveAura("stealth");
// botAI->ChangeStrategy("+dps,-stealthed", BOT_STATE_COMBAT);
return true;
}
bool CheckStealthAction::Execute(Event event)
{
if (botAI->HasAura("stealth", bot))
{
botAI->ChangeStrategy("-dps,+stealthed", BOT_STATE_COMBAT);
}
else
{
botAI->ChangeStrategy("+dps,-stealthed", BOT_STATE_COMBAT);
}
return true;
}
bool CastVanishAction::isUseful()
{
// do not use with WSG flag or EYE flag
return !botAI->HasAura(23333, bot) && !botAI->HasAura(23335, bot) && !botAI->HasAura(34976, bot);
}
bool CastTricksOfTheTradeOnMainTankAction::isUseful()
{
return CastSpellAction::isUseful() && AI_VALUE2(float, "distance", GetTargetName()) < 20.0f;
}
bool UseDeadlyPoisonAction::Execute(Event event)
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Deadly Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
if (items.empty())
{
return false;
}
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell);
// return UseItemAuto(*items.begin());
}
bool UseDeadlyPoisonAction::isPossible()
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Deadly Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
return !items.empty();
}
bool UseInstantPoisonAction::Execute(Event event)
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Instant Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
if (items.empty())
{
return false;
}
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell);
}
bool UseInstantPoisonAction::isPossible()
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Instant Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
return !items.empty();
}
bool UseInstantPoisonOffHandAction::Execute(Event event)
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Instant Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
if (items.empty())
{
return false;
}
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell);
}
bool UseInstantPoisonOffHandAction::isPossible()
{
std::vector<std::string> poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""};
std::vector<Item*> items;
std::string poison_name;
for (std::string& suffix : poison_suffixs)
{
poison_name = "Instant Poison" + suffix;
items = AI_VALUE2(std::vector<Item*>, "inventory items", poison_name);
if (!items.empty())
{
break;
}
}
return !items.empty();
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUEACTIONS_H
#define _PLAYERBOT_ROGUEACTIONS_H
#include "GenericSpellActions.h"
#include "UseItemAction.h"
class PlayerbotAI;
class CastEvasionAction : public CastBuffSpellAction
{
public:
CastEvasionAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "evasion") {}
};
class CastCloakOfShadowsAction : public CastBuffSpellAction
{
public:
CastCloakOfShadowsAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "cloak of shadows") {}
};
class CastHungerForBloodAction : public CastBuffSpellAction
{
public:
CastHungerForBloodAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "hunger for blood") {}
std::string const GetTargetName() override { return "current target"; }
};
class CastSprintAction : public CastBuffSpellAction
{
public:
CastSprintAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "sprint") {}
std::string const GetTargetName() override { return "self target"; }
};
class CastStealthAction : public CastBuffSpellAction
{
public:
CastStealthAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "stealth") {}
std::string const GetTargetName() override { return "self target"; }
bool isPossible() override;
};
class UnstealthAction : public Action
{
public:
UnstealthAction(PlayerbotAI* botAI) : Action(botAI, "unstealth") {}
bool Execute(Event event) override;
};
class CheckStealthAction : public Action
{
public:
CheckStealthAction(PlayerbotAI* botAI) : Action(botAI, "check stealth") {}
bool isPossible() override { return true; }
bool Execute(Event event) override;
};
class CastKickAction : public CastSpellAction
{
public:
CastKickAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "kick") {}
};
class CastFeintAction : public CastBuffSpellAction
{
public:
CastFeintAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "feint") {}
};
class CastDismantleAction : public CastSpellAction
{
public:
CastDismantleAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "dismantle") {}
};
class CastDistractAction : public CastSpellAction
{
public:
CastDistractAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "distract") {}
};
class CastVanishAction : public CastBuffSpellAction
{
public:
CastVanishAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "vanish") {}
bool isUseful() override;
};
class CastBlindAction : public CastDebuffSpellAction
{
public:
CastBlindAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "blind") {}
};
class CastBladeFlurryAction : public CastBuffSpellAction
{
public:
CastBladeFlurryAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "blade flurry") {}
};
class CastAdrenalineRushAction : public CastBuffSpellAction
{
public:
CastAdrenalineRushAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "adrenaline rush") {}
};
class CastKillingSpreeAction : public CastMeleeSpellAction
{
public:
CastKillingSpreeAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "killing spree") {}
};
class CastKickOnEnemyHealerAction : public CastSpellOnEnemyHealerAction
{
public:
CastKickOnEnemyHealerAction(PlayerbotAI* botAI) : CastSpellOnEnemyHealerAction(botAI, "kick") {}
};
class EnvenomAction : public CastMeleeSpellAction
{
public:
EnvenomAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "envenom") {}
};
class CastTricksOfTheTradeOnMainTankAction : public BuffOnMainTankAction
{
public:
CastTricksOfTheTradeOnMainTankAction(PlayerbotAI* ai) : BuffOnMainTankAction(ai, "tricks of the trade", true) {}
virtual bool isUseful() override;
};
class UseDeadlyPoisonAction : public UseItemAction
{
public:
UseDeadlyPoisonAction(PlayerbotAI* ai) : UseItemAction(ai, "Deadly Poison") {}
virtual bool Execute(Event event) override;
virtual bool isPossible() override;
};
class UseInstantPoisonAction : public UseItemAction
{
public:
UseInstantPoisonAction(PlayerbotAI* ai) : UseItemAction(ai, "Instant Poison") {}
virtual bool Execute(Event event) override;
virtual bool isPossible() override;
};
class UseInstantPoisonOffHandAction : public UseItemAction
{
public:
UseInstantPoisonOffHandAction(PlayerbotAI* ai) : UseItemAction(ai, "Instant Poison Off Hand") {}
virtual bool Execute(Event event) override;
virtual bool isPossible() override;
};
class FanOfKnivesAction : public CastMeleeSpellAction
{
public:
FanOfKnivesAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "fan of knives") {}
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
};
#endif

View File

@@ -0,0 +1,194 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueAiObjectContext.h"
#include "AssassinationRogueStrategy.h"
#include "DpsRogueStrategy.h"
#include "GenericRogueNonCombatStrategy.h"
#include "NamedObjectContext.h"
#include "Playerbots.h"
#include "PullStrategy.h"
#include "RogueActions.h"
#include "RogueComboActions.h"
#include "RogueFinishingActions.h"
#include "RogueOpeningActions.h"
#include "RogueTriggers.h"
class RogueStrategyFactoryInternal : public NamedObjectContext<Strategy>
{
public:
RogueStrategyFactoryInternal()
{
creators["nc"] = &RogueStrategyFactoryInternal::nc;
creators["pull"] = &RogueStrategyFactoryInternal::pull;
creators["aoe"] = &RogueStrategyFactoryInternal::aoe;
creators["boost"] = &RogueStrategyFactoryInternal::boost;
creators["stealthed"] = &RogueStrategyFactoryInternal::stealthed;
creators["stealth"] = &RogueStrategyFactoryInternal::stealth;
creators["cc"] = &RogueStrategyFactoryInternal::cc;
}
private:
static Strategy* boost(PlayerbotAI* botAI) { return new RogueBoostStrategy(botAI); }
static Strategy* aoe(PlayerbotAI* botAI) { return new RogueAoeStrategy(botAI); }
static Strategy* nc(PlayerbotAI* botAI) { return new GenericRogueNonCombatStrategy(botAI); }
static Strategy* pull(PlayerbotAI* botAI) { return new PullStrategy(botAI, "shoot"); }
static Strategy* stealthed(PlayerbotAI* botAI) { return new StealthedRogueStrategy(botAI); }
static Strategy* stealth(PlayerbotAI* botAI) { return new StealthStrategy(botAI); }
static Strategy* cc(PlayerbotAI* botAI) { return new RogueCcStrategy(botAI); }
};
class RogueCombatStrategyFactoryInternal : public NamedObjectContext<Strategy>
{
public:
RogueCombatStrategyFactoryInternal() : NamedObjectContext<Strategy>(false, true)
{
creators["dps"] = &RogueCombatStrategyFactoryInternal::dps;
creators["melee"] = &RogueCombatStrategyFactoryInternal::melee;
}
private:
static Strategy* dps(PlayerbotAI* botAI) { return new DpsRogueStrategy(botAI); }
static Strategy* melee(PlayerbotAI* botAI) { return new AssassinationRogueStrategy(botAI); }
};
class RogueTriggerFactoryInternal : public NamedObjectContext<Trigger>
{
public:
RogueTriggerFactoryInternal()
{
creators["kick"] = &RogueTriggerFactoryInternal::kick;
creators["rupture"] = &RogueTriggerFactoryInternal::rupture;
creators["slice and dice"] = &RogueTriggerFactoryInternal::slice_and_dice;
creators["hunger for blood"] = &RogueTriggerFactoryInternal::hunger_for_blood;
creators["expose armor"] = &RogueTriggerFactoryInternal::expose_armor;
creators["kick on enemy healer"] = &RogueTriggerFactoryInternal::kick_on_enemy_healer;
creators["unstealth"] = &RogueTriggerFactoryInternal::unstealth;
creators["sap"] = &RogueTriggerFactoryInternal::sap;
creators["in stealth"] = &RogueTriggerFactoryInternal::in_stealth;
creators["no stealth"] = &RogueTriggerFactoryInternal::no_stealth;
creators["stealth"] = &RogueTriggerFactoryInternal::stealth;
creators["sprint"] = &RogueTriggerFactoryInternal::sprint;
creators["main hand weapon no enchant"] = &RogueTriggerFactoryInternal::main_hand_weapon_no_enchant;
creators["off hand weapon no enchant"] = &RogueTriggerFactoryInternal::off_hand_weapon_no_enchant;
creators["tricks of the trade on main tank"] = &RogueTriggerFactoryInternal::tricks_of_the_trade_on_main_tank;
creators["adrenaline rush"] = &RogueTriggerFactoryInternal::adrenaline_rush;
creators["blade fury"] = &RogueTriggerFactoryInternal::blade_fury;
}
private:
static Trigger* adrenaline_rush(PlayerbotAI* botAI) { return new AdrenalineRushTrigger(botAI); }
static Trigger* blade_fury(PlayerbotAI* botAI) { return new BladeFuryTrigger(botAI); }
static Trigger* kick(PlayerbotAI* botAI) { return new KickInterruptSpellTrigger(botAI); }
static Trigger* rupture(PlayerbotAI* botAI) { return new RuptureTrigger(botAI); }
static Trigger* slice_and_dice(PlayerbotAI* botAI) { return new SliceAndDiceTrigger(botAI); }
static Trigger* hunger_for_blood(PlayerbotAI* botAI) { return new HungerForBloodTrigger(botAI); }
static Trigger* expose_armor(PlayerbotAI* botAI) { return new ExposeArmorTrigger(botAI); }
static Trigger* kick_on_enemy_healer(PlayerbotAI* botAI) { return new KickInterruptEnemyHealerSpellTrigger(botAI); }
static Trigger* unstealth(PlayerbotAI* botAI) { return new UnstealthTrigger(botAI); }
static Trigger* sap(PlayerbotAI* botAI) { return new SapTrigger(botAI); }
static Trigger* in_stealth(PlayerbotAI* botAI) { return new InStealthTrigger(botAI); }
static Trigger* no_stealth(PlayerbotAI* botAI) { return new NoStealthTrigger(botAI); }
static Trigger* stealth(PlayerbotAI* botAI) { return new StealthTrigger(botAI); }
static Trigger* sprint(PlayerbotAI* botAI) { return new SprintTrigger(botAI); }
static Trigger* main_hand_weapon_no_enchant(PlayerbotAI* ai) { return new MainHandWeaponNoEnchantTrigger(ai); }
static Trigger* off_hand_weapon_no_enchant(PlayerbotAI* ai) { return new OffHandWeaponNoEnchantTrigger(ai); }
static Trigger* tricks_of_the_trade_on_main_tank(PlayerbotAI* ai)
{
return new TricksOfTheTradeOnMainTankTrigger(ai);
}
};
class RogueAiObjectContextInternal : public NamedObjectContext<Action>
{
public:
RogueAiObjectContextInternal()
{
creators["riposte"] = &RogueAiObjectContextInternal::riposte;
creators["mutilate"] = &RogueAiObjectContextInternal::mutilate;
creators["sinister strike"] = &RogueAiObjectContextInternal::sinister_strike;
creators["gouge"] = &RogueAiObjectContextInternal::gouge;
creators["kidney shot"] = &RogueAiObjectContextInternal::kidney_shot;
creators["rupture"] = &RogueAiObjectContextInternal::rupture;
creators["slice and dice"] = &RogueAiObjectContextInternal::slice_and_dice;
creators["hunger for blood"] = &RogueAiObjectContextInternal::hunger_for_blood;
creators["eviscerate"] = &RogueAiObjectContextInternal::eviscerate;
creators["vanish"] = &RogueAiObjectContextInternal::vanish;
creators["evasion"] = &RogueAiObjectContextInternal::evasion;
creators["cloak of shadows"] = &RogueAiObjectContextInternal::cloak_of_shadows;
creators["kick"] = &RogueAiObjectContextInternal::kick;
creators["feint"] = &RogueAiObjectContextInternal::feint;
creators["backstab"] = &RogueAiObjectContextInternal::backstab;
creators["expose armor"] = &RogueAiObjectContextInternal::expose_armor;
creators["kick on enemy healer"] = &RogueAiObjectContextInternal::kick_on_enemy_healer;
creators["blade flurry"] = &RogueAiObjectContextInternal::blade_flurry;
creators["adrenaline rush"] = &RogueAiObjectContextInternal::adrenaline_rush;
creators["ambush"] = &RogueAiObjectContextInternal::ambush;
creators["stealth"] = &RogueAiObjectContextInternal::stealth;
creators["sprint"] = &RogueAiObjectContextInternal::sprint;
creators["garrote"] = &RogueAiObjectContextInternal::garrote;
creators["cheap shot"] = &RogueAiObjectContextInternal::cheap_shot;
creators["blind"] = &RogueAiObjectContextInternal::blind;
creators["unstealth"] = &RogueAiObjectContextInternal::unstealth;
creators["sap"] = &RogueAiObjectContextInternal::sap;
creators["check stealth"] = &RogueAiObjectContextInternal::check_stealth;
creators["envenom"] = &RogueAiObjectContextInternal::envenom;
creators["tricks of the trade on main tank"] = &RogueAiObjectContextInternal::tricks_of_the_trade_on_main_tank;
creators["use instant poison on main hand"] = &RogueAiObjectContextInternal::use_instant_poison;
creators["use deadly poison on off hand"] = &RogueAiObjectContextInternal::use_deadly_poison;
creators["use instant poison on off hand"] = &RogueAiObjectContextInternal::use_instant_poison_off_hand;
creators["fan of knives"] = &RogueAiObjectContextInternal::fan_of_knives;
creators["killing spree"] = &RogueAiObjectContextInternal::killing_spree;
}
private:
static Action* adrenaline_rush(PlayerbotAI* botAI) { return new CastAdrenalineRushAction(botAI); }
static Action* blade_flurry(PlayerbotAI* botAI) { return new CastBladeFlurryAction(botAI); }
static Action* riposte(PlayerbotAI* botAI) { return new CastRiposteAction(botAI); }
static Action* mutilate(PlayerbotAI* botAI) { return new CastMutilateAction(botAI); }
static Action* sinister_strike(PlayerbotAI* botAI) { return new CastSinisterStrikeAction(botAI); }
static Action* gouge(PlayerbotAI* botAI) { return new CastGougeAction(botAI); }
static Action* kidney_shot(PlayerbotAI* botAI) { return new CastKidneyShotAction(botAI); }
static Action* rupture(PlayerbotAI* botAI) { return new CastRuptureAction(botAI); }
static Action* slice_and_dice(PlayerbotAI* botAI) { return new CastSliceAndDiceAction(botAI); }
static Action* hunger_for_blood(PlayerbotAI* botAI) { return new CastHungerForBloodAction(botAI); }
static Action* eviscerate(PlayerbotAI* botAI) { return new CastEviscerateAction(botAI); }
static Action* vanish(PlayerbotAI* botAI) { return new CastVanishAction(botAI); }
static Action* evasion(PlayerbotAI* botAI) { return new CastEvasionAction(botAI); }
static Action* cloak_of_shadows(PlayerbotAI* botAI) { return new CastCloakOfShadowsAction(botAI); }
static Action* kick(PlayerbotAI* botAI) { return new CastKickAction(botAI); }
static Action* feint(PlayerbotAI* botAI) { return new CastFeintAction(botAI); }
static Action* backstab(PlayerbotAI* botAI) { return new CastBackstabAction(botAI); }
static Action* expose_armor(PlayerbotAI* botAI) { return new CastExposeArmorAction(botAI); }
static Action* kick_on_enemy_healer(PlayerbotAI* botAI) { return new CastKickOnEnemyHealerAction(botAI); }
static Action* ambush(PlayerbotAI* botAI) { return new CastAmbushAction(botAI); }
static Action* stealth(PlayerbotAI* botAI) { return new CastStealthAction(botAI); }
static Action* sprint(PlayerbotAI* botAI) { return new CastSprintAction(botAI); }
static Action* garrote(PlayerbotAI* botAI) { return new CastGarroteAction(botAI); }
static Action* cheap_shot(PlayerbotAI* botAI) { return new CastCheapShotAction(botAI); }
static Action* blind(PlayerbotAI* botAI) { return new CastBlindAction(botAI); }
static Action* check_stealth(PlayerbotAI* botAI) { return new CheckStealthAction(botAI); }
static Action* sap(PlayerbotAI* botAI) { return new CastSapAction(botAI); }
static Action* unstealth(PlayerbotAI* botAI) { return new UnstealthAction(botAI); }
static Action* envenom(PlayerbotAI* ai) { return new EnvenomAction(ai); }
static Action* tricks_of_the_trade_on_main_tank(PlayerbotAI* ai)
{
return new CastTricksOfTheTradeOnMainTankAction(ai);
}
static Action* use_instant_poison(PlayerbotAI* ai) { return new UseInstantPoisonAction(ai); }
static Action* use_deadly_poison(PlayerbotAI* ai) { return new UseDeadlyPoisonAction(ai); }
static Action* use_instant_poison_off_hand(PlayerbotAI* ai) { return new UseInstantPoisonOffHandAction(ai); }
static Action* fan_of_knives(PlayerbotAI* ai) { return new FanOfKnivesAction(ai); }
static Action* killing_spree(PlayerbotAI* ai) { return new CastKillingSpreeAction(ai); }
};
RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)
{
strategyContexts.Add(new RogueStrategyFactoryInternal());
strategyContexts.Add(new RogueCombatStrategyFactoryInternal());
actionContexts.Add(new RogueAiObjectContextInternal());
triggerContexts.Add(new RogueTriggerFactoryInternal());
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUEAIOBJECTCONTEXT_H
#define _PLAYERBOT_ROGUEAIOBJECTCONTEXT_H
#include "AiObjectContext.h"
class PlayerbotAI;
class RogueAiObjectContext : public AiObjectContext
{
public:
RogueAiObjectContext(PlayerbotAI* botAI);
};
#endif

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueComboActions.h"
#include "Playerbots.h"
bool CastComboAction::isUseful()
{
return CastMeleeSpellAction::isUseful() && AI_VALUE2(uint8, "combo", "current target") < 5;
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUECOMBOACTIONS_H
#define _PLAYERBOT_ROGUECOMBOACTIONS_H
#include "GenericSpellActions.h"
class PlayerbotAI;
class CastComboAction : public CastMeleeSpellAction
{
public:
CastComboAction(PlayerbotAI* botAI, std::string const name) : CastMeleeSpellAction(botAI, name) {}
bool isUseful() override;
};
class CastSinisterStrikeAction : public CastSpellAction
{
public:
CastSinisterStrikeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "sinister strike") {}
};
class CastMutilateAction : public CastSpellAction
{
public:
CastMutilateAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "mutilate") {}
};
class CastRiposteAction : public CastSpellAction
{
public:
CastRiposteAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "riposte") {}
};
class CastGougeAction : public CastSpellAction
{
public:
CastGougeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "gouge") {}
};
class CastBackstabAction : public CastSpellAction
{
public:
CastBackstabAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "backstab") {}
};
#endif

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUEFINISHINGACTIONS_H
#define _PLAYERBOT_ROGUEFINISHINGACTIONS_H
#include "GenericSpellActions.h"
class PlayerbotAI;
class CastEviscerateAction : public CastMeleeSpellAction
{
public:
CastEviscerateAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "eviscerate") {}
};
class CastSliceAndDiceAction : public CastMeleeSpellAction
{
public:
CastSliceAndDiceAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "slice and dice") {}
};
class CastExposeArmorAction : public CastDebuffSpellAction
{
public:
CastExposeArmorAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "expose armor", false, 25.0f) {}
};
class CastRuptureAction : public CastDebuffSpellAction
{
public:
CastRuptureAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "rupture", true, 6.0f) {}
};
class CastKidneyShotAction : public CastMeleeSpellAction
{
public:
CastKidneyShotAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "kidney shot") {}
};
#endif

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueOpeningActions.h"
#include "Playerbots.h"
Value<Unit*>* CastSapAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUEOPENINGACTIONS_H
#define _PLAYERBOT_ROGUEOPENINGACTIONS_H
#include "GenericSpellActions.h"
class PlayerbotAI;
class Unit;
class CastSapAction : public CastMeleeSpellAction
{
public:
CastSapAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "sap") {}
Value<Unit*>* GetTargetValue() override;
bool isUseful() override { return true; }
};
class CastGarroteAction : public CastDebuffSpellAction
{
public:
CastGarroteAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "garrote", true, 8.0f) {}
};
class CastCheapShotAction : public CastMeleeSpellAction
{
public:
CastCheapShotAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "cheap shot") {}
};
class CastAmbushAction : public CastMeleeSpellAction
{
public:
CastAmbushAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "ambush") {}
};
#endif

View File

@@ -0,0 +1,126 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "RogueTriggers.h"
#include "GenericTriggers.h"
#include "Playerbots.h"
#include "ServerFacade.h"
// bool AdrenalineRushTrigger::isPossible()
// {
// return !botAI->HasAura("stealth", bot);
// }
bool UnstealthTrigger::IsActive()
{
if (!botAI->HasAura("stealth", bot))
return false;
return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") &&
(AI_VALUE2(bool, "moving", "self target") &&
((botAI->GetMaster() &&
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "master target"), 10.0f) &&
AI_VALUE2(bool, "moving", "master target")) ||
!AI_VALUE(uint8, "attacker count")));
}
bool StealthTrigger::IsActive()
{
if (botAI->HasAura("stealth", bot) || bot->IsInCombat() || bot->HasSpellCooldown(1784))
return false;
float distance = 30.f;
Unit* target = AI_VALUE(Unit*, "enemy player target");
if (target && !target->IsInWorld())
{
return false;
}
if (!target)
target = AI_VALUE(Unit*, "grind target");
if (!target)
target = AI_VALUE(Unit*, "dps target");
if (!target)
return false;
if (target && target->GetVictim())
distance -= 10;
if (target->isMoving() && target->GetVictim())
distance -= 10;
if (bot->InBattleground())
distance += 15;
if (bot->InArena())
distance += 15;
return target && sServerFacade->GetDistance2d(bot, target) < distance;
}
bool SapTrigger::IsPossible() { return bot->GetLevel() > 10 && bot->HasSpell(6770) && !bot->IsInCombat(); }
bool SprintTrigger::IsPossible() { return bot->HasSpell(2983); }
bool SprintTrigger::IsActive()
{
if (bot->HasSpellCooldown(2983))
return false;
float distance = botAI->GetMaster() ? 45.0f : 35.0f;
if (botAI->HasAura("stealth", bot))
distance -= 10;
bool targeted = false;
Unit* dps = AI_VALUE(Unit*, "dps target");
Unit* enemyPlayer = AI_VALUE(Unit*, "enemy player target");
if (enemyPlayer && !enemyPlayer->IsInWorld())
{
return false;
}
if (dps)
targeted = (dps == AI_VALUE(Unit*, "current target"));
if (enemyPlayer && !targeted)
targeted = (enemyPlayer == AI_VALUE(Unit*, "current target"));
if (!targeted)
return false;
if ((dps && dps->IsInCombat()) || enemyPlayer)
distance -= 10;
return AI_VALUE2(bool, "moving", "self target") &&
(AI_VALUE2(bool, "moving", "dps target") || AI_VALUE2(bool, "moving", "enemy player target")) && targeted &&
(sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), distance) ||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), distance));
}
bool ExposeArmorTrigger::IsActive()
{
return DebuffTrigger::IsActive() && !botAI->HasAura("sunder armor", bot, false, false, -1, true) &&
AI_VALUE2(uint8, "combo", "current target") <= 3;
}
bool MainHandWeaponNoEnchantTrigger::IsActive()
{
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}
bool OffHandWeaponNoEnchantTrigger::IsActive()
{
Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}

View File

@@ -0,0 +1,132 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_ROGUETRIGGERS_H
#define _PLAYERBOT_ROGUETRIGGERS_H
#include "GenericTriggers.h"
class PlayerbotAI;
class KickInterruptSpellTrigger : public InterruptSpellTrigger
{
public:
KickInterruptSpellTrigger(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, "kick") {}
};
class SliceAndDiceTrigger : public BuffTrigger
{
public:
SliceAndDiceTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "slice and dice") {}
};
class HungerForBloodTrigger : public BuffTrigger
{
public:
HungerForBloodTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "hunger for blood") {}
};
class AdrenalineRushTrigger : public BoostTrigger
{
public:
AdrenalineRushTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "adrenaline rush") {}
// bool isPossible();
};
class BladeFuryTrigger : public BoostTrigger
{
public:
BladeFuryTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "blade fury") {}
};
class RuptureTrigger : public DebuffTrigger
{
public:
RuptureTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "rupture", 1, true) {}
};
class ExposeArmorTrigger : public DebuffTrigger
{
public:
ExposeArmorTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "expose armor") {}
virtual bool IsActive() override;
};
class KickInterruptEnemyHealerSpellTrigger : public InterruptEnemyHealerTrigger
{
public:
KickInterruptEnemyHealerSpellTrigger(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, "kick") {}
};
class InStealthTrigger : public HasAuraTrigger
{
public:
InStealthTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "stealth") {}
};
class NoStealthTrigger : public HasNoAuraTrigger
{
public:
NoStealthTrigger(PlayerbotAI* botAI) : HasNoAuraTrigger(botAI, "stealth") {}
};
class UnstealthTrigger : public BuffTrigger
{
public:
UnstealthTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "stealth", 3) {}
bool IsActive() override;
};
class StealthTrigger : public Trigger
{
public:
StealthTrigger(PlayerbotAI* botAI) : Trigger(botAI, "stealth") {}
bool IsActive() override;
};
class SapTrigger : public HasCcTargetTrigger
{
public:
SapTrigger(PlayerbotAI* botAI) : HasCcTargetTrigger(botAI, "sap") {}
bool IsPossible();
};
class SprintTrigger : public BuffTrigger
{
public:
SprintTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "sprint", 3) {}
bool IsPossible();
bool IsActive() override;
};
class MainHandWeaponNoEnchantTrigger : public BuffTrigger
{
public:
MainHandWeaponNoEnchantTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "main hand", 1) {}
virtual bool IsActive();
};
class OffHandWeaponNoEnchantTrigger : public BuffTrigger
{
public:
OffHandWeaponNoEnchantTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "off hand", 1) {}
virtual bool IsActive();
};
class TricksOfTheTradeOnMainTankTrigger : public BuffOnMainTankTrigger
{
public:
TricksOfTheTradeOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "tricks of the trade", true) {}
};
#endif