date: 2024-11-06

This commit is contained in:
chris
2024-11-06 17:29:59 +08:00
parent f6cf3e728f
commit 2b358bc7b7
16 changed files with 83 additions and 89 deletions

View File

@@ -62,7 +62,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
actionContexts.Add(new WotlkDungeonOccActionContext()); actionContexts.Add(new WotlkDungeonOccActionContext());
actionContexts.Add(new WotlkDungeonUPActionContext()); actionContexts.Add(new WotlkDungeonUPActionContext());
actionContexts.Add(new WotlkDungeonCoSActionContext()); actionContexts.Add(new WotlkDungeonCoSActionContext());
actionContexts.Add(new WotlkDungeonFosActionContext()); actionContexts.Add(new WotlkDungeonFoSActionContext());
triggerContexts.Add(new TriggerContext()); triggerContexts.Add(new TriggerContext());
triggerContexts.Add(new ChatTriggerContext()); triggerContexts.Add(new ChatTriggerContext());

View File

@@ -14,7 +14,7 @@
#include "wotlk/oculus/OculusStrategy.h" #include "wotlk/oculus/OculusStrategy.h"
#include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h" #include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h"
#include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h" #include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h"
#include "wotlk/forgeofsouls/FosStrategy.h" #include "wotlk/forgeofsouls/ForgeOfSoulsStrategy.h"
/* /*
Full list/TODO: Full list/TODO:
@@ -77,7 +77,7 @@ class DungeonStrategyContext : public NamedObjectContext<Strategy>
static Strategy* wotlk_occ(PlayerbotAI* botAI) { return new WotlkDungeonOccStrategy(botAI); } static Strategy* wotlk_occ(PlayerbotAI* botAI) { return new WotlkDungeonOccStrategy(botAI); }
static Strategy* wotlk_up(PlayerbotAI* botAI) { return new WotlkDungeonUPStrategy(botAI); } static Strategy* wotlk_up(PlayerbotAI* botAI) { return new WotlkDungeonUPStrategy(botAI); }
static Strategy* wotlk_cos(PlayerbotAI* botAI) { return new WotlkDungeonCoSStrategy(botAI); } static Strategy* wotlk_cos(PlayerbotAI* botAI) { return new WotlkDungeonCoSStrategy(botAI); }
static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonFosStrategy(botAI); } static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonFoSStrategy(botAI); }
// NYI from here down // NYI from here down
static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }

View File

@@ -1,6 +1,5 @@
#ifndef _PLAYERBOT_DUNGEONUTILS_H #ifndef _PLAYERBOT_DUNGEONUTILS_H
#define _PLAYERBOT_DUNGEONUTILS_H #define _PLAYERBOT_DUNGEONUTILS_H
#include "Player.h"
template<class T> inline template<class T> inline
const T& DUNGEON_MODE(Player* bot, const T& normal5, const T& heroic10) const T& DUNGEON_MODE(Player* bot, const T& normal5, const T& heroic10)

View File

@@ -13,7 +13,7 @@
#include "oculus/OculusActionContext.h" #include "oculus/OculusActionContext.h"
#include "utgardepinnacle/UtgardePinnacleActionContext.h" #include "utgardepinnacle/UtgardePinnacleActionContext.h"
#include "cullingofstratholme/CullingOfStratholmeActionContext.h" #include "cullingofstratholme/CullingOfStratholmeActionContext.h"
#include "forgeofsouls/FosActionContext.h" #include "forgeofsouls/ForgeOfSoulsActionContext.h"
// #include "trialofthechampion/TrialOfTheChampionActionContext.h" // #include "trialofthechampion/TrialOfTheChampionActionContext.h"
// #include "hallsofreflection/HallsOfReflectionActionContext.h" // #include "hallsofreflection/HallsOfReflectionActionContext.h"
// #include "pitofsaron/PitOfSaronActionContext.h" // #include "pitofsaron/PitOfSaronActionContext.h"

View File

@@ -13,7 +13,7 @@
#include "oculus/OculusTriggerContext.h" #include "oculus/OculusTriggerContext.h"
#include "utgardepinnacle/UtgardePinnacleTriggerContext.h" #include "utgardepinnacle/UtgardePinnacleTriggerContext.h"
#include "cullingofstratholme/CullingOfStratholmeTriggerContext.h" #include "cullingofstratholme/CullingOfStratholmeTriggerContext.h"
#include "forgeofsouls/FosTriggerContext.h" #include "forgeofsouls/ForgeOfSoulsTriggerContext.h"
// #include "trialofthechampion/TrialOfTheChampionTriggerContext.h" // #include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
// #include "hallsofreflection/HallsOfReflectionTriggerContext.h" // #include "hallsofreflection/HallsOfReflectionTriggerContext.h"
// #include "pitofsaron/PitOfSaronTriggerContext.h" // #include "pitofsaron/PitOfSaronTriggerContext.h"

View File

@@ -0,0 +1,23 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#include "Action.h"
#include "NamedObjectContext.h"
#include "ForgeOfSoulsActions.h"
class WotlkDungeonFoSActionContext : public NamedObjectContext<Action>
{
public:
WotlkDungeonFoSActionContext()
{
creators["move from bronjahm"] = &WotlkDungeonFoSActionContext::move_from_bronjahm;
creators["attack corrupted soul fragment"] = &WotlkDungeonFoSActionContext::attack_corrupted_soul_fragment;
creators["bronjahm group position"] = &WotlkDungeonFoSActionContext::bronjahm_group_position;
}
private:
static Action* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmAction(ai); }
static Action* attack_corrupted_soul_fragment(PlayerbotAI* ai) { return new AttackCorruptedSoulFragmentAction(ai); }
static Action* bronjahm_group_position(PlayerbotAI* ai) { return new BronjahmGroupPositionAction(ai); }
};
#endif

View File

@@ -1,11 +1,10 @@
#include "Playerbots.h" #include "Playerbots.h"
#include "FosActions.h" #include "ForgeOfSoulsActions.h"
#include "FosStrategy.h" #include "ForgeOfSoulsStrategy.h"
bool MoveFromBronjahmAction::Execute(Event event) bool MoveFromBronjahmAction::Execute(Event event)
{ {
Unit* boss = nullptr; Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (!boss) if (!boss)
return false; return false;
@@ -17,7 +16,6 @@ bool MoveFromBronjahmAction::Execute(Event event)
return MoveAway(boss, targetDis - distance); return MoveAway(boss, targetDis - distance);
} }
bool MoveFromBronjahmAction::isUseful() { return bot->HasAura(SPELL_CORRUPT_SOUL); }
bool AttackCorruptedSoulFragmentAction::Execute(Event event) bool AttackCorruptedSoulFragmentAction::Execute(Event event)
{ {
@@ -25,9 +23,9 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event)
GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); GuidVector targets = AI_VALUE(GuidVector, "possible targets no los");
for (auto i = targets.begin(); i != targets.end(); ++i) for (auto &target : targets)
{ {
Unit* unit = botAI->GetUnit(*i); Unit* unit = botAI->GetUnit(target);
if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
{ {
fragment = unit; fragment = unit;
@@ -35,40 +33,45 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event)
} }
} }
if (!fragment) if (fragment && AI_VALUE(Unit*, "current target") != fragment)
return false;
if (botAI->IsDps(bot))
{
if (AI_VALUE(Unit*, "current target") == fragment)
return false;
return Attack(fragment); return Attack(fragment);
}
else return false;
return false;
} }
bool AttackCorruptedSoulFragmentAction::isUseful() { return botAI->IsDps(bot); }
bool BronjahmTankPositionAction::Execute(Event event) bool BronjahmGroupPositionAction::Execute(Event event)
{ {
return MoveTo(bot->GetMapId(), BRONJAHM_TANK_POSITION.GetPositionX(), BRONJAHM_TANK_POSITION.GetPositionY(), if (botAI->IsTank(bot))
BRONJAHM_TANK_POSITION.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_COMBAT); if (bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f)
return MoveTo(bot->GetMapId(), BRONJAHM_TANK_POSITION.GetPositionX(), BRONJAHM_TANK_POSITION.GetPositionY(),
BRONJAHM_TANK_POSITION.GetPositionZ(), false, false, false, true,
MovementPriority::MOVEMENT_COMBAT);
else
return false;
else
{
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (boss)
{
}
}
} }
bool BronjahmTankPositionAction::isUseful() { return bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f; } bool BronjahmGroupPositionAction::isUseful() { return bot->GetExactDist2d(BRONJAHM_TANK_POSITION) > 5.0f; }
bool BronjahmTankTargetAction::Execute(Event event) bool BronjahmTankTargetAction::Execute(Event event)
{ {
if (botAI->IsTank(bot)) if (botAI->IsTank(bot))
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (AI_VALUE(Unit*, "current target") == boss) if (boss && AI_VALUE(Unit*, "current target") != boss)
return Attack(boss);
else
return false; return false;
return Attack(boss);
} }
else else
return false; return false;

View File

@@ -5,7 +5,7 @@
#include "AttackAction.h" #include "AttackAction.h"
#include "PlayerbotAI.h" #include "PlayerbotAI.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "FosTriggers.h" #include "ForgeOfSoulsTriggers.h"
const Position BRONJAHM_TANK_POSITION = Position(5297.9204f, 2506.698f, 686.06793f); const Position BRONJAHM_TANK_POSITION = Position(5297.9204f, 2506.698f, 686.06793f);
@@ -14,7 +14,6 @@ class MoveFromBronjahmAction : public MovementAction
public: public:
MoveFromBronjahmAction(PlayerbotAI* ai) : MovementAction(ai, "move from bronjahm") {} MoveFromBronjahmAction(PlayerbotAI* ai) : MovementAction(ai, "move from bronjahm") {}
bool Execute(Event event) override; bool Execute(Event event) override;
bool isUseful() override;
}; };
class AttackCorruptedSoulFragmentAction : public AttackAction class AttackCorruptedSoulFragmentAction : public AttackAction
@@ -22,13 +21,12 @@ class AttackCorruptedSoulFragmentAction : public AttackAction
public: public:
AttackCorruptedSoulFragmentAction(PlayerbotAI* ai) : AttackAction(ai, "attack corrupted soul fragment") {} AttackCorruptedSoulFragmentAction(PlayerbotAI* ai) : AttackAction(ai, "attack corrupted soul fragment") {}
bool Execute(Event event) override; bool Execute(Event event) override;
bool isUseful() override;
}; };
class BronjahmTankPositionAction : public MovementAction class BronjahmGroupPositionAction : public MovementAction
{ {
public: public:
BronjahmTankPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm tank position") {} BronjahmGroupPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm group position") {}
bool Execute(Event event) override; bool Execute(Event event) override;

View File

@@ -1,10 +1,10 @@
#include "FosMultipliers.h" #include "ForgeOfSoulsMultipliers.h"
#include "FosActions.h" #include "ForgeOfSoulsActions.h"
#include "GenericSpellActions.h" #include "GenericSpellActions.h"
#include "ChooseTargetActions.h" #include "ChooseTargetActions.h"
#include "MovementActions.h" #include "MovementActions.h"
#include "FosTriggers.h" #include "ForgeOfSoulsTriggers.h"
#include "FosActions.h" #include "ForgeOfSoulsActions.h"
float BronjahmMultiplier::GetValue(Action* action) { float BronjahmMultiplier::GetValue(Action* action) {
@@ -35,9 +35,9 @@ float AttackFragmentMultiplier::GetValue(Action* action)
GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); GuidVector targets = AI_VALUE(GuidVector, "possible targets no los");
for (auto i = targets.begin(); i != targets.end(); ++i) for (auto& target : targets)
{ {
Unit* unit = botAI->GetUnit(*i); Unit* unit = botAI->GetUnit(target);
if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
{ {
fragment = unit; fragment = unit;

View File

@@ -1,20 +1,17 @@
#include "FosStrategy.h" #include "ForgeOfSoulsStrategy.h"
#include "FosMultipliers.h" #include "ForgeOfSoulsMultipliers.h"
void WotlkDungeonFosStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) { void WotlkDungeonFoSStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) {
triggers.push_back( triggers.push_back(
new TriggerNode("move from bronjahm", new TriggerNode("move from bronjahm",
NextAction::array(0, new NextAction("move from bronjahm", ACTION_MOVE + 5), nullptr))); NextAction::array(0, new NextAction("move from bronjahm", ACTION_MOVE + 5), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"switch to soul fragment", NextAction::array(0, new NextAction("attack corrupted soul fragment", ACTION_RAID + 1), nullptr))); "switch to soul fragment", NextAction::array(0, new NextAction("attack corrupted soul fragment", ACTION_RAID + 1), nullptr)));
triggers.push_back(new TriggerNode("bronjahm position", triggers.push_back(new TriggerNode("bronjahm position",
NextAction::array(0, new NextAction("bronjahm tank position", ACTION_RAID + 1), NextAction::array(0, new NextAction("bronjahm position", ACTION_RAID + 1), nullptr)));
new NextAction("bronjahm tank target", ACTION_RAID),
new NextAction("bronjahm dps position", ACTION_RAID + 2),
nullptr)));
} }
void WotlkDungeonFosStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers) void WotlkDungeonFoSStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
{ {
multipliers.push_back(new BronjahmMultiplier(botAI)); multipliers.push_back(new BronjahmMultiplier(botAI));
multipliers.push_back(new AttackFragmentMultiplier(botAI)); multipliers.push_back(new AttackFragmentMultiplier(botAI));

View File

@@ -3,11 +3,11 @@
#include "Multiplier.h" #include "Multiplier.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonFosStrategy : public Strategy class WotlkDungeonFoSStrategy : public Strategy
{ {
public: public:
WotlkDungeonFosStrategy(PlayerbotAI* ai) : Strategy(ai) {} WotlkDungeonFoSStrategy(PlayerbotAI* ai) : Strategy(ai) {}
std::string const getName() override { return "fos"; } std::string const getName() override { return "forge of souls"; }
void InitTriggers(std::vector<TriggerNode*> &triggers) override; void InitTriggers(std::vector<TriggerNode*> &triggers) override;
void InitMultipliers(std::vector<Multiplier*> &multipliers) override; void InitMultipliers(std::vector<Multiplier*> &multipliers) override;

View File

@@ -3,7 +3,7 @@
#include "NamedObjectContext.h" #include "NamedObjectContext.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "FosTriggers.h" #include "ForgeOfSoulsTriggers.h"
class WotlkDungeonFosTriggerContext : public NamedObjectContext<Trigger> class WotlkDungeonFosTriggerContext : public NamedObjectContext<Trigger>
{ {

View File

@@ -1,15 +1,14 @@
#include "FosTriggers.h" #include "ForgeOfSoulsTriggers.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool MoveFromBronjahmTrigger::IsActive() bool MoveFromBronjahmTrigger::IsActive()
{ {
Unit* boss = nullptr; Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (boss && boss->HasUnitState(UNIT_STATE_CASTING)) if (boss && boss->HasUnitState(UNIT_STATE_CASTING))
{ {
if (boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL)) if (boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL) && bot->HasAura(SPELL_CORRUPT_SOUL))
return true; return true;
} }
return false; return false;
@@ -20,12 +19,13 @@ bool SwitchToSoulFragment::IsActive()
Unit* fragment = nullptr; Unit* fragment = nullptr;
GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); GuidVector targets = AI_VALUE(GuidVector, "possible targets no los");
for (auto i = targets.begin(); i != targets.end(); ++i) for (auto& target : targets)
{ {
Unit* unit = botAI->GetUnit(*i); Unit* unit = botAI->GetUnit(target);
if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
{ {
return true; if (botAI->IsDps(bot))
return true;
} }
} }

View File

@@ -1,26 +0,0 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#include "Action.h"
#include "NamedObjectContext.h"
#include "FosActions.h"
class WotlkDungeonFosActionContext : public NamedObjectContext<Action>
{
public:
WotlkDungeonFosActionContext() {
creators["move from bronjahm"] = &WotlkDungeonFosActionContext::move_from_bronjahm;
creators["attack corrupted soul fragment"] = &WotlkDungeonFosActionContext::attack_corrupted_soul_fragment;
creators["bronjahm tank position"] = &WotlkDungeonFosActionContext::bronjahm_tank_position;
creators["bronjahm tank target"] = &WotlkDungeonFosActionContext::bronjahm_tank_target;
creators["bronjahm dps position"] = &WotlkDungeonFosActionContext::bronjahm_dps_position;
}
private:
static Action* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmAction(ai); }
static Action* attack_corrupted_soul_fragment(PlayerbotAI* ai) { return new AttackCorruptedSoulFragmentAction(ai); }
static Action* bronjahm_tank_position(PlayerbotAI* ai) { return new BronjahmTankPositionAction(ai); }
static Action* bronjahm_tank_target(PlayerbotAI* ai) { return new BronjahmTankTargetAction(ai); }
static Action* bronjahm_dps_position(PlayerbotAI* ai) { return new BronjahmDpsPositionAction(ai); }
};
#endif