Skip to content

Commit

Permalink
BossAI: Minor Leviathan touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Oct 27, 2023
1 parent 3283729 commit a6bf96b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ enum
// leviathan other spells
SPELL_SMOKE_TRAIL = 63575,
SPELL_EJECT_ALL_PASSENGERS = 50630, // used by vehicles on death; currently handled by DB linking
// SPELL_EJECT_PASSENGER_4 = 64614,
SPELL_EJECT_PASSENGER_4 = 64614,
SPELL_EJECT_PASSENGER_1 = 60603,
SPELL_LOAD_INTO_CATAPULT = 64414,
SPELL_PASSENGER_LOADED = 62340,
Expand Down Expand Up @@ -121,6 +121,13 @@ enum
SPELL_GRAB_PYRITE = 67372,
SPELL_EJECT_PASSENGER = 67393,

// gauntlet spells
SPELL_DUSTY_EXPLOSION = 63360,
SPELL_DUST_CLOUD_IMPACT = 54740,
SPELL_SPAWN_PYRITE = 62543,
SPELL_COSMETIC_PARACHITE = 56093,
SPELL_ROPE_BEAM = 63605,

// vehicle accessories
//NPC_LEVIATHAN_SEAT = 33114,
NPC_LEVIATHAN_TURRET = 33139,
Expand Down Expand Up @@ -184,6 +191,7 @@ static const float afHodirFury[MAX_HODIR_FURY][3] =
static const float afMimironInferno[3] = {329.1809f, 8.02577f, 410.887f};

static const std::vector<uint32> addEntries = {NPC_LEVIATHAN_SEAT, NPC_LEVIATHAN_TURRET, NPC_DEFENSE_TURRET, NPC_OVERLOAD_DEVICE};
static const std::vector<uint32> playerVehicleEntries = {NPC_SALVAGED_SIEGE_ENGINE, NPC_SALVAGED_SIEGE_TURRET, NPC_SALVAGED_CHOPPER, NPC_SALVAGED_DEMOLISHER, NPC_SALVAGED_DEMOLISHER_SEAT};

/*######
## boss_flame_leviathan
Expand Down Expand Up @@ -275,6 +283,32 @@ struct boss_flame_leviathanAI : public BossAI
}
}

CreatureList playerVehicles;
for (const uint32& entry : playerVehicleEntries)
{
GetCreatureListWithEntryInGrid(playerVehicles, m_creature, entry, 1000.f); // probably very expensive. better solution?
for (auto* add : playerVehicles)
{
if (!add || !add->IsAlive())
continue;
switch (add->GetEntry())
{
case NPC_SALVAGED_SIEGE_ENGINE:
case NPC_SALVAGED_CHOPPER:
add->CastSpell(nullptr, SPELL_EJECT_PASSENGER_1, TRIGGERED_OLD_TRIGGERED);
break;
case NPC_SALVAGED_DEMOLISHER:
add->CastSpell(nullptr, SPELL_EJECT_PASSENGER_4, TRIGGERED_OLD_TRIGGERED);
break;
case NPC_SALVAGED_SIEGE_TURRET:
case NPC_SALVAGED_DEMOLISHER_SEAT:
add->CastSpell(nullptr, SPELL_EJECT_ALL_PASSENGERS, TRIGGERED_OLD_TRIGGERED);
break;
default: break;
}
}
}

// start epilogue event
if (Creature* pFlyMachine = m_creature->SummonCreature(NPC_BRANN_FLYING_MACHINE, 175.2838f, -210.4325f, 501.2375f, 1.42f, TEMPSPAWN_CORPSE_DESPAWN, 0))
{
Expand Down Expand Up @@ -757,7 +791,7 @@ struct npc_liquid_pyriteAI : public Scripted_NoMovementAI
DoCastSpellIfCan(m_creature, SPELL_LIQUID_PYRITE_AURA, CAST_TRIGGERED | CAST_AURA_NOT_PRESENT);
}

void MovementInform(uint32 motionType, uint32 /*value*/)
void MovementInform(uint32 motionType, uint32 /*value*/) override
{
if (motionType != BOARD_VEHICLE_MOTION_TYPE)
return;
Expand All @@ -774,7 +808,7 @@ struct npc_pyrite_safety_containerAI : public Scripted_NoMovementAI
Creature* lift = dynamic_cast<Creature*>(m_creature->GetSpawner());
if (!lift)
return;
m_creature->CastSpell(lift, 63605, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(lift, SPELL_ROPE_BEAM, TRIGGERED_OLD_TRIGGERED);
});
AddCustomAction(1, true, [&]()
{
Expand All @@ -784,9 +818,9 @@ struct npc_pyrite_safety_containerAI : public Scripted_NoMovementAI
ResetTimer(1, 500ms);
return;
}
m_creature->CastSpell(nullptr, 63360, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(nullptr, 54740, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(nullptr, 62543, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(nullptr, SPELL_DUSTY_EXPLOSION, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(nullptr, SPELL_DUST_CLOUD_IMPACT, TRIGGERED_OLD_TRIGGERED);
m_creature->CastSpell(nullptr, SPELL_SPAWN_PYRITE, TRIGGERED_OLD_TRIGGERED);
m_creature->ForcedDespawn(1000);
});
}
Expand Down Expand Up @@ -1069,7 +1103,7 @@ struct ThrowPassenger : public SpellScript

if (caster->GetVehicleInfo())
if (caster->GetVehicleInfo()->GetPassenger(3))
if (seat = static_cast<Unit*>(caster->GetVehicleInfo()->GetPassenger(3)))
if ((seat = static_cast<Unit*>(caster->GetVehicleInfo()->GetPassenger(3))))
if (seat->IsVehicle())
projectile = seat->GetVehicleInfo()->GetPassenger(0);
if (!projectile)
Expand Down Expand Up @@ -1399,7 +1433,7 @@ struct RopeBeam : public AuraScript
Unit* caster = aura->GetCaster();
if (!caster || caster->GetEntry() != 33218)
return;
caster->CastSpell(nullptr, 56093, TRIGGERED_OLD_TRIGGERED);
caster->CastSpell(nullptr, SPELL_COSMETIC_PARACHITE, TRIGGERED_OLD_TRIGGERED);
caster->GetMotionMaster()->MoveFall();
if (caster->AI())
caster->AI()->ResetTimer(1, 500ms);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ enum
// NPC_HIRED_DEMOLITIONIST = 33627,
// NPC_BATTLE_MAGE = 33662,
NPC_SALVAGED_SIEGE_ENGINE = 33060,
NPC_SALVAGED_SIEGE_TURRET = 33067,
NPC_SALVAGED_CHOPPER = 33062,
NPC_SALVAGED_DEMOLISHER = 33109,
NPC_SALVAGED_DEMOLISHER_SEAT= 33167,
// NPC_LIQUID_PYRITE = 33189,

// Razorscale helper npcs
Expand Down

0 comments on commit a6bf96b

Please sign in to comment.