Naxx thaddius strategy

This commit is contained in:
Yunfan Li
2024-02-09 15:42:36 +08:00
parent 4b72226ab4
commit 27569f431f
14 changed files with 328 additions and 347 deletions

View File

@@ -8,37 +8,6 @@
#include "SharedDefines.h"
#include "RaidNaxxBossHelper.h"
// bool TryToGetBossAIAction::Execute(Event event) {
// Unit* boss = AI_VALUE(Unit*, "boss target");
// if (!boss) {
// return false;
// }
// Creature* creature = boss->ToCreature();
// BossAI* b_ai = dynamic_cast<BossAI*>(boss->GetAI());
// if (!b_ai) {
// return false;
// }
// bool enabled = boss->IsAIEnabled;
// EventMap *eventMap = b_botAI->GetEvents();
// uint8 phase_mask = eventMap->GetPhaseMask();
// uint32 bossID = b_botAI->GetBossID();
// bool isDungeonBoss = creature->IsDungeonBoss();
// // bot->Yell("boss ai detected.", LANG_UNIVERSAL);
// uint32 next_event_time_1 = eventMap->GetNextEventTime(1);
// uint32 next_event_time_2 = eventMap->GetNextEventTime(2);
// uint32 next_event_time_3 = eventMap->GetNextEventTime(3);
// uint32 next_event_time_4 = eventMap->GetNextEventTime(4);
// uint32 next_event_time_5 = eventMap->GetNextEventTime(5);
// uint32 curr_timer = eventMap->GetTimer();
// bot->Yell("boss ai detected. phase mask: " + std::to_string(phase_mask) + " ai enabled: " + std::to_string(enabled) +
// " boss id: " + std::to_string(bossID) + " name: " + boss->GetName() + " entry: " + std::to_string(boss->GetEntry()) +
// " guid: " + std::to_string(boss->GetGUID().GetRawValue()) + " isDungeonBoss: " + std::to_string(isDungeonBoss) +
// " event1: " + std::to_string(next_event_time_1) + " event2: " + std::to_string(next_event_time_2) +
// " event3: " + std::to_string(next_event_time_3) + " event4: " + std::to_string(next_event_time_4) +
// " event5: " + std::to_string(next_event_time_5) + " timer: " + std::to_string(curr_timer), LANG_UNIVERSAL);
// return true;
// }
bool GrobbulusGoBehindAction::Execute(Event event)
{
@@ -122,159 +91,106 @@ bool HeiganDanceRangedAction::Execute(Event event) {
return MoveInside(bot->GetMapId(), waypoints[curr_safe].first, waypoints[curr_safe].second, bot->GetPositionZ(), 0);
}
// bool ThaddiusAttackNearestPetAction::isUseful()
// {
// Unit* feugen = AI_VALUE2(Unit*, "find target", "feugen");
// Unit* stalagg = AI_VALUE2(Unit*, "find target", "stalagg");
// if (!feugen || !stalagg) {
// return false;
// }
// Unit* result = feugen;
// if (stalagg && (!result || (bot->GetDistance2d(result) > bot->GetDistance2d(stalagg)))) {
// result = stalagg;
// }
// if (AI_VALUE(Unit*, "current target") == result) {
// return false;
// }
// return true;
// }
bool ThaddiusAttackNearestPetAction::isUseful()
{
if (!helper.UpdateBossAI()) {
return false;
}
if (!helper.IsPhasePet()) {
return false;
}
Unit* target = helper.GetNearestPet();
if (bot->GetDistance(target) > 50.0f) {
return false;
}
return true;
}
// bool ThaddiusAttackNearestPetAction::Execute(Event event) {
// Unit* feugen = AI_VALUE2(Unit*, "find target", "feugen");
// Unit* stalagg = AI_VALUE2(Unit*, "find target", "stalagg");
// Unit* result = feugen;
// if (stalagg && (!result || (bot->GetDistance2d(result) > bot->GetDistance2d(stalagg)))) {
// result = stalagg;
// }
// // if (result) {
// // bot->Yell("Goona attack " + result->GetName(), LANG_UNIVERSAL);
// // }
// return Attack(result);
// }
bool ThaddiusAttackNearestPetAction::Execute(Event event) {
Unit* target = helper.GetNearestPet();
if (!bot->IsWithinLOSInMap(target)) {
return MoveTo(target);
}
if (AI_VALUE(Unit*, "current target") != target) {
return Attack(target);
}
if (botAI->IsTank(bot) && AI_VALUE2(bool, "has aggro", "current target")) {
std::pair<float, float> posForTank = helper.PetPhaseGetPosForTank();
return MoveTo(533, posForTank.first, posForTank.second, helper.tankPosZ);
}
if (botAI->IsRanged(bot)) {
std::pair<float, float> posForRanged = helper.PetPhaseGetPosForRanged();
return MoveTo(533, posForRanged.first, posForRanged.second, helper.tankPosZ);
}
return false;
}
// bool ThaddiusMeleeToPlaceAction::isUseful()
// {
// if (botAI->IsTank(bot)) {
// Unit* target = AI_VALUE(Unit*, "current target");
// return target && target->GetVictim() == bot;
// } else {
// return !botAI->IsRanged(bot);
// }
// }
bool ThaddiusMoveToPlatformAction::isUseful()
{
return true;
}
// bool ThaddiusMeleeToPlaceAction::Execute(Event event)
// {
// Unit* target = AI_VALUE(Unit*, "current target");
// Unit* feugen = AI_VALUE2(Unit*, "find target", "feugen");
// Unit* stalagg = AI_VALUE2(Unit*, "find target", "stalagg");
// // float high_lx = 3455.14f, high_ly = -2927.48f;
// // float high_rx = 3515.00f, high_ry = -2983.09f;
// float high_lx = 3436.14f, high_ly = -2919.98f;
// float high_rx = 3522.94f, high_ry = -3002.60f;
// float high_z = 312.61f;
// if (target == feugen) {
// return MoveTo(bot->GetMapId(), high_rx, high_ry, high_z);
// } else if (target == stalagg) {
// return MoveTo(bot->GetMapId(), high_lx, high_ly, high_z);
// }
// return false;
// }
bool ThaddiusMoveToPlatformAction::Execute(Event event) {
std::vector<std::pair<float, float>> position = {
// high left
{3462.99f, -2918.90f},
// high right
{3520.65f, -2976.51f},
// low left
{3471.36f, -2910.65f},
// low right
{3528.80f, -2967.04f},
// center
{3512.19f, -2928.58f},
};
float high_z = 312.00f, low_z = 304.02f;
bool is_left = bot->GetDistance2d(position[0].first, position[0].second) < bot->GetDistance2d(position[1].first, position[1].second);
if (bot->GetPositionZ() >= (high_z - 3.0f)) {
if (is_left) {
if (!MoveTo(bot->GetMapId(), position[0].first, position[0].second, high_z)) {
bot->TeleportTo(bot->GetMapId(), position[2].first, position[2].second, low_z, bot->GetOrientation());
}
} else {
if (!MoveTo(bot->GetMapId(), position[1].first, position[1].second, high_z)) {
bot->TeleportTo(bot->GetMapId(), position[3].first, position[3].second, low_z, bot->GetOrientation());
}
}
} else {
return MoveTo(bot->GetMapId(), position[4].first, position[4].second, low_z);
}
return true;
}
// bool ThaddiusRangedToPlaceAction::isUseful()
// {
// return botAI->IsRanged(bot);
// }
bool ThaddiusMovePolarityAction::isUseful() {
return !botAI->IsMainTank(bot) || AI_VALUE2(bool, "has aggro", "current target");
}
// bool ThaddiusRangedToPlaceAction::Execute(Event event)
// {
// Unit* target = AI_VALUE(Unit*, "current target");
// Unit* feugen = AI_VALUE2(Unit*, "find target", "feugen");
// Unit* stalagg = AI_VALUE2(Unit*, "find target", "stalagg");
// float high_lx = 3441.01f, high_ly = -2942.04f;
// float high_rx = 3500.45f, high_ry = -2997.92f;
// float high_z = 312.61f;
// if (target == feugen) {
// return MoveTo(bot->GetMapId(), high_rx, high_ry, high_z);
// } else if (target == stalagg) {
// return MoveTo(bot->GetMapId(), high_lx, high_ly, high_z);
// }
// return false;
// }
// bool ThaddiusMoveToPlatformAction::isUseful()
// {
// // float high_z = 312.0f;
// // if (bot->GetPositionZ() < (high_z - 3.0f)) {
// // return false;
// // }
// return true;
// }
// bool ThaddiusMoveToPlatformAction::Execute(Event event) {
// std::vector<std::pair<float, float>> position = {
// // high left
// {3462.99f, -2918.90f},
// // high right
// {3520.65f, -2976.51f},
// // low left
// {3471.36f, -2910.65f},
// // low right
// {3528.80f, -2967.04f},
// // center
// {3512.19f, -2928.58f},
// };
// // float high_lx = 3462.99f, high_ly = -2918.90f;
// // float high_rx = 3520.65f, high_ly = -2976.51f;
// // float low_lx = 3471.36f, low_ly = -2910.65f;
// // float low_rx = 3528.80f, low_ry = -2967.04f;
// float high_z = 312.00f, low_z = 304.02f;
// bool is_left = bot->GetDistance2d(position[0].first, position[0].second) < bot->GetDistance2d(position[1].first, position[1].second);
// if (bot->GetPositionZ() >= (high_z - 3.0f)) {
// if (is_left) {
// if (!MoveTo(bot->GetMapId(), position[0].first, position[0].second, high_z)) {
// bot->TeleportTo(bot->GetMapId(), position[2].first, position[2].second, low_z, bot->GetOrientation());
// }
// } else {
// if (!MoveTo(bot->GetMapId(), position[1].first, position[1].second, high_z)) {
// bot->TeleportTo(bot->GetMapId(), position[3].first, position[3].second, low_z, bot->GetOrientation());
// }
// }
// } else {
// return MoveTo(bot->GetMapId(), position[4].first, position[4].second, low_z);
// }
// return true;
// }
// bool ThaddiusMovePolarityAction::isUseful() {
// return !botAI->IsMainTank(bot) || AI_VALUE2(bool, "has aggro", "current target");
// }
// bool ThaddiusMovePolarityAction::Execute(Event event) {
// std::vector<std::pair<float, float>> position = {
// // left melee
// {3508.29f, -2920.12f},
// // left ranged
// {3501.72f, -2913.36f},
// // right melee
// {3519.74f, -2931.69f},
// // right ranged
// {3524.32f, -2936.26f},
// // center melee
// {3512.19f, -2928.58f},
// // center ranged
// {3504.68f, -2936.68f},
// };
// uint32 idx;
// if (botAI->HasAuraWithDuration("negative charge", bot)) {
// idx = 0;
// } else if (botAI->HasAuraWithDuration("positive charge", bot)) {
// idx = 1;
// } else {
// idx = 2;
// }
// idx = idx * 2 + botAI->IsRanged(bot);
// return MoveTo(bot->GetMapId(), position[idx].first, position[idx].second, bot->GetPositionZ());
// }
bool ThaddiusMovePolarityAction::Execute(Event event) {
std::vector<std::pair<float, float>> position = {
// left melee
{3508.29f, -2920.12f},
// left ranged
{3501.72f, -2913.36f},
// right melee
{3519.74f, -2931.69f},
// right ranged
{3524.32f, -2936.26f},
// center melee
{3512.19f, -2928.58f},
// center ranged
{3504.68f, -2936.68f},
};
uint32 idx;
if (botAI->HasAura("negative charge", bot, false, false, -1, true)) {
idx = 0;
} else if (botAI->HasAura("positive charge", bot, false, false, -1, true)) {
idx = 1;
} else {
idx = 2;
}
idx = idx * 2 + botAI->IsRanged(bot);
return MoveTo(bot->GetMapId(), position[idx].first, position[idx].second, bot->GetPositionZ());
}
bool RazuviousUseObedienceCrystalAction::Execute(Event event)
{
@@ -529,43 +445,6 @@ bool SapphironFlightPositionAction::MoveToNearestIcebolt()
return false;
}
// bool SapphironAvoidChillAction::Execute(Event event)
// {
// Aura* aura = botAI->GetAura("chill", bot);
// if (!aura) return false;
// DynamicObject* dyn_obj = aura->GetDynobjOwner();
// if (!dyn_obj) return false;
// Unit* currentTarget = AI_VALUE(Unit*, "current target");
// float angle = 0;
// uint32 index = botAI->GetGroupSlotIndex(bot);
// // prevent seg fault
// if (currentTarget) {
// if (botAI->IsRanged(bot)) {
// if (bot->GetExactDist2d(currentTarget) <= 45.0f) {
// angle = bot->GetAngle(dyn_obj) - M_PI + (rand_norm() - 0.5) * M_PI / 2;
// } else {
// if (index % 2 == 0) {
// angle = bot->GetAngle(currentTarget) + M_PI / 2;
// } else {
// angle = bot->GetAngle(currentTarget) - M_PI / 2;
// }
// }
// } else {
// if (index % 3 == 0) {
// angle = bot->GetAngle(currentTarget);
// } else if (index % 3 == 1) {
// angle = bot->GetAngle(currentTarget) + M_PI / 2;
// } else {
// angle = bot->GetAngle(currentTarget) - M_PI / 2;
// }
// }
// } else {
// angle = bot->GetAngle(dyn_obj) - M_PI + (rand_norm() - 0.5) * M_PI / 2;
// }
// // }
// return MoveTo(bot->GetMapId(), bot->GetPositionX() + cos(angle) * 5.0f, bot->GetPositionY() + sin(angle) * 5.0f, bot->GetPositionZ());
// }
bool KelthuzadChooseTargetAction::Execute(Event event)
{
if (!helper.UpdateBossAI()) {