mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-24 14:06:22 +00:00
- Code refactoring in RaidUlduarActions (#1065)
This commit is contained in:
@@ -483,7 +483,6 @@ bool RazorscaleAvoidDevouringFlameAction::isUseful()
|
|||||||
|
|
||||||
bool RazorscaleAvoidSentinelAction::Execute(Event event)
|
bool RazorscaleAvoidSentinelAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
bool isTank = botAI->IsTank(bot);
|
|
||||||
bool isMainTank = botAI->IsMainTank(bot);
|
bool isMainTank = botAI->IsMainTank(bot);
|
||||||
bool isRanged = botAI->IsRanged(bot);
|
bool isRanged = botAI->IsRanged(bot);
|
||||||
const float radius = 8.0f;
|
const float radius = 8.0f;
|
||||||
@@ -723,6 +722,11 @@ bool RazorscaleIgnoreBossAction::isUseful()
|
|||||||
|
|
||||||
bool RazorscaleIgnoreBossAction::Execute(Event event)
|
bool RazorscaleIgnoreBossAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
if (!bot)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Unit* boss = AI_VALUE2(Unit*, "find target", "razorscale");
|
Unit* boss = AI_VALUE2(Unit*, "find target", "razorscale");
|
||||||
if (!boss)
|
if (!boss)
|
||||||
{
|
{
|
||||||
@@ -981,6 +985,11 @@ bool RazorscaleGroundedAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RazorscaleHarpoonAction::Execute(Event event)
|
bool RazorscaleHarpoonAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
if (!bot)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RazorscaleBossHelper razorscaleHelper(botAI);
|
RazorscaleBossHelper razorscaleHelper(botAI);
|
||||||
|
|
||||||
// Update the boss AI context
|
// Update the boss AI context
|
||||||
@@ -1229,7 +1238,7 @@ bool FreyaMarkEonarsGiftAction::isUseful()
|
|||||||
// Target is not findable from threat table using AI_VALUE2(),
|
// Target is not findable from threat table using AI_VALUE2(),
|
||||||
// therefore need to search manually for the unit id
|
// therefore need to search manually for the unit id
|
||||||
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
||||||
Unit* target;
|
Unit* target = nullptr;
|
||||||
for (auto i = targets.begin(); i != targets.end(); ++i)
|
for (auto i = targets.begin(); i != targets.end(); ++i)
|
||||||
{
|
{
|
||||||
target = botAI->GetUnit(*i);
|
target = botAI->GetUnit(*i);
|
||||||
@@ -1254,9 +1263,9 @@ bool FreyaMarkEonarsGiftAction::isUseful()
|
|||||||
|
|
||||||
int8 skullIndex = 7;
|
int8 skullIndex = 7;
|
||||||
ObjectGuid currentSkullTarget = group->GetTargetIcon(skullIndex);
|
ObjectGuid currentSkullTarget = group->GetTargetIcon(skullIndex);
|
||||||
if (currentSkullTarget == target->GetGUID())
|
if (!target || currentSkullTarget == target->GetGUID())
|
||||||
{
|
{
|
||||||
return false; // Skull marker is already correctly set
|
return false; // Skull marker is already correctly set or no Eonar's Gift found
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1269,7 +1278,7 @@ bool FreyaMarkEonarsGiftAction::Execute(Event event)
|
|||||||
Player* mainTank = mainTankUnit ? mainTankUnit->ToPlayer() : nullptr;
|
Player* mainTank = mainTankUnit ? mainTankUnit->ToPlayer() : nullptr;
|
||||||
|
|
||||||
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
GuidVector targets = AI_VALUE(GuidVector, "possible targets");
|
||||||
Unit* target;
|
Unit* target = nullptr;
|
||||||
for (auto i = targets.begin(); i != targets.end(); ++i)
|
for (auto i = targets.begin(); i != targets.end(); ++i)
|
||||||
{
|
{
|
||||||
Unit* unit = botAI->GetUnit(*i);
|
Unit* unit = botAI->GetUnit(*i);
|
||||||
@@ -1307,6 +1316,7 @@ bool FreyaMarkEonarsGiftAction::Execute(Event event)
|
|||||||
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
||||||
{
|
{
|
||||||
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // Stop after finding the first valid bot tank
|
break; // Stop after finding the first valid bot tank
|
||||||
@@ -1325,7 +1335,10 @@ bool FreyaMarkEonarsGiftAction::Execute(Event event)
|
|||||||
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
if (!currentSkullTarget || (target->GetGUID() != currentSkullTarget))
|
||||||
{
|
{
|
||||||
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
group->SetTargetIcon(skullIndex, bot->GetGUID(), target->GetGUID());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user