mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-17 00:54:35 +00:00
- Added tactic for Freya Nature bomb
- Added tactic for Freya Eonar's gift
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "RaidUlduarBossHelper.h"
|
||||
#include "RaidUlduarScripts.h"
|
||||
#include "RaidUlduarStrategy.h"
|
||||
#include "RaidUlduarTriggers.h"
|
||||
#include "RtiValue.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ServerFacade.h"
|
||||
@@ -398,6 +399,7 @@ bool FlameLeviathanEnterVehicleAction::AllMainVehiclesOnUse()
|
||||
int maxC = (diff == RAID_DIFFICULTY_10MAN_NORMAL || diff == RAID_DIFFICULTY_10MAN_HEROIC) ? 2 : 5;
|
||||
return demolisher >= maxC && siege >= maxC;
|
||||
}
|
||||
|
||||
bool RazorscaleAvoidDevouringFlameAction::Execute(Event event)
|
||||
{
|
||||
RazorscaleBossHelper razorscaleHelper(botAI);
|
||||
@@ -1187,3 +1189,143 @@ bool HodirMoveSnowpackedIcicleAction::Execute(Event event)
|
||||
return MoveTo(target->GetMapId(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false,
|
||||
false, false, true, MovementPriority::MOVEMENT_NORMAL);
|
||||
}
|
||||
|
||||
bool FreyaMoveAwayNatureBombAction::isUseful()
|
||||
{
|
||||
// Check boss and it is alive
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "freya");
|
||||
if (!boss || !boss->IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the nearest Nature Bomb
|
||||
GameObject* target = bot->FindNearestGameObject(GOBJECT_NATURE_BOMB, 12.0f);
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FreyaMoveAwayNatureBombAction::Execute(Event event)
|
||||
{
|
||||
GameObject* target = bot->FindNearestGameObject(GOBJECT_NATURE_BOMB, 12.0f);
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
return FleePosition(target->GetPosition(), 13.0f);
|
||||
}
|
||||
|
||||
bool FreyaMarkEonarsGiftAction::isUseful()
|
||||
{
|
||||
// Only tank bot can mark target
|
||||
if (!botAI->IsTank(bot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Eonar's gift and it is alive
|
||||
|
||||
// Target is not findable from threat table using AI_VALUE2(),
|
||||
// therefore need to search manually for the unit id
|
||||
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
||||
Unit* target;
|
||||
for (auto i = targets.begin(); i != targets.end(); ++i)
|
||||
{
|
||||
target = botAI->GetUnit(*i);
|
||||
if (!target)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 creatureId = target->GetEntry();
|
||||
if (creatureId == NPC_EONARS_GIFT && target->IsAlive())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Eonar's Gift is already set as the skull marker
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int8 skullIndex = 7;
|
||||
ObjectGuid currentSkullTarget = group->GetTargetIcon(skullIndex);
|
||||
if (currentSkullTarget == target->GetGUID())
|
||||
{
|
||||
return false; // Skull marker is already correctly set
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FreyaMarkEonarsGiftAction::Execute(Event event)
|
||||
{
|
||||
bool isMainTank = botAI->IsMainTank(bot);
|
||||
Unit* mainTankUnit = AI_VALUE(Unit*, "main tank");
|
||||
Player* mainTank = mainTankUnit ? mainTankUnit->ToPlayer() : nullptr;
|
||||
|
||||
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
||||
Unit* target;
|
||||
for (auto i = targets.begin(); i != targets.end(); ++i)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(*i);
|
||||
if (!unit)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 creatureId = unit->GetEntry();
|
||||
if (creatureId == NPC_EONARS_GIFT && unit->IsAlive())
|
||||
{
|
||||
target = unit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mainTank && !GET_PLAYERBOT_AI(mainTank)) // Main tank is a real player
|
||||
{
|
||||
// Iterate through the first 3 bot tanks to assign the Skull marker
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (botAI->IsAssistTankOfIndex(bot, i) && GET_PLAYERBOT_AI(bot)) // Bot is a valid tank
|
||||
{
|
||||
Group* group = bot->GetGroup();
|
||||
if (group && target)
|
||||
{
|
||||
int8 skullIndex = 7; // Skull
|
||||
ObjectGuid currentSkullTarget = group->GetTargetIcon(skullIndex);
|
||||
|
||||
// If there's no skull set yet, or the skull is on a different target, set the Eonar's Gift
|
||||
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
||||
{
|
||||
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
||||
}
|
||||
}
|
||||
break; // Stop after finding the first valid bot tank
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isMainTank) // Bot is the main tank
|
||||
{
|
||||
Group* group = bot->GetGroup();
|
||||
if (group)
|
||||
{
|
||||
int8 skullIndex = 7; // Skull
|
||||
ObjectGuid currentSkullTarget = group->GetTargetIcon(skullIndex);
|
||||
|
||||
// If there's no skull set yet, or the skull is on a different target, set the Eonar's Gift
|
||||
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
||||
{
|
||||
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user