mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-29 16:33:46 +00:00
date: 2024-11-06
This commit is contained in:
@@ -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
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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));
|
||||
@@ -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;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "NamedObjectContext.h"
|
||||
#include "AiObjectContext.h"
|
||||
#include "FosTriggers.h"
|
||||
#include "ForgeOfSoulsTriggers.h"
|
||||
|
||||
class WotlkDungeonFosTriggerContext : public NamedObjectContext<Trigger>
|
||||
{
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user