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 WotlkDungeonUPActionContext());
actionContexts.Add(new WotlkDungeonCoSActionContext());
actionContexts.Add(new WotlkDungeonFosActionContext());
actionContexts.Add(new WotlkDungeonFoSActionContext());
triggerContexts.Add(new TriggerContext());
triggerContexts.Add(new ChatTriggerContext());

View File

@@ -14,7 +14,7 @@
#include "wotlk/oculus/OculusStrategy.h"
#include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h"
#include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h"
#include "wotlk/forgeofsouls/FosStrategy.h"
#include "wotlk/forgeofsouls/ForgeOfSoulsStrategy.h"
/*
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_up(PlayerbotAI* botAI) { return new WotlkDungeonUPStrategy(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
static Strategy* wotlk_toc(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
#define _PLAYERBOT_DUNGEONUTILS_H
#include "Player.h"
template<class T> inline
const T& DUNGEON_MODE(Player* bot, const T& normal5, const T& heroic10)

View File

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

View File

@@ -13,7 +13,7 @@
#include "oculus/OculusTriggerContext.h"
#include "utgardepinnacle/UtgardePinnacleTriggerContext.h"
#include "cullingofstratholme/CullingOfStratholmeTriggerContext.h"
#include "forgeofsouls/FosTriggerContext.h"
#include "forgeofsouls/ForgeOfSoulsTriggerContext.h"
// #include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
// #include "hallsofreflection/HallsOfReflectionTriggerContext.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 "FosActions.h"
#include "FosStrategy.h"
#include "ForgeOfSoulsActions.h"
#include "ForgeOfSoulsStrategy.h"
bool MoveFromBronjahmAction::Execute(Event event)
{
Unit* boss = nullptr;
boss = AI_VALUE2(Unit*, "find target", "bronjahm");
{
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (!boss)
return false;
@@ -17,7 +16,6 @@ bool MoveFromBronjahmAction::Execute(Event event)
return MoveAway(boss, targetDis - distance);
}
bool MoveFromBronjahmAction::isUseful() { return bot->HasAura(SPELL_CORRUPT_SOUL); }
bool AttackCorruptedSoulFragmentAction::Execute(Event event)
{
@@ -25,9 +23,9 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event)
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)
{
fragment = unit;
@@ -35,40 +33,45 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event)
}
}
if (!fragment)
return false;
if (botAI->IsDps(bot))
{
if (AI_VALUE(Unit*, "current target") == fragment)
return false;
if (fragment && AI_VALUE(Unit*, "current target") != 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(),
BRONJAHM_TANK_POSITION.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_COMBAT);
if (botAI->IsTank(bot))
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)
{
if (botAI->IsTank(bot))
{
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 Attack(boss);
}
else
return false;

View File

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

View File

@@ -1,10 +1,10 @@
#include "FosMultipliers.h"
#include "FosActions.h"
#include "ForgeOfSoulsMultipliers.h"
#include "ForgeOfSoulsActions.h"
#include "GenericSpellActions.h"
#include "ChooseTargetActions.h"
#include "MovementActions.h"
#include "FosTriggers.h"
#include "FosActions.h"
#include "ForgeOfSoulsTriggers.h"
#include "ForgeOfSoulsActions.h"
float BronjahmMultiplier::GetValue(Action* action) {
@@ -35,9 +35,9 @@ float AttackFragmentMultiplier::GetValue(Action* action)
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)
{
fragment = unit;

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,14 @@
#include "FosTriggers.h"
#include "ForgeOfSoulsTriggers.h"
#include "Playerbots.h"
#include "AiObject.h"
#include "AiObjectContext.h"
bool MoveFromBronjahmTrigger::IsActive()
{
Unit* boss = nullptr;
boss = AI_VALUE2(Unit*, "find target", "bronjahm");
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
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 false;
@@ -20,12 +19,13 @@ bool SwitchToSoulFragment::IsActive()
Unit* fragment = nullptr;
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)
{
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