Ulduar flame leviathan improvement

This commit is contained in:
Yunfan Li
2024-08-25 11:19:28 +08:00
parent 4b62d99c92
commit af228565fd

View File

@@ -47,15 +47,15 @@ bool FlameLeviathanVehicleAction::Execute(Event event)
if (unit->GetEntry() == 33142) // Leviathan Defense Turret if (unit->GetEntry() == 33142) // Leviathan Defense Turret
continue; continue;
if (unit->GetEntry() == 33113) // Flame Leviathan if (unit->GetEntry() == 33113) // Flame Leviathan
{
flame = unit; flame = unit;
continue;
}
if (!target || bot->GetExactDist(target) > bot->GetExactDist(unit)) if (!target || bot->GetExactDist(target) > bot->GetExactDist(unit))
{ {
target = unit; target = unit;
} }
} }
if (!target)
return false;
// Flame Leviathan is chasing me // Flame Leviathan is chasing me
if (flame && flame->GetVictim() == vehicleBase_) if (flame && flame->GetVictim() == vehicleBase_)
if (MoveAvoidChasing(flame)) if (MoveAvoidChasing(flame))
@@ -65,15 +65,15 @@ bool FlameLeviathanVehicleAction::Execute(Event event)
switch (entry) switch (entry)
{ {
case NPC_SALVAGED_DEMOLISHER: case NPC_SALVAGED_DEMOLISHER:
return DemolisherAction(target); return DemolisherAction(flame ? flame : target);
case NPC_SALVAGED_DEMOLISHER_TURRET: case NPC_SALVAGED_DEMOLISHER_TURRET:
return DemolisherTurretAction(target); return DemolisherTurretAction(target ? target: flame);
case NPC_SALVAGED_SIEGE_ENGINE: case NPC_SALVAGED_SIEGE_ENGINE:
return SiegeEngineAction(flame ? flame : target); return SiegeEngineAction(flame ? flame : target);
case NPC_SALVAGED_SIEGE_ENGINE_TURRET: case NPC_SALVAGED_SIEGE_ENGINE_TURRET:
return SiegeEngineTurretAction(target); return SiegeEngineTurretAction(target ? target: flame);
case NPC_VEHICLE_CHOPPER: case NPC_VEHICLE_CHOPPER:
return ChopperAction(target); return ChopperAction(target ? target: flame);
default: default:
break; break;
} }
@@ -82,6 +82,8 @@ bool FlameLeviathanVehicleAction::Execute(Event event)
bool FlameLeviathanVehicleAction::MoveAvoidChasing(Unit* target) bool FlameLeviathanVehicleAction::MoveAvoidChasing(Unit* target)
{ {
if (!target)
return false;
if (avoidChaseIdx == -1) if (avoidChaseIdx == -1)
{ {
for (int i = 0; i < corners.size(); i++) for (int i = 0; i < corners.size(); i++)
@@ -106,6 +108,8 @@ bool FlameLeviathanVehicleAction::MoveAvoidChasing(Unit* target)
bool FlameLeviathanVehicleAction::DemolisherAction(Unit* target) bool FlameLeviathanVehicleAction::DemolisherAction(Unit* target)
{ {
if (!target)
return false;
Aura* bluePyrite = target->GetAura(68605); Aura* bluePyrite = target->GetAura(68605);
if (!bluePyrite || (bluePyrite->GetStackAmount() <= 6 && vehicleBase_->GetPower(POWER_ENERGY) > 25) || bluePyrite->GetDuration() <= 5000) if (!bluePyrite || (bluePyrite->GetStackAmount() <= 6 && vehicleBase_->GetPower(POWER_ENERGY) > 25) || bluePyrite->GetDuration() <= 5000)
{ {
@@ -129,6 +133,7 @@ bool FlameLeviathanVehicleAction::DemolisherAction(Unit* target)
bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target) bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target)
{ {
int32 liquidCount = 0;
{ {
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
for (auto i = npcs.begin(); i != npcs.end(); i++) for (auto i = npcs.begin(); i != npcs.end(); i++)
@@ -136,7 +141,12 @@ bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target)
Unit* unit = botAI->GetUnit(*i); Unit* unit = botAI->GetUnit(*i);
if (!unit) if (!unit)
continue; continue;
if (unit->GetEntry() == 33189 && vehicleBase_->GetPower(POWER_ENERGY) <= 25) // Liquid Pyrite if (unit->GetEntry() != 33189)
continue;
if (unit->GetDistance(bot) >= 49.0f)
continue;
++liquidCount;
if (vehicleBase_->GetPower(POWER_ENERGY) <= 25) // Liquid Pyrite
{ {
uint32 spellId = 62479; uint32 spellId = 62479;
if (botAI->CanCastVehicleSpell(spellId, unit)) if (botAI->CanCastVehicleSpell(spellId, unit))
@@ -148,6 +158,7 @@ bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target)
} }
} }
} }
if (liquidCount <= 10)
{ {
GuidVector targets = AI_VALUE(GuidVector, "possible targets"); GuidVector targets = AI_VALUE(GuidVector, "possible targets");
for (auto i = targets.begin(); i != targets.end(); i++) for (auto i = targets.begin(); i != targets.end(); i++)
@@ -167,6 +178,8 @@ bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target)
} }
} }
} }
if (!target)
return false;
uint32 spellId = 62634; uint32 spellId = 62634;
if (botAI->CanCastVehicleSpell(spellId, target)) if (botAI->CanCastVehicleSpell(spellId, target))
if (botAI->CastVehicleSpell(spellId, target)) if (botAI->CastVehicleSpell(spellId, target))
@@ -179,6 +192,8 @@ bool FlameLeviathanVehicleAction::DemolisherTurretAction(Unit* target)
bool FlameLeviathanVehicleAction::SiegeEngineAction(Unit* target) bool FlameLeviathanVehicleAction::SiegeEngineAction(Unit* target)
{ {
if (!target)
return false;
if (target->GetCurrentSpell(CURRENT_CHANNELED_SPELL) || target->HasAura(62396)) if (target->GetCurrentSpell(CURRENT_CHANNELED_SPELL) || target->HasAura(62396))
{ {
uint32 spellId = 62522; uint32 spellId = 62522;
@@ -201,6 +216,8 @@ bool FlameLeviathanVehicleAction::SiegeEngineAction(Unit* target)
bool FlameLeviathanVehicleAction::SiegeEngineTurretAction(Unit* target) bool FlameLeviathanVehicleAction::SiegeEngineTurretAction(Unit* target)
{ {
if (!target)
return false;
uint32 spellId = 62358; uint32 spellId = 62358;
if (botAI->CanCastVehicleSpell(spellId, target)) if (botAI->CanCastVehicleSpell(spellId, target))
if (botAI->CastVehicleSpell(spellId, target)) if (botAI->CastVehicleSpell(spellId, target))
@@ -213,6 +230,8 @@ bool FlameLeviathanVehicleAction::SiegeEngineTurretAction(Unit* target)
bool FlameLeviathanVehicleAction::ChopperAction(Unit* target) bool FlameLeviathanVehicleAction::ChopperAction(Unit* target)
{ {
if (!target)
return false;
uint32 spellId = 62286; uint32 spellId = 62286;
if (botAI->CanCastVehicleSpell(spellId, target)) if (botAI->CanCastVehicleSpell(spellId, target))
if (botAI->CastVehicleSpell(spellId, target)) if (botAI->CastVehicleSpell(spellId, target))