Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions src/Ai/Base/Actions/combat/UniversalTauntAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "AiFactory.h"
#include "DKActions.h"
#include "PaladinActions.h"
#include "PlayerbotAI.h"
#include "WarriorActions.h"
#include "DruidBearActions.h"

Expand Down Expand Up @@ -34,20 +35,64 @@ class UniversalTauntAction : public Action

bool isUseful() override
{
const Unit* const target = this->GetTarget();
Unit* const target = this->GetTarget();

if (target == nullptr)
{
return false;
}

const ObjectGuid targetTargetGUID = target->GetTarget();
const ObjectGuid targetTarget = target->GetTarget();

if (targetTargetGUID == this->bot->GetGUID())
if (targetTarget.IsEmpty())
{
return false;
}

if (targetTarget == this->bot->GetGUID())
{
return false;
}

Player* const playerTargetTarget = ObjectAccessor::FindPlayer(targetTarget);

if (playerTargetTarget == nullptr)
{
return true;
}


Value<Unit*>* const rtiTargetValue = this->context->GetValue<Unit*>("rti target");

// This is a normally impossible situation where the Value is not correctly instantiated.
// It does not mean the value itself is empty.
if (rtiTargetValue == nullptr)
{
return false;
}

const Unit* const rtiTarget = rtiTargetValue->Get();

if (PlayerbotAI::IsMainTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

if (PlayerbotAI::IsAssistTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

return true;
}

Expand Down
133 changes: 131 additions & 2 deletions src/Ai/Class/Dk/Action/DKActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _PLAYERBOT_DKACTIONS_H
#define _PLAYERBOT_DKACTIONS_H

#include "AiObjectContext.h"
#include "Event.h"
#include "GenericSpellActions.h"

Expand Down Expand Up @@ -41,10 +42,138 @@ class CastDarkCommandAction : public CastSpellAction
{
public:
CastDarkCommandAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "dark command") {}

bool isUseful() override
{
Unit* const target = this->GetTarget();

if (target == nullptr)
{
return false;
}

const ObjectGuid targetTarget = target->GetTarget();

if (targetTarget.IsEmpty())
{
return false;
}

if (targetTarget == this->bot->GetGUID())
{
return false;
}

Player* const playerTargetTarget = ObjectAccessor::FindPlayer(targetTarget);

if (playerTargetTarget == nullptr)
{
return true;
}


Value<Unit*>* const rtiTargetValue = this->context->GetValue<Unit*>("rti target");

// This is a normally impossible situation where the Value is not correctly instantiated.
// It does not mean the value itself is empty.
if (rtiTargetValue == nullptr)
{
return false;
}

const Unit* const rtiTarget = rtiTargetValue->Get();

if (PlayerbotAI::IsMainTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

if (PlayerbotAI::IsAssistTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

return true;
}
};
class CastDeathGripAction : public CastSpellAction
{
public:
CastDeathGripAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "death grip") {}

BEGIN_RANGED_SPELL_ACTION(CastDeathGripAction, "death grip")
END_SPELL_ACTION()
bool isUseful() override
{
Unit* const target = this->GetTarget();

if (target == nullptr)
{
return false;
}

const ObjectGuid targetTarget = target->GetTarget();

if (targetTarget.IsEmpty())
{
return false;
}

if (targetTarget == this->bot->GetGUID())
{
return false;
}

Player* const playerTargetTarget = ObjectAccessor::FindPlayer(targetTarget);

if (playerTargetTarget == nullptr)
{
return true;
}


Value<Unit*>* const rtiTargetValue = this->context->GetValue<Unit*>("rti target");

// This is a normally impossible situation where the Value is not correctly instantiated.
// It does not mean the value itself is empty.
if (rtiTargetValue == nullptr)
{
return false;
}

const Unit* const rtiTarget = rtiTargetValue->Get();

if (PlayerbotAI::IsMainTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

if (PlayerbotAI::IsAssistTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

return true;
}
};

// Unholy presence
class CastUnholyMeleeSpellAction : public CastMeleeSpellAction
Expand Down
127 changes: 127 additions & 0 deletions src/Ai/Class/Druid/Action/DruidBearActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _PLAYERBOT_DRUIDBEARACTIONS_H
#define _PLAYERBOT_DRUIDBEARACTIONS_H

#include "AiObjectContext.h"
#include "GenericSpellActions.h"
#include "ReachTargetActions.h"

Expand All @@ -21,12 +22,138 @@ class CastGrowlAction : public CastSpellAction
{
public:
CastGrowlAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "growl") {}

bool isUseful() override
{
Unit* const target = this->GetTarget();

if (target == nullptr)
{
return false;
}

const ObjectGuid targetTarget = target->GetTarget();

if (targetTarget.IsEmpty())
{
return false;
}

if (targetTarget == this->bot->GetGUID())
{
return false;
}

Player* const playerTargetTarget = ObjectAccessor::FindPlayer(targetTarget);

if (playerTargetTarget == nullptr)
{
return true;
}


Value<Unit*>* const rtiTargetValue = this->context->GetValue<Unit*>("rti target");

// This is a normally impossible situation where the Value is not correctly instantiated.
// It does not mean the value itself is empty.
if (rtiTargetValue == nullptr)
{
return false;
}

const Unit* const rtiTarget = rtiTargetValue->Get();

if (PlayerbotAI::IsMainTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

if (PlayerbotAI::IsAssistTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

return true;
}
};

class CastChallengingRoarAction : public CastMeleeDebuffSpellAction
{
public:
CastChallengingRoarAction(PlayerbotAI* botAI) : CastMeleeDebuffSpellAction(botAI, "challenging roar") {}

bool isUseful() override
{
Unit* const target = this->GetTarget();

if (target == nullptr)
{
return false;
}

const ObjectGuid targetTarget = target->GetTarget();

if (targetTarget.IsEmpty())
{
return false;
}

if (targetTarget == this->bot->GetGUID())
{
return false;
}

Player* const playerTargetTarget = ObjectAccessor::FindPlayer(targetTarget);

if (playerTargetTarget == nullptr)
{
return true;
}


Value<Unit*>* const rtiTargetValue = this->context->GetValue<Unit*>("rti target");

// This is a normally impossible situation where the Value is not correctly instantiated.
// It does not mean the value itself is empty.
if (rtiTargetValue == nullptr)
{
return false;
}

const Unit* const rtiTarget = rtiTargetValue->Get();

if (PlayerbotAI::IsMainTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

if (PlayerbotAI::IsAssistTank(playerTargetTarget))
{
if (rtiTarget != nullptr && rtiTarget->GetGUID() == target->GetGUID())
{
return true;
}

return false;
}

return true;
}
};

class CastMaulAction : public CastMeleeSpellAction
Expand Down
Loading