mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
added mc/moltencore strat (just for baron geddon's inferno and living-bomb)
This commit is contained in:
@@ -1504,6 +1504,9 @@ void PlayerbotAI::ApplyInstanceStrategies(uint32 mapId, bool tellMaster)
|
|||||||
case 469:
|
case 469:
|
||||||
strategyName = "bwl";
|
strategyName = "bwl";
|
||||||
break;
|
break;
|
||||||
|
case 409:
|
||||||
|
strategyName = "mc";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include "raids/RaidTriggerContext.h"
|
#include "raids/RaidTriggerContext.h"
|
||||||
#include "raids/naxxramas/RaidNaxxActionContext.h"
|
#include "raids/naxxramas/RaidNaxxActionContext.h"
|
||||||
#include "raids/naxxramas/RaidNaxxTriggerContext.h"
|
#include "raids/naxxramas/RaidNaxxTriggerContext.h"
|
||||||
|
#include "raids/moltencore/RaidMcActionContext.h"
|
||||||
|
#include "raids/moltencore/RaidMcTriggerContext.h"
|
||||||
|
|
||||||
AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
||||||
{
|
{
|
||||||
@@ -37,6 +39,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
|||||||
actionContexts.Add(new RaidActionContext());
|
actionContexts.Add(new RaidActionContext());
|
||||||
actionContexts.Add(new RaidNaxxActionContext());
|
actionContexts.Add(new RaidNaxxActionContext());
|
||||||
actionContexts.Add(new RaidUlduarActionContext());
|
actionContexts.Add(new RaidUlduarActionContext());
|
||||||
|
actionContexts.Add(new RaidMcActionContext());
|
||||||
|
|
||||||
triggerContexts.Add(new TriggerContext());
|
triggerContexts.Add(new TriggerContext());
|
||||||
triggerContexts.Add(new ChatTriggerContext());
|
triggerContexts.Add(new ChatTriggerContext());
|
||||||
@@ -44,6 +47,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
|||||||
triggerContexts.Add(new RaidTriggerContext());
|
triggerContexts.Add(new RaidTriggerContext());
|
||||||
triggerContexts.Add(new RaidNaxxTriggerContext());
|
triggerContexts.Add(new RaidNaxxTriggerContext());
|
||||||
triggerContexts.Add(new RaidUlduarTriggerContext());
|
triggerContexts.Add(new RaidUlduarTriggerContext());
|
||||||
|
triggerContexts.Add(new RaidMcTriggerContext());
|
||||||
|
|
||||||
valueContexts.Add(new ValueContext());
|
valueContexts.Add(new ValueContext());
|
||||||
|
|
||||||
|
|||||||
@@ -5,21 +5,27 @@
|
|||||||
#include "Strategy.h"
|
#include "Strategy.h"
|
||||||
#include "RaidBwlStrategy.h"
|
#include "RaidBwlStrategy.h"
|
||||||
#include "RaidNaxxStrategy.h"
|
#include "RaidNaxxStrategy.h"
|
||||||
|
#include "RaidMcStrategy.h"
|
||||||
|
|
||||||
class RaidStrategyContext : public NamedObjectContext<Strategy>
|
class RaidStrategyContext : public NamedObjectContext<Strategy>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RaidStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
RaidStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||||
{
|
{
|
||||||
|
// TODO should we give these prefixes (eg: "naxx" -> "raid naxx")? because if we don't it's going to end up
|
||||||
|
// very crowded (with possible conflicts) once we have strats for all raids and some dungeons
|
||||||
|
// (mc already very similiar to nc)
|
||||||
creators["naxx"] = &RaidStrategyContext::naxx;
|
creators["naxx"] = &RaidStrategyContext::naxx;
|
||||||
creators["bwl"] = &RaidStrategyContext::bwl;
|
creators["bwl"] = &RaidStrategyContext::bwl;
|
||||||
creators["uld"] = &RaidStrategyContext::uld;
|
creators["uld"] = &RaidStrategyContext::uld;
|
||||||
|
creators["mc"] = &RaidStrategyContext::mc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Strategy* naxx(PlayerbotAI* botAI) { return new RaidNaxxStrategy(botAI); }
|
static Strategy* naxx(PlayerbotAI* botAI) { return new RaidNaxxStrategy(botAI); }
|
||||||
static Strategy* bwl(PlayerbotAI* botAI) { return new RaidBwlStrategy(botAI); }
|
static Strategy* bwl(PlayerbotAI* botAI) { return new RaidBwlStrategy(botAI); }
|
||||||
static Strategy* uld(PlayerbotAI* botAI) { return new RaidUlduarStrategy(botAI); }
|
static Strategy* uld(PlayerbotAI* botAI) { return new RaidUlduarStrategy(botAI); }
|
||||||
|
static Strategy* mc(PlayerbotAI* botAI) { return new RaidMcStrategy(botAI); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
22
src/strategy/raids/moltencore/RaidMcActionContext.h
Normal file
22
src/strategy/raids/moltencore/RaidMcActionContext.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef _PLAYERBOT_RAIDMCACTIONCONTEXT_H
|
||||||
|
#define _PLAYERBOT_RAIDMCACTIONCONTEXT_H
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "NamedObjectContext.h"
|
||||||
|
#include "RaidMcActions.h"
|
||||||
|
|
||||||
|
class RaidMcActionContext : public NamedObjectContext<Action>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RaidMcActionContext()
|
||||||
|
{
|
||||||
|
creators["mc check should move from group"] = &RaidMcActionContext::check_should_move_from_group;
|
||||||
|
creators["mc move from baron geddon"] = &RaidMcActionContext::move_from_baron_geddon;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static Action* check_should_move_from_group(PlayerbotAI* ai) { return new McCheckShouldMoveFromGroupAction(ai); }
|
||||||
|
static Action* move_from_baron_geddon(PlayerbotAI* ai) { return new McMoveFromBaronGeddonAction(ai); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
43
src/strategy/raids/moltencore/RaidMcActions.cpp
Normal file
43
src/strategy/raids/moltencore/RaidMcActions.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "RaidMcActions.h"
|
||||||
|
|
||||||
|
#include "Playerbots.h"
|
||||||
|
|
||||||
|
bool McCheckShouldMoveFromGroupAction::Execute(Event event)
|
||||||
|
{
|
||||||
|
if (bot->HasAura(20475)) // barron geddon's living bomb
|
||||||
|
{
|
||||||
|
if (!botAI->HasStrategy("move from group", BotState::BOT_STATE_COMBAT))
|
||||||
|
{
|
||||||
|
// add/remove from both for now as it will make it more obvious to
|
||||||
|
// player if this strat remains on after fight somehow
|
||||||
|
botAI->ChangeStrategy("+move from group", BOT_STATE_NON_COMBAT);
|
||||||
|
botAI->ChangeStrategy("+move from group", BOT_STATE_COMBAT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (botAI->HasStrategy("move from group", BotState::BOT_STATE_COMBAT))
|
||||||
|
{
|
||||||
|
// add/remove from both for now as it will make it more obvious to
|
||||||
|
// player if this strat remains on after fight somehow
|
||||||
|
botAI->ChangeStrategy("-move from group", BOT_STATE_NON_COMBAT);
|
||||||
|
botAI->ChangeStrategy("-move from group", BOT_STATE_COMBAT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool McMoveFromBaronGeddonAction::Execute(Event event)
|
||||||
|
{
|
||||||
|
const float radius = 25.0f; // more than should be needed but bots keep trying to run back in
|
||||||
|
if (Unit* boss = AI_VALUE2(Unit*, "find target", "baron geddon"))
|
||||||
|
{
|
||||||
|
long distToTravel = radius - bot->GetDistance(boss);
|
||||||
|
if (distToTravel > 0)
|
||||||
|
{
|
||||||
|
// float angle = bot->GetAngle(boss) + M_PI;
|
||||||
|
// return Move(angle, distToTravel);
|
||||||
|
return MoveAway(boss, distToTravel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
24
src/strategy/raids/moltencore/RaidMcActions.h
Normal file
24
src/strategy/raids/moltencore/RaidMcActions.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef _PLAYERBOT_RAIDMCACTIONS_H
|
||||||
|
#define _PLAYERBOT_RAIDMCACTIONS_H
|
||||||
|
|
||||||
|
#include "MovementActions.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "Playerbots.h"
|
||||||
|
|
||||||
|
class McCheckShouldMoveFromGroupAction : public Action
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McCheckShouldMoveFromGroupAction(PlayerbotAI* botAI, std::string const name = "mc check should move from group")
|
||||||
|
: Action(botAI, name) {}
|
||||||
|
bool Execute(Event event) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class McMoveFromBaronGeddonAction : public MovementAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McMoveFromBaronGeddonAction(PlayerbotAI* botAI, std::string const name = "mc move from baron geddon")
|
||||||
|
: MovementAction(botAI, name) {}
|
||||||
|
bool Execute(Event event) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
13
src/strategy/raids/moltencore/RaidMcStrategy.cpp
Normal file
13
src/strategy/raids/moltencore/RaidMcStrategy.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "RaidMcStrategy.h"
|
||||||
|
|
||||||
|
#include "Strategy.h"
|
||||||
|
|
||||||
|
void RaidMcStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
|
{
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("mc living bomb debuff",
|
||||||
|
NextAction::array(0, new NextAction("mc check should move from group", ACTION_RAID), nullptr)));
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("mc baron geddon inferno",
|
||||||
|
NextAction::array(0, new NextAction("mc move from baron geddon", ACTION_RAID), nullptr)));
|
||||||
|
}
|
||||||
17
src/strategy/raids/moltencore/RaidMcStrategy.h
Normal file
17
src/strategy/raids/moltencore/RaidMcStrategy.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef _PLAYERBOT_RAIDMCSTRATEGY_H
|
||||||
|
#define _PLAYERBOT_RAIDMCSTRATEGY_H
|
||||||
|
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
#include "Multiplier.h"
|
||||||
|
#include "Strategy.h"
|
||||||
|
|
||||||
|
class RaidMcStrategy : public Strategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RaidMcStrategy(PlayerbotAI* ai) : Strategy(ai) {}
|
||||||
|
virtual std::string const getName() override { return "mc"; }
|
||||||
|
virtual void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||||
|
// virtual void InitMultipliers(std::vector<Multiplier*> &multipliers) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
22
src/strategy/raids/moltencore/RaidMcTriggerContext.h
Normal file
22
src/strategy/raids/moltencore/RaidMcTriggerContext.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef _PLAYERBOT_RAIDMCTRIGGERCONTEXT_H
|
||||||
|
#define _PLAYERBOT_RAIDMCTRIGGERCONTEXT_H
|
||||||
|
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
#include "NamedObjectContext.h"
|
||||||
|
#include "RaidMcTriggers.h"
|
||||||
|
|
||||||
|
class RaidMcTriggerContext : public NamedObjectContext<Trigger>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RaidMcTriggerContext()
|
||||||
|
{
|
||||||
|
creators["mc living bomb debuff"] = &RaidMcTriggerContext::living_bomb_debuff;
|
||||||
|
creators["mc baron geddon inferno"] = &RaidMcTriggerContext::baron_geddon_inferno;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static Trigger* living_bomb_debuff(PlayerbotAI* ai) { return new McLivingBombDebuffTrigger(ai); }
|
||||||
|
static Trigger* baron_geddon_inferno(PlayerbotAI* ai) { return new McBaronGeddonInfernoTrigger(ai); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
22
src/strategy/raids/moltencore/RaidMcTriggers.cpp
Normal file
22
src/strategy/raids/moltencore/RaidMcTriggers.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "RaidMcTriggers.h"
|
||||||
|
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
|
bool McLivingBombDebuffTrigger::IsActive()
|
||||||
|
{
|
||||||
|
// if bot has barron geddon's living bomb, we need to add strat, otherwise we need to remove
|
||||||
|
// only do when fighting baron geddon (to avoid modifying strat set by player outside this fight)
|
||||||
|
if (Unit* boss = AI_VALUE2(Unit*, "find target", "baron geddon"))
|
||||||
|
{
|
||||||
|
if (boss->IsInCombat())
|
||||||
|
return bot->HasAura(20475) != botAI->HasStrategy("move from group", BotState::BOT_STATE_COMBAT);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool McBaronGeddonInfernoTrigger::IsActive()
|
||||||
|
{
|
||||||
|
if (Unit* boss = AI_VALUE2(Unit*, "find target", "baron geddon"))
|
||||||
|
return boss->HasAura(19695);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
22
src/strategy/raids/moltencore/RaidMcTriggers.h
Normal file
22
src/strategy/raids/moltencore/RaidMcTriggers.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef _PLAYERBOT_RAIDMCTRIGGERS_H
|
||||||
|
#define _PLAYERBOT_RAIDMCTRIGGERS_H
|
||||||
|
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "Playerbots.h"
|
||||||
|
#include "Trigger.h"
|
||||||
|
|
||||||
|
class McLivingBombDebuffTrigger : public Trigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McLivingBombDebuffTrigger(PlayerbotAI* botAI) : Trigger(botAI, "mc living bomb debuff") {}
|
||||||
|
bool IsActive() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class McBaronGeddonInfernoTrigger : public Trigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McBaronGeddonInfernoTrigger(PlayerbotAI* botAI) : Trigger(botAI, "mc baron geddon inferno") {}
|
||||||
|
bool IsActive() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user