diff --git a/src/strategy/raids/icecrown/RaidIccActions.cpp b/src/strategy/raids/icecrown/RaidIccActions.cpp index a37bbb52..32fb1592 100644 --- a/src/strategy/raids/icecrown/RaidIccActions.cpp +++ b/src/strategy/raids/icecrown/RaidIccActions.cpp @@ -464,66 +464,104 @@ bool IccGunshipEnterCannonAction::EnterVehicle(Unit* vehicleBase, bool moveIfFar bool IccGunshipTeleportAllyAction::Execute(Event event) { + // Find the Battle-Mage boss Unit* boss = AI_VALUE2(Unit*, "find target", "kor'kron battle-mage"); - if (!boss) - return false; - // Only proceed if the mage is channeling Below Zero - if (!(boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(69705))) + // Check if we need to remove skull icon when boss is dead + if (Group* group = bot->GetGroup()) { - // If not casting and we're too far from waiting position, go there - if (bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_ALLY2) > 45.0f) - return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionX(), - ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionY(), ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionZ(), bot->GetOrientation()); - return false; + ObjectGuid currentSkullTarget = group->GetTargetIcon(7); + if (!currentSkullTarget.IsEmpty()) + { + // If the current skull target is dead or doesn't exist, remove the icon + if (Unit* skullTarget = ObjectAccessor::GetUnit(*bot, currentSkullTarget)) + { + if (!skullTarget->IsAlive()) + group->SetTargetIcon(7, bot->GetGUID(), ObjectGuid::Empty); + } + else + { + // Target not found, might have despawned, remove icon + group->SetTargetIcon(7, bot->GetGUID(), ObjectGuid::Empty); + } + } } - if (Group* group = bot->GetGroup()) - if (group->GetTargetIcon(7) != boss->GetGUID()) - group->SetTargetIcon(7, bot->GetGUID(), boss->GetGUID()); + // If no boss found or boss is dead, nothing more to do + if (!boss || !boss->IsAlive() || !boss->HasUnitState(UNIT_STATE_CASTING)) + { + // If we're too far from waiting position, go there + if (bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_ALLY2) > 45.0f) + return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionX(), + ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionY(), + ICC_GUNSHIP_TELEPORT_ALLY2.GetPositionZ(), bot->GetOrientation()); + } + else if (boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(69705) && boss->IsAlive()) + { + // Mark the boss with skull icon + if (Group* group = bot->GetGroup()) + if (group->GetTargetIcon(7) != boss->GetGUID()) + group->SetTargetIcon(7, bot->GetGUID(), boss->GetGUID()); - bot->SetTarget(boss->GetGUID()); - // Check if the bot is targeting a valid boss before teleporting - if (bot->GetTarget() != boss->GetGUID()) - return false; - - if (!botAI->IsAssistTank(bot) && bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_ALLY) > 15.0f) - return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_ALLY.GetPositionX(), - ICC_GUNSHIP_TELEPORT_ALLY.GetPositionY(), ICC_GUNSHIP_TELEPORT_ALLY.GetPositionZ(), bot->GetOrientation()); - - return Attack(boss); + // Teleport non-tank bots to attack position if not already there + if (!botAI->IsAssistTank(bot) && bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_ALLY) > 15.0f) + return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_ALLY.GetPositionX(), + ICC_GUNSHIP_TELEPORT_ALLY.GetPositionY(), ICC_GUNSHIP_TELEPORT_ALLY.GetPositionZ(), + bot->GetOrientation()); + } + + return false; } bool IccGunshipTeleportHordeAction::Execute(Event event) { + // Find the Sorcerer boss Unit* boss = AI_VALUE2(Unit*, "find target", "skybreaker sorcerer"); - if (!boss) - return false; - // Only proceed if the sorcerer is channeling Below Zero - if (!(boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(69705))) + // Check if we need to remove skull icon when boss is dead + if (Group* group = bot->GetGroup()) { - // If not casting and we're too far from waiting position, go there - if (bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_HORDE2) > 45.0f) - return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionX(), - ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionY(), ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionZ(), bot->GetOrientation()); - return false; + ObjectGuid currentSkullTarget = group->GetTargetIcon(7); + if (!currentSkullTarget.IsEmpty()) + { + // If the current skull target is dead or doesn't exist, remove the icon + if (Unit* skullTarget = ObjectAccessor::GetUnit(*bot, currentSkullTarget)) + { + if (!skullTarget->IsAlive()) + group->SetTargetIcon(7, bot->GetGUID(), ObjectGuid::Empty); + } + else + { + // Target not found, might have despawned, remove icon + group->SetTargetIcon(7, bot->GetGUID(), ObjectGuid::Empty); + } + } } - if (Group* group = bot->GetGroup()) - if (group->GetTargetIcon(7) != boss->GetGUID()) - group->SetTargetIcon(7, bot->GetGUID(), boss->GetGUID()); + // If no boss found or boss is dead, nothing more to do + if (!boss || !boss->IsAlive() || !boss->HasUnitState(UNIT_STATE_CASTING)) + { + // If we're too far from waiting position, go there + if (bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_HORDE2) > 45.0f) + return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionX(), + ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionY(), + ICC_GUNSHIP_TELEPORT_HORDE2.GetPositionZ(), bot->GetOrientation()); + } + else if (boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(69705) && boss->IsAlive()) + { + // Mark the boss with skull icon + if (Group* group = bot->GetGroup()) + if (group->GetTargetIcon(7) != boss->GetGUID()) + group->SetTargetIcon(7, bot->GetGUID(), boss->GetGUID()); - bot->SetTarget(boss->GetGUID()); - // Check if the bot is targeting a valid boss before teleporting - if (bot->GetTarget() != boss->GetGUID()) - return false; + // Teleport non-tank bots to attack position if not already there + if (!botAI->IsAssistTank(bot) && bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_HORDE) > 15.0f) + return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_HORDE.GetPositionX(), + ICC_GUNSHIP_TELEPORT_HORDE.GetPositionY(), ICC_GUNSHIP_TELEPORT_HORDE.GetPositionZ(), + bot->GetOrientation()); + } - if (!botAI->IsAssistTank(bot) && bot->GetExactDist2d(ICC_GUNSHIP_TELEPORT_HORDE) > 15.0f) - return bot->TeleportTo(bot->GetMapId(), ICC_GUNSHIP_TELEPORT_HORDE.GetPositionX(), - ICC_GUNSHIP_TELEPORT_HORDE.GetPositionY(), ICC_GUNSHIP_TELEPORT_HORDE.GetPositionZ(), bot->GetOrientation()); - - return Attack(boss); + return false; } //DBS diff --git a/src/strategy/raids/icecrown/RaidIccStrategy.cpp b/src/strategy/raids/icecrown/RaidIccStrategy.cpp index f554d021..293024db 100644 --- a/src/strategy/raids/icecrown/RaidIccStrategy.cpp +++ b/src/strategy/raids/icecrown/RaidIccStrategy.cpp @@ -29,10 +29,10 @@ void RaidIccStrategy::InitTriggers(std::vector& triggers) NextAction::array(0, new NextAction("icc rotting frost giant tank position", ACTION_RAID + 5), nullptr))); triggers.push_back(new TriggerNode("icc gunship cannon near", - NextAction::array(0, new NextAction("icc gunship enter cannon", ACTION_RAID + 2), nullptr))); + NextAction::array(0, new NextAction("icc gunship enter cannon", ACTION_RAID + 6), nullptr))); triggers.push_back( new TriggerNode("icc in cannon", - NextAction::array(0, new NextAction("icc cannon fire", ACTION_RAID), nullptr))); + NextAction::array(0, new NextAction("icc cannon fire", ACTION_RAID+5), nullptr))); triggers.push_back(new TriggerNode("icc gunship teleport ally", NextAction::array(0, new NextAction("icc gunship teleport ally", ACTION_RAID + 4), nullptr))); diff --git a/src/strategy/raids/icecrown/RaidIccTriggers.cpp b/src/strategy/raids/icecrown/RaidIccTriggers.cpp index 510ea1ec..9af3cee3 100644 --- a/src/strategy/raids/icecrown/RaidIccTriggers.cpp +++ b/src/strategy/raids/icecrown/RaidIccTriggers.cpp @@ -124,18 +124,25 @@ bool IccGunshipCannonNearTrigger::IsActive() bool IccGunshipTeleportAllyTrigger::IsActive() { - Unit* boss = AI_VALUE2(Unit*, "find target", "kor'kron battle-mage"); - if (!boss) { return false; } + Unit* boss = bot->FindNearestCreature(36939, 100.0f); + if (!boss) + return false; + + if (!boss->IsHostileTo(bot)) + return false; return true; } bool IccGunshipTeleportHordeTrigger::IsActive() { - Unit* boss = AI_VALUE2(Unit*, "find target", "skybreaker sorcerer"); + Unit* boss = bot->FindNearestCreature(36948, 100.0f); if (!boss) return false; + if (!boss->IsHostileTo(bot)) + return false; + return true; }