Integrate playerbots strategies, and actions for Onyxia (#737)

playerbots strategies for Onyxia40
This commit is contained in:
Keleborn
2025-09-17 21:33:29 -07:00
committed by GitHub
parent 559d718e9d
commit caf9464cc7
3 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#ifdef MOD_PLAYERBOTS
#ifndef MOD_INDIVIDUAL_PROGRESSION_ACTIONCONTEXT_H
#define MOD_INDIVIDUAL_PROGRESSION_ACTIONCONTEXT_H
#include "ActionContext.h"
#include "IndividualProgressionOnyxiaActions.h"
#include "RaidOnyxiaActionContext.h"
class IPOnyxiaActionContext : public RaidOnyxiaActionContext
{
public:
IPOnyxiaActionContext : public RaidOnyxiaActionContext ()
{
creators["ony kill whelps"] = &IPOnyxiaActionContext::kill_whelps;
}
private:
static Action* kill_playerbots::ActionRegistry::RegisterAction("ony kill whelps", []() { return new IPOnyxiaKillWhelpsAction(ai); }
};
#endif
#endif

View File

@@ -0,0 +1,31 @@
#ifdef MOD_PLAYERBOTS
#include "Playerbots.h"
#include "IndividualProgressionOnyxiaActions.h"
bool IPOnyxiaKillWhelpsAction::Execute(Event event)
{
Unit* currentTarget = AI_VALUE(Unit*, "current target");
// If already attacking a whelp, don't swap targets
if (currentTarget
&& (currentTarget->GetEntry() == 11262 // Default AzerothCore Onyxian Whelp
|| currentTarget->GetEntry() == 301001)) // mod-individual-progression Onyxian Whelp
{
return false;
}
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
for (ObjectGuid guid : targets)
{
Creature* unit = botAI->GetCreature(guid);
if (!unit || !unit->IsAlive() || !unit->IsInWorld())
continue;
if (unit->GetEntry() == 11262 // Default AzerothCore Onyxian Whelp
|| unit->GetEntry() == 301001) // mod-individual-progression Onyxian Whelp
{
// bot->Yell("Attacking Whelps!", LANG_UNIVERSAL);
return Attack(unit);
}
}
return false;
}
#endif

View File

@@ -0,0 +1,14 @@
#ifdef MOD_PLAYERBOTS
#ifndef MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H
#define MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H
#include "RaidOnyxiaActions.h"
class IPOnyxiaKillWhelpsAction : public RaidOnyxiaKillWhelpsAction
{
public:
using RaidOnyxiaKillWhelpsAction::RaidOnyxiaKillWhelpsAction;
bool Execute(Event event) override;
};
#endif
#endif