add strategy about bronjahm

This commit is contained in:
姜耀
2024-10-30 20:19:01 +08:00
parent 74ee7fa3a4
commit 16e2cac60d
13 changed files with 262 additions and 27 deletions

View File

@@ -62,6 +62,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
actionContexts.Add(new WotlkDungeonOccActionContext());
actionContexts.Add(new WotlkDungeonUPActionContext());
actionContexts.Add(new WotlkDungeonCoSActionContext());
actionContexts.Add(new WotlkDungeonFosActionContext());
triggerContexts.Add(new TriggerContext());
triggerContexts.Add(new ChatTriggerContext());
@@ -84,6 +85,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
triggerContexts.Add(new WotlkDungeonOccTriggerContext());
triggerContexts.Add(new WotlkDungeonUPTriggerContext());
triggerContexts.Add(new WotlkDungeonCoSTriggerContext());
triggerContexts.Add(new WotlkDungeonFosTriggerContext());
valueContexts.Add(new ValueContext());

View File

@@ -14,6 +14,7 @@
#include "wotlk/oculus/OculusStrategy.h"
#include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h"
#include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h"
#include "wotlk/forgeofsouls/FosStrategy.h"
/*
Full list/TODO:
@@ -76,11 +77,12 @@ 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); }
// NYI from here down
static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
static Strategy* wotlk_pos(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
};
#endif

View File

@@ -1,6 +1,6 @@
#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,9 +13,9 @@
#include "oculus/OculusActionContext.h"
#include "utgardepinnacle/UtgardePinnacleActionContext.h"
#include "cullingofstratholme/CullingOfStratholmeActionContext.h"
#include "forgeofsouls/FosActionContext.h"
// #include "trialofthechampion/TrialOfTheChampionActionContext.h"
// #include "hallsofreflection/HallsOfReflectionActionContext.h"
// #include "pitofsaron/PitOfSaronActionContext.h"
// #include "forgeofsouls/ForgeOfSoulsActionContext.h"
#endif

View File

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

View File

@@ -1,5 +1,5 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONNEXACTIONCONTEXT_H
#ifndef _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#define _PLAYERBOT_WOTLKDUNGEONFOSACTIONCONTEXT_H
#include "Action.h"
#include "NamedObjectContext.h"
@@ -9,17 +9,18 @@ class WotlkDungeonFosActionContext : public NamedObjectContext<Action>
{
public:
WotlkDungeonFosActionContext() {
creators["csf target"] = &WotlkDungeonFosActionContext::move_from_whirlwind;
creators["firebomb spread"] = &WotlkDungeonNexActionContext::firebomb_spread;
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_whirlwind(PlayerbotAI* ai) { return new MoveFromWhirlwindAction(ai); }
static Action* firebomb_spread(PlayerbotAI* ai) { return new FirebombSpreadAction(ai); }
static Action* telestra_split_target(PlayerbotAI* ai) { return new TelestraSplitTargetAction(ai); }
static Action* csf_target(PlayerbotAI* ai) { return new }
static Action* chaotic_rift_target(PlayerbotAI* ai) { return new ChaoticRiftTargetAction(ai); }
static Action* dodge_spikes(PlayerbotAI* ai) { return new DodgeSpikesAction(ai); }
static Action* intense_cold_jump(PlayerbotAI* ai) { return new IntenseColdJumpAction(ai); }
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

View File

@@ -9,22 +9,91 @@ bool MoveFromBronjahmAction::Execute(Event event)
if (!boss)
return false;
float distance = bot->GetExactDist2d(boss->GetPosition());
float targetDis = 30.0f;
float targetDis = 20.0f;
if (distance >= targetDis)
return false;
return MoveAway(boss, targetDis - distance);
}
bool MoveFromBronjahmAction::isUseful() { return bot->HasAura(SPELL_CORRUPT_SOUL); }
bool AttackCorruptedSoulFragmentAction::Execute(Event event)
{
Unit* fragment = nullptr;
fragment = AI_VALUE2(Unit*, "find target", "corrupted soul fragment");
GuidVector targets = AI_VALUE(GuidVector, "possible targets no los");
for (auto i = targets.begin(); i != targets.end(); ++i)
{
Unit* unit = botAI->GetUnit(*i);
if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
{
fragment = unit;
break;
}
}
if (!fragment)
return false;
if (AI_VALUE(Unit*, "current target") == fragment)
if (botAI->IsDps(bot))
{
if (AI_VALUE(Unit*, "current target") == fragment)
return false;
return Attack(fragment);
}
else
return false;
}
bool AttackCorruptedSoulFragmentAction::isUseful() { return botAI->IsDps(bot); }
bool BronjahmTankPositionAction::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);
}
bool BronjahmTankPositionAction::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)
return false;
return Attack(boss);
}
else
return false;
}
bool BronjahmDpsPositionAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
if (!boss)
return false;
return Attack(fragment);
if (bot->getClass() == CLASS_HUNTER)
{
return Move(bot->GetAngle(boss), 8.0f);
}
else
{
return Move(bot->GetAngle(boss), 5.0f);
}
}
bool BronjahmDpsPositionAction::isUseful()
{
if (bot->GetExactDist2d(BRONJAHM_TANK_POSITION) <= 10.0f)
return false;
return botAI->IsDps(bot) || botAI->IsHeal(bot);
}

View File

@@ -7,11 +7,14 @@
#include "Playerbots.h"
#include "FosTriggers.h"
const Position BRONJAHM_TANK_POSITION = Position(5297.9204f, 2506.698f, 686.06793f);
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,5 +25,31 @@ public:
bool isUseful() override;
};
class BronjahmTankPositionAction : public MovementAction
{
public:
BronjahmTankPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm tank position") {}
bool Execute(Event event) override;
bool isUseful() override;
};
class BronjahmDpsPositionAction : public MovementAction
{
public:
BronjahmDpsPositionAction(PlayerbotAI* ai) : MovementAction(ai, "bronjahm dps position") {}
bool Execute(Event event) override;
bool isUseful() override;
};
class BronjahmTankTargetAction : public AttackAction
{
public:
BronjahmTankTargetAction(PlayerbotAI* ai) : AttackAction(ai, "bronjahm tank target") {}
bool Execute(Event event) override;
};
#endif

View File

@@ -4,11 +4,18 @@
#include "ChooseTargetActions.h"
#include "MovementActions.h"
#include "FosTriggers.h"
#include "FosActions.h"
float BronjahmMultiplier::GetValue(Action* action) {
Unit* boss = nullptr;
boss = AI_VALUE2(Unit * "find target", "bronjahm");
boss = AI_VALUE2(Unit *, "find target", "bronjahm");
if (!boss)
return 1.0f;
if (botAI->IsTank(bot))
if (dynamic_cast<TankAssistAction*>(action))
return 0.0f;
if (boss && boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_CORRUPT_SOUL))
{
if (dynamic_cast<MovementAction*>(action) && !dynamic_cast<MoveFromBronjahmAction*>(action))
@@ -16,11 +23,30 @@ float BronjahmMultiplier::GetValue(Action* action) {
return 0.0f;
}
}
return 1.0f; }
return 1.0f;
}
float AttackFragmentMultiplier::GetValue(Action* action)
{
auto isTank = botAI->IsTank();
if (isTank && dynamic_cast<AttackCorruptedSoulFragmentAction>(action))
if (botAI->IsHeal(bot) && dynamic_cast<AttackCorruptedSoulFragmentAction*>(action))
return 0.0f;
return 1.0f; }
Unit* fragment = nullptr;
GuidVector targets = AI_VALUE(GuidVector, "possible targets no los");
for (auto i = targets.begin(); i != targets.end(); ++i)
{
Unit* unit = botAI->GetUnit(*i);
if (unit && unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
{
fragment = unit;
break;
}
}
if (fragment && dynamic_cast<BronjahmDpsPositionAction*>(action))
return 0.0f;
return 1.0f;
}

View File

@@ -1,5 +1,21 @@
#include "FosStrategy.h"
#include "FosMultipliers.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)));
}
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

@@ -4,4 +4,21 @@
#include "NamedObjectContext.h"
#include "AiObjectContext.h"
#include "FosTriggers.h"
class WotlkDungeonFosTriggerContext : public NamedObjectContext<Trigger>
{
public:
WotlkDungeonFosTriggerContext()
{
creators["bronjahm position"] = &WotlkDungeonFosTriggerContext::bronjahm_position;
creators["move from bronjahm"] = &WotlkDungeonFosTriggerContext::move_from_bronjahm;
creators["switch to soul fragment"] = &WotlkDungeonFosTriggerContext::switch_to_soul_fragment;
}
private:
static Trigger* move_from_bronjahm(PlayerbotAI* ai) { return new MoveFromBronjahmTrigger(ai); }
static Trigger* switch_to_soul_fragment(PlayerbotAI* ai) { return new SwitchToSoulFragment(ai); }
static Trigger* bronjahm_position(PlayerbotAI* ai) { return new BronjahmPositionTrigger(ai); }
};
#endif // !_PLAYERBOT_WOTLKDUNGEONFOSTRIGGERCONTEXT_H

View File

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

View File

@@ -1,3 +1,6 @@
#ifndef _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERS_H
#define _PLAYERBOT_WOTLKDUNGEONFOSTRIGGERS_H
#include "Trigger.h"
#include "PlayerbotAIConfig.h"
#include "GenericTriggers.h"
@@ -5,7 +8,33 @@
enum FosIDs
{
//Boss1
// Boss1
NPC_CORRUPTED_SOUL_FRAGMENT = 36535,
SPELL_CORRUPT_SOUL = 68839
};
class MoveFromBronjahmTrigger : public Trigger
{
public:
MoveFromBronjahmTrigger(PlayerbotAI* ai) : Trigger(ai, "move from bronjahm") {}
bool IsActive() override;
};
class SwitchToSoulFragment : public Trigger
{
public:
SwitchToSoulFragment(PlayerbotAI* ai) : Trigger(ai, "switch to soul fragment") {}
bool IsActive() override;
};
class BronjahmPositionTrigger : public Trigger
{
public:
BronjahmPositionTrigger(PlayerbotAI* ai) : Trigger(ai, "bronjahm position") {}
bool IsActive() override;
};
#endif