From 74d9cc6c61d48fc9236db5f189d01f891e23ebcd Mon Sep 17 00:00:00 2001 From: insunaa Date: Mon, 15 Jul 2024 15:28:39 +0200 Subject: [PATCH] Leviathan: Fix friendly fire and mulitboarding --- sql/scriptdev2/spell.sql | 4 ++++ .../ulduar/ulduar/boss_flame_leviathan.cpp | 17 +++++++++++++++-- src/game/Entities/Vehicle.cpp | 12 +++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index eb600446c09..bfc831027e7 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -964,10 +964,13 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (62910,'spell_mimirons_inferno_leviathan'), (62912,'spell_thorims_hammer_leviathan'), (62336,'spell_hookshot_aura'), +(62363,'spell_anti_air_rocket'), (62374,'spell_pursue_leviathan'), (62382,'spell_ignis_brittle'), (62399,'spell_overload_circuit'), (62475,'spell_systems_shutdown'), +(62634,'spell_demolisher_mortar'), +(62635,'spell_demolisher_mortar'), (62789,'spell_heart_overload'), (62826,'spell_energy_orb_dummy'), (62828,'spell_recharge_robot'), @@ -1000,6 +1003,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (64568,'spell_blood_reserve_enchant'), (64979,'spell_anti_air_rocket'), (64998,'spell_ready_to_fly'), +(65044,'spell_flames_leviathan'), (65045,'spell_flames_leviathan'), (65121,'spell_searing_light'), (65667,'spell_ignis_heat'), diff --git a/src/game/AI/ScriptDevAI/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp b/src/game/AI/ScriptDevAI/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp index cd946d3653e..c110ddbe9a1 100644 --- a/src/game/AI/ScriptDevAI/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/game/AI/ScriptDevAI/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp @@ -1406,7 +1406,7 @@ struct FreyasWard : public SpellScript } }; -// 65045 - Flames +// 65045, 65044 - Flames struct FlamesLeviathan : public SpellScript { bool OnCheckTarget(const Spell* spell, Unit* target, SpellEffectIndex /*eff*/) const override @@ -1450,7 +1450,7 @@ enum SafetyContainerID : uint32 { NPC_PYRITE_SAFETY_CONTAINER = 33218, }; -// 64979 - Anti-Air Rocket +// 64979, 62363 - Anti-Air Rocket struct AntiAirRocket : public SpellScript { bool OnCheckTarget(const Spell* spell, Unit* target, SpellEffectIndex eff) const override @@ -1464,6 +1464,18 @@ struct AntiAirRocket : public SpellScript } }; +// 62634, 62635 - Mortar +struct DemolisherMortar : public SpellScript +{ + bool OnCheckTarget(const Spell* spell, Unit* target, SpellEffectIndex eff) const override + { + Unit* caster = spell->GetAffectiveCaster(); + if (!caster->IsEnemy(target)) + return false; + return true; + } +}; + // 63605 - Rope Beam struct RopeBeam : public AuraScript { @@ -1562,6 +1574,7 @@ void AddSC_boss_flame_leviathan() RegisterSpellScript("spell_freyas_ward_leviathan"); RegisterSpellScript("spell_ready_to_fly"); RegisterSpellScript("spell_anti_air_rocket"); + RegisterSpellScript("spell_demolisher_mortar"); RegisterSpellScript("spell_rope_beam"); RegisterSpellScript("spell_flame_leviathan_buff"); } diff --git a/src/game/Entities/Vehicle.cpp b/src/game/Entities/Vehicle.cpp index 23661d396ed..83b9dcee829 100644 --- a/src/game/Entities/Vehicle.cpp +++ b/src/game/Entities/Vehicle.cpp @@ -245,6 +245,14 @@ void VehicleInfo::Initialize() vehicle->SetPowerType(Powers(powerEntry->power)); } + // Experimental + if (vehicleFlags & (VEHICLE_FLAG_UNK8 | VEHICLE_FLAG_UNK7)) + { + vehicle->SetCanEnterCombat(false); + if (vehicle->AI()) + vehicle->AI()->SetReactState(REACT_PASSIVE); + } + m_isInitialized = true; } @@ -303,7 +311,9 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat) float lx = 0.f, ly = 0.f, lz = 0.f, lo = 0.f; GetSeatCoordinates(seatEntry, lx, ly, lz); - BoardPassenger(passenger, lx, ly, lz, lo, seat); // Use TransportBase to store the passenger + if(!BoardPassenger(passenger, lx, ly, lz, lo, seat)) // Use TransportBase to store the passenger + return; + if (auto* rootVehicle = static_cast(m_owner)->FindRootVehicle()) passenger->SetRootVehicle(rootVehicle->GetObjectGuid());