Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Leviathan Squashed #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,15 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(59860,'spell_summon_iron_dwarf_aura'),
(59906,'spell_swift_hand_of_justice'),
(59915,'spell_discerning_eye_of_the_beast'),
(60075,'spell_flame_leviathan_buff'),
(60076,'spell_flame_leviathan_buff'),
(60077,'spell_flame_leviathan_buff'),
(60211,'spell_cauterize'),
(60539,'spell_sapphiron_achievement_check'),
(60772,'spell_increased_spell_damage_done_dummy'),
(60775,'spell_increased_spell_damage_done_dummy'),
(60779,'spell_increased_healing_done_dummy'),
(60603,'spell_eject_passenger_1'),
(60929,'spell_loatheb_prewarn'),
(61071,'spell_vortex_aura'),
(61072,'spell_vortex_aura'),
Expand All @@ -925,6 +929,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(61187,'spell_twilight_shift_aura'),
(61190,'spell_twilight_shift_aura'),
(61210,'spell_align_disk_aggro'),
(61242,'spell_parachute_leviathan'),
(61474,'spell_grip_of_sladran'),
(61475,'spell_gundrak_snake_wrap'),
(61546,'spell_shatter'),
Expand All @@ -933,7 +938,17 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(62108,'spell_tails_up_summon_female_frost_leopard'),
(62116,'spell_tails_up_summon_female_icepaw_bear'),
(62138,'spell_teleport_inside_violet_hold'),
(62297,'spell_hodirs_fury_leviathan'),
(62323,'spell_hookshot'),
(62324,'spell_throw_passenger'),
(62907,'spell_freyas_ward_leviathan'),
(62910,'spell_mimirons_inferno_leviathan'),
(62912,'spell_thorims_hammer_leviathan'),
(62336,'spell_hookshot_aura'),
(62374,'spell_pursue_leviathan'),
(62382,'spell_ignis_brittle'),
(62399,'spell_overload_circuit'),
(62475,'spell_systems_shutdown'),
(62789,'spell_heart_overload'),
(62826,'spell_energy_orb_dummy'),
(62828,'spell_recharge_robot'),
Expand All @@ -948,17 +963,25 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(62717,'spell_slag_pot'),
(63474,'spell_ignis_scorch'),
(63482,'spell_lightning_whirl_heroic'),
(63575,'spell_smoke_trail_leviathan'),
(63605,'spell_rope_beam'),
(63618,'spell_overload_leviathan'),
(63845,'spell_create_lance'),
(64203,'spell_void_zone_xt'),
(64209,'spell_consumption_xt'),
(64210,'spell_life_spark_xt'),
(64234,'spell_gravity_bomb'),
(64235,'spell_void_zone_xt'),
(64414,'spell_load_into_catapult_leviathan'),
(64411,'spell_blessing_of_ancient_kings'),
(64415,'spell_valanyr_equip_effect'),
(64475,'spell_ignis_remove_strength'),
(64482,'spell_flame_leviathan_buff'),
(64503,'spell_ignis_water'),
(64568,'spell_blood_reserve_enchant'),
(64979,'spell_anti_air_rocket'),
(64998,'spell_ready_to_fly'),
(65045,'spell_flames_leviathan'),
(65121,'spell_searing_light'),
(65667,'spell_ignis_heat'),
(65869,'spell_disengage'),
Expand All @@ -969,6 +992,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(67009,'spell_nether_power'),
(67114,'spell_ignis_brittle'),
(67322,'spell_burrower_submerge'),
(67372,'spell_grab_crate_leviathan'),
(67470,'spell_pursuing_spikes'),
(67547,'spell_clear_valkyr_essence'),
(67590,'spell_powering_up'),
Expand Down
8 changes: 3 additions & 5 deletions src/game/AI/ScriptDevAI/base/BossAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include "AI/ScriptDevAI/include/sc_creature.h"
#include "AI/ScriptDevAI/include/sc_instance.h"
#include "Entities/Creature.h"
#include "AI/ScriptDevAI/base/BossAI.h"
#include "Spells/Spell.h"
#include "Spells/SpellMgr.h"
#include "AI/ScriptDevAI/ScriptDevAIMgr.h"

Expand Down Expand Up @@ -92,18 +90,18 @@ void BossAI::AddExitObject(uint32 value)

void BossAI::EnterEvadeMode()
{
OpenEntrances();
if (m_instanceDataType == -1)
return;
if (ScriptedInstance* instance = static_cast<ScriptedInstance*>(m_creature->GetInstanceData()))
instance->SetData(m_instanceDataType, FAIL);
OpenEntrances();
if (m_respawnDelay == -1)
{
CombatAI::EnterEvadeMode();
return;
}
m_creature->SetRespawnDelay(m_respawnDelay, true);
m_creature->ForcedDespawn();
m_creature->ForcedDespawn(2000);
}

void BossAI::AddCastOnDeath(QueuedCast cast)
Expand All @@ -114,4 +112,4 @@ void BossAI::AddCastOnDeath(QueuedCast cast)
void BossAI::AddRespawnOnEvade(std::chrono::seconds delay)
{
m_respawnDelay = delay.count();
}
}
13 changes: 11 additions & 2 deletions src/game/AI/ScriptDevAI/base/BossAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#define BOSS_AI_H

#include "AI/ScriptDevAI/include/sc_instance.h"
#include "Entities/Creature.h"
#include "AI/ScriptDevAI/include/sc_creature.h"
#include "Entities/Creature.h"
#include "AI/ScriptDevAI/base/CombatAI.h"

enum InstanceActions
Expand Down Expand Up @@ -54,6 +54,7 @@ class BossAI : public CombatAI
for (auto& id : m_entranceObjects)
instance->DoUseOpenableObject(id, open);
}

void OpenExits()
{
ScriptedInstance* instance = dynamic_cast<ScriptedInstance*>(m_creature->GetInstanceData());
Expand Down Expand Up @@ -112,6 +113,10 @@ class BossAI : public CombatAI
void SetGateDelay(std::chrono::milliseconds delay) { m_gateDelay = delay; }
void EnterEvadeMode() override;

/**
* Adds one or more Spells to cast with CastSpell on creature death
* @param cast Initialized struct of QueuedCast type
*/
void AddCastOnDeath(QueuedCast cast);
template <typename... Targs>
void AddCastOnDeath(QueuedCast cast, Targs... fargs)
Expand All @@ -120,6 +125,10 @@ class BossAI : public CombatAI
AddCastOnDeath(fargs...);
}

/**
* Adds a timer to respawn the Creature on Evade (instead of walking back to spawn)
* @param delay The amount of time until the Creature is supposed to respawn as a std::chrono literal
*/
void AddRespawnOnEvade(std::chrono::seconds delay);

std::chrono::seconds TimeSinceEncounterStart()
Expand Down Expand Up @@ -147,4 +156,4 @@ class BossAI : public CombatAI
std::chrono::steady_clock::time_point m_combatStartTimestamp;
};

#endif
#endif
Loading