mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Allowed tank bots to reassign roles if human main tank is affected by fused armor
This commit is contained in:
@@ -993,30 +993,52 @@ bool RazorscaleHarpoonAction::isUseful()
|
|||||||
|
|
||||||
bool RazorscaleFuseArmorAction::isUseful()
|
bool RazorscaleFuseArmorAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!botAI->IsMainTank(bot))
|
// If this bot cannot tank at all, no need to do anything
|
||||||
|
if (!botAI->IsTank(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Aura* fuseArmor = bot->GetAura(RazorscaleBossHelper::SPELL_FUSEARMOR);
|
// If this bot is the main tank AND has Fuse Armor at the threshold, return true immediately
|
||||||
if (!fuseArmor)
|
if (botAI->IsMainTank(bot))
|
||||||
|
{
|
||||||
|
Aura* fuseArmor = bot->GetAura(RazorscaleBossHelper::SPELL_FUSEARMOR);
|
||||||
|
if (fuseArmor && fuseArmor->GetStackAmount() >= RazorscaleBossHelper::FUSEARMOR_THRESHOLD)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, check if there's any other main tank with high Fuse Armor
|
||||||
|
Group* group = bot->GetGroup();
|
||||||
|
if (!group)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return fuseArmor->GetStackAmount() >= RazorscaleBossHelper::FUSEARMOR_THRESHOLD;
|
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||||
|
{
|
||||||
|
Player* member = gref->GetSource();
|
||||||
|
if (!member)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (botAI->IsMainTank(member) && member != bot)
|
||||||
|
{
|
||||||
|
Aura* fuseArmor = member->GetAura(RazorscaleBossHelper::SPELL_FUSEARMOR);
|
||||||
|
if (fuseArmor && fuseArmor->GetStackAmount() >= RazorscaleBossHelper::FUSEARMOR_THRESHOLD)
|
||||||
|
{
|
||||||
|
// There is another main tank with high Fuse Armor
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RazorscaleFuseArmorAction::Execute(Event event)
|
bool RazorscaleFuseArmorAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
if (!botAI->IsMainTank(bot))
|
// We already know from isUseful() that:
|
||||||
{
|
// 1) This bot can tank, AND
|
||||||
return false;
|
// 2) There is at least one main tank (possibly this bot) with Fuse Armor >= threshold.
|
||||||
}
|
|
||||||
|
|
||||||
RazorscaleBossHelper bossHelper(botAI);
|
RazorscaleBossHelper bossHelper(botAI);
|
||||||
bossHelper.AssignRolesBasedOnHealth();
|
|
||||||
|
|
||||||
// Check if the bot is still the main tank after reassignment
|
// Attempt to reassign the roles based on health/Fuse Armor debuff
|
||||||
if (botAI->IsMainTank(bot))
|
bossHelper.AssignRolesBasedOnHealth();
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user