refactor(Scripts/Northrend): dungeons Spell Scripts registry macros (#19134)

* instance_azjol_nerub spell:spell_azjol_nerub_fixate

* instance_azjol_nerub aura:spell_azjol_nerub_web_wrap_aura

* boss_hadronox aura:spell_hadronox_summon_periodic_aura

* boss_hadronox aura:spell_hadronox_leech_poison_aura

* boss_argent_challenge spell:spell_eadric_radiance

* boss_argent_challenge spell:spell_toc5_light_rain

* boss_argent_challenge aura:spell_reflective_shield_aura

* fixup! boss_argent_challenge aura:spell_reflective_shield_aura

* instance_drak_tharon_keep aura:spell_dtk_raise_dead_aura

* instance_drak_tharon_keep spell:spell_dtk_summon_random_drakkari

* boss_trollgore spell:spell_trollgore_consume

* boss_trollgore aura:spell_trollgore_corpse_explode_aura

* boss_trollgore spell:spell_trollgore_invader_taunt

* boss_novos spell:spell_novos_despawn_crystal_handler

* boss_novos aura:spell_novos_crystal_handler_death_aura

* boss_novos spell:spell_novos_summon_minions

* boss_tharon_ja aura:spell_tharon_ja_curse_of_life_aura

* boss_tharon_ja aura:spell_tharon_ja_dummy_aura

* boss_tharon_ja spell:spell_tharon_ja_clear_gift_of_tharon_ja

* boss_dred aura:spell_dred_grievious_bite_aura

* boss_dred spell:spell_dred_raptor_call

* boss_moorabi aura:spell_moorabi_mojo_frenzy_aura

* boss_slad_ran aura:spell_sladran_grip_of_sladran_aura

* boss_drakkari_colossus spell:spell_drakkari_colossus_emerge

* boss_drakkari_colossus spell:spell_drakkari_colossus_surge

* boss_drakkari_colossus spell:spell_drakkari_colossus_face_me

* boss_gal_darah spell:spell_galdarah_impaling_charge

* boss_gal_darah spell:spell_galdarah_transform

* boss_malygos spell:spell_eoe_ph3_surge_of_power

* oculus aura:spell_oculus_stop_time_aura

* oculus aura:spell_oculus_evasive_maneuvers_aura

* oculus spell:spell_oculus_shock_lance

* oculus aura:spell_oculus_temporal_rift_aura

* oculus spell:spell_oculus_touch_the_nightmare

* oculus aura:spell_oculus_dream_funnel_aura

* oculus spell:spell_oculus_call_ruby_emerald_amber_drake

* oculus aura:spell_oculus_ride_ruby_emerald_amber_drake_que_aura

* oculus aura:spell_oculus_evasive_charges_aura

* oculus aura:spell_oculus_soar_aura

* oculus aura:spell_oculus_rider_aura

* oculus aura:spell_oculus_drake_flag_aura

* boss_magus_telestra aura:spell_boss_magus_telestra_summon_telestra_clones_aura

* boss_magus_telestra spell:spell_boss_magus_telestra_gravity_well

* utgarde_keep aura:spell_ticking_time_bomb_aura

* boss_keleseth aura:spell_frost_tomb_aura

* boss_svala pair:spell_svala_ritual_strike

* boss_moragg aura:spell_optic_link_aura

* violet_hold aura:spell_destroy_door_seal_aura

* forge_of_souls aura:spell_shield_of_bones_aura

* boss_devourer_of_souls aura:spell_wailing_souls_periodic_aura

* boss_bronjahm spell:spell_bronjahm_magic_bane

* boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* boss_bronjahm spell:spell_bronjahm_soulstorm_targeting

* boss_krickandick aura:spell_krick_explosive_barrage_aura

* boss_krickandick aura:spell_exploding_orb_auto_grow_aura

* pit_of_saron aura:spell_pos_empowered_blizzard_aura

* pit_of_saron spell:spell_pos_slave_trigger_closest

* pit_of_saron spell:spell_pos_rimefang_frost_nova

* pit_of_saron aura:spell_pos_blight_aura

* pit_of_saron aura:spell_pos_glacial_strike_aura

* boss_forgemaster_garfrost spell:spell_garfrost_permafrost

* halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* boss_marwyn aura:spell_hor_shared_suffering_aura

* fixup! forge_of_souls aura:spell_shield_of_bones_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* fixup! pit_of_saron aura:spell_pos_empowered_blizzard_aura

* fixup! halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* fixup! boss_marwyn aura:spell_hor_shared_suffering_aura
This commit is contained in:
Jelle Meeus
2024-06-23 19:17:19 +02:00
committed by GitHub
parent b055faf8ee
commit cd9dff5032
29 changed files with 1282 additions and 1765 deletions
@@ -0,0 +1,37 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_azjol_nerub_web_wrap_aura' WHERE `spell_id`=52086;
UPDATE `spell_script_names` SET `ScriptName`='spell_hadronox_summon_periodic_crypt_fiend_aura' WHERE `spell_id`=53037;
UPDATE `spell_script_names` SET `ScriptName`='spell_hadronox_leech_poison_aura' WHERE `spell_id` IN (53030,59417);
UPDATE `spell_script_names` SET `ScriptName`='spell_reflective_shield_aura' WHERE `spell_id`=66515;
UPDATE `spell_script_names` SET `ScriptName`='spell_dtk_raise_dead_aura' WHERE `spell_id` IN (48597,48605);
UPDATE `spell_script_names` SET `ScriptName`='spell_trollgore_corpse_explode_aura' WHERE `spell_id` IN (49555,59807);
UPDATE `spell_script_names` SET `ScriptName`='spell_novos_crystal_handler_death_aura' WHERE `spell_id`=47336;
UPDATE `spell_script_names` SET `ScriptName`='spell_tharon_ja_curse_of_life_aura' WHERE `spell_id` IN (49527,59972);
UPDATE `spell_script_names` SET `ScriptName`='spell_tharon_ja_dummy_aura' WHERE `spell_id`=49551;
UPDATE `spell_script_names` SET `ScriptName`='spell_dred_grievious_bite_aura' WHERE `spell_id`=48920;
UPDATE `spell_script_names` SET `ScriptName`='spell_moorabi_mojo_frenzy_aura' WHERE `spell_id`=55163;
UPDATE `spell_script_names` SET `ScriptName`='spell_sladran_grip_of_sladran_aura' WHERE `spell_id`=55093;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_stop_time_aura' WHERE `spell_id`=49838;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_evasive_maneuvers_aura' WHERE `spell_id`=50240;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_temporal_rift_aura' WHERE `spell_id`=49592;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_dream_funnel_aura' WHERE `spell_id`=50344;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_ride_ruby_emerald_amber_drake_que_aura' WHERE `spell_id` IN (49427,49459,49463);
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_evasive_charges_aura' WHERE `spell_id`=50241;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_soar_aura' WHERE `spell_id`=50325;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_drake_flag_aura' WHERE `spell_id`=53797;
UPDATE `spell_script_names` SET `ScriptName`='spell_boss_magus_telestra_summon_telestra_clones_aura' WHERE `spell_id`=47710;
UPDATE `spell_script_names` SET `ScriptName`='spell_ticking_time_bomb_aura' WHERE `spell_id`=59686;
UPDATE `spell_script_names` SET `ScriptName`='spell_frost_tomb_aura' WHERE `spell_id`=42672;
UPDATE `spell_script_names` SET `ScriptName`='spell_optic_link_aura' WHERE `spell_id`=54396;
UPDATE `spell_script_names` SET `ScriptName`='spell_destroy_door_seal_aura' WHERE `spell_id`=58040;
UPDATE `spell_script_names` SET `ScriptName`='spell_shield_of_bones_aura' WHERE `spell_id` IN (69069,70207);
UPDATE `spell_script_names` SET `ScriptName`='spell_wailing_souls_periodic_aura' WHERE `spell_id`=68875;
UPDATE `spell_script_names` SET `ScriptName`='spell_bronjahm_soulstorm_channel_ooc_aura' WHERE `spell_id`=69008;
UPDATE `spell_script_names` SET `ScriptName`='spell_bronjahm_soulstorm_visual_aura' WHERE `spell_id`=68870;
UPDATE `spell_script_names` SET `ScriptName`='spell_krick_explosive_barrage_aura' WHERE `spell_id`=69012;
UPDATE `spell_script_names` SET `ScriptName`='spell_exploding_orb_auto_grow_aura' WHERE `spell_id`=69020;
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_empowered_blizzard_aura' WHERE `spell_id`=70132;
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_blight_aura' WHERE `spell_id` IN (69603,69604,70285,70286);
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_glacial_strike_aura' WHERE `spell_id` IN (70292,71316,71317);
UPDATE `spell_script_names` SET `ScriptName`='spell_hor_gunship_cannon_fire_aura' WHERE `spell_id`=70017;
UPDATE `spell_script_names` SET `ScriptName`='spell_hor_shared_suffering_aura' WHERE `spell_id` IN (72368,72369);
@@ -323,50 +323,41 @@ public:
} }
}; };
class spell_hadronox_summon_periodic : public SpellScriptLoader class spell_hadronox_summon_periodic_aura : public AuraScript
{ {
PrepareAuraScript(spell_hadronox_summon_periodic_aura);
public: public:
spell_hadronox_summon_periodic(const char* name, uint32 delay, uint32 spellEntry) : SpellScriptLoader(name), _delay(delay), _spellEntry(spellEntry) { } spell_hadronox_summon_periodic_aura(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { }
class spell_hadronox_summon_periodic_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
public: return ValidateSpellInfo({ SPELL_WEB_FRONT_DOORS });
spell_hadronox_summon_periodic_AuraScript(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { } }
PrepareAuraScript(spell_hadronox_summon_periodic_AuraScript);
void HandlePeriodic(AuraEffect const* /*aurEff*/) void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* owner = GetUnitOwner();
if (InstanceScript* instance = owner->GetInstanceScript())
if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE)
{
if (!owner->HasAura(SPELL_WEB_FRONT_DOORS))
owner->CastSpell(owner, _spellEntry, true);
else if (!instance->IsEncounterInProgress())
owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS);
}
}
void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes)
{
GetAura()->GetEffect(auraEffect->GetEffIndex())->SetPeriodicTimer(_delay);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hadronox_summon_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_hadronox_summon_periodic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
uint32 _delay;
uint32 _spellEntry;
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hadronox_summon_periodic_AuraScript(_delay, _spellEntry); PreventDefaultAction();
Unit* owner = GetUnitOwner();
if (InstanceScript* instance = owner->GetInstanceScript())
if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE)
{
if (!owner->HasAura(SPELL_WEB_FRONT_DOORS))
owner->CastSpell(owner, _spellEntry, true);
else if (!instance->IsEncounterInProgress())
owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS);
}
}
void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes)
{
GetAura()->GetEffect(auraEffect->GetEffIndex())->SetPeriodicTimer(_delay);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hadronox_summon_periodic_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_hadronox_summon_periodic_aura::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
private: private:
@@ -374,31 +365,25 @@ private:
uint32 _spellEntry; uint32 _spellEntry;
}; };
class spell_hadronox_leech_poison : public SpellScriptLoader class spell_hadronox_leech_poison_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_hadronox_leech_poison_aura);
spell_hadronox_leech_poison() : SpellScriptLoader("spell_hadronox_leech_poison") { }
class spell_hadronox_leech_poison_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_hadronox_leech_poison_AuraScript) return ValidateSpellInfo({ SPELL_LEECH_POISON_HEAL });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hadronox_leech_poison_AuraScript(); if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -422,10 +407,10 @@ void AddSC_boss_hadronox()
{ {
new boss_hadronox(); new boss_hadronox();
new npc_anub_ar_crusher(); new npc_anub_ar_crusher();
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION); RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION);
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER); RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER);
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND); RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND);
new spell_hadronox_leech_poison(); RegisterSpellScript(spell_hadronox_leech_poison_aura);
new achievement_hadronox_denied(); new achievement_hadronox_denied();
} }
@@ -114,65 +114,48 @@ public:
} }
}; };
class spell_azjol_nerub_fixate : public SpellScriptLoader class spell_azjol_nerub_fixate : public SpellScript
{ {
public: PrepareSpellScript(spell_azjol_nerub_fixate);
spell_azjol_nerub_fixate() : SpellScriptLoader("spell_azjol_nerub_fixate") { }
class spell_azjol_nerub_fixate_SpellScript : public SpellScript void HandleScriptEffect(SpellEffIndex effIndex)
{ {
PrepareSpellScript(spell_azjol_nerub_fixate_SpellScript); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), GetEffectValue(), true);
}
void HandleScriptEffect(SpellEffIndex effIndex) void Register() override
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), GetEffectValue(), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_fixate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_azjol_nerub_fixate_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_fixate::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_azjol_nerub_web_wrap : public SpellScriptLoader class spell_azjol_nerub_web_wrap_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_azjol_nerub_web_wrap_aura);
spell_azjol_nerub_web_wrap() : SpellScriptLoader("spell_azjol_nerub_web_wrap") { }
class spell_azjol_nerub_web_wrap_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_azjol_nerub_web_wrap_AuraScript); return ValidateSpellInfo({ SPELL_WEB_WRAP_TRIGGER });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER))
target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_azjol_nerub_web_wrap_AuraScript(); Unit* target = GetTarget();
if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER))
target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_aura::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
} }
}; };
void AddSC_instance_azjol_nerub() void AddSC_instance_azjol_nerub()
{ {
new instance_azjol_nerub(); new instance_azjol_nerub();
new spell_azjol_nerub_fixate(); RegisterSpellScript(spell_azjol_nerub_fixate);
new spell_azjol_nerub_web_wrap(); RegisterSpellScript(spell_azjol_nerub_web_wrap_aura);
} }
@@ -734,104 +734,81 @@ public:
} }
}; };
class spell_eadric_radiance : public SpellScriptLoader class spell_eadric_radiance : public SpellScript
{ {
public: PrepareSpellScript(spell_eadric_radiance);
spell_eadric_radiance() : SpellScriptLoader("spell_eadric_radiance") { }
class spell_eadric_radiance_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_eadric_radiance_SpellScript); std::list<WorldObject*> tmplist;
for( std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
if( (*itr)->ToUnit()->HasInArc(M_PI, GetCaster()) )
tmplist.push_back(*itr);
void FilterTargets(std::list<WorldObject*>& targets) targets.clear();
{ for( std::list<WorldObject*>::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr )
std::list<WorldObject*> tmplist; targets.push_back(*itr);
for( std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) }
if( (*itr)->ToUnit()->HasInArc(M_PI, GetCaster()) )
tmplist.push_back(*itr);
targets.clear(); void Register() override
for( std::list<WorldObject*>::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr )
targets.push_back(*itr);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_eadric_radiance_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
class spell_toc5_light_rain : public SpellScriptLoader class spell_toc5_light_rain : public SpellScript
{ {
public: PrepareSpellScript(spell_toc5_light_rain);
spell_toc5_light_rain() : SpellScriptLoader("spell_toc5_light_rain") { }
class spell_toc5_light_rain_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_toc5_light_rain_SpellScript); for( std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); )
void FilterTargets(std::list<WorldObject*>& targets)
{ {
for( std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ) if ((*itr)->GetTypeId() == TYPEID_UNIT)
{ if ((*itr)->ToCreature()->GetEntry() == NPC_FOUNTAIN_OF_LIGHT)
if ((*itr)->GetTypeId() == TYPEID_UNIT)
if ((*itr)->ToCreature()->GetEntry() == NPC_FOUNTAIN_OF_LIGHT)
{
targets.erase(itr);
itr = targets.begin();
continue;
}
++itr;
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc5_light_rain_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_toc5_light_rain_SpellScript();
}
};
class spell_reflective_shield : public SpellScriptLoader
{
public:
spell_reflective_shield() : SpellScriptLoader("spell_reflective_shield") { }
class spell_reflective_shield_AuraScript : public AuraScript
{
PrepareAuraScript(spell_reflective_shield_AuraScript)
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
if( Unit* attacker = dmgInfo.GetAttacker() )
if( GetOwner() && attacker->GetGUID() != GetOwner()->GetGUID() )
{ {
int32 damage = (int32)(absorbAmount * 0.25f); targets.erase(itr);
GetOwner()->ToUnit()->CastCustomSpell(attacker, 33619, &damage, nullptr, nullptr, true); itr = targets.begin();
continue;
} }
++itr;
} }
}
void Register() override void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_reflective_shield_AuraScript::HandleAfterEffectAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_reflective_shield_AuraScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc5_light_rain::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
enum ReflectiveShield
{
SPELL_REFLECTIVE_SHIELD_DAMAGE = 33619
};
class spell_reflective_shield_aura : public AuraScript
{
PrepareAuraScript(spell_reflective_shield_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_DAMAGE });
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
if( Unit* attacker = dmgInfo.GetAttacker() )
if( GetOwner() && attacker->GetGUID() != GetOwner()->GetGUID() )
{
int32 damage = (int32)(absorbAmount * 0.25f);
GetOwner()->ToUnit()->CastCustomSpell(attacker, SPELL_REFLECTIVE_SHIELD_DAMAGE, &damage, nullptr, nullptr, true);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_reflective_shield_aura::HandleAfterEffectAbsorb, EFFECT_0);
} }
}; };
@@ -841,8 +818,8 @@ void AddSC_boss_argent_challenge()
new boss_paletress(); new boss_paletress();
new npc_memory(); new npc_memory();
new npc_argent_soldier(); new npc_argent_soldier();
new spell_eadric_radiance(); RegisterSpellScript(spell_eadric_radiance);
new spell_toc5_light_rain(); RegisterSpellScript(spell_toc5_light_rain);
new spell_reflective_shield(); RegisterSpellScript(spell_reflective_shield_aura);
} }
@@ -155,60 +155,38 @@ public:
}; };
}; };
class spell_dred_grievious_bite : public SpellScriptLoader class spell_dred_grievious_bite_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_dred_grievious_bite_aura);
spell_dred_grievious_bite() : SpellScriptLoader("spell_dred_grievious_bite") { }
class spell_dred_grievious_bite_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_dred_grievious_bite_AuraScript); if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth())
{
PreventDefaultAction();
SetDuration(0);
}
}
void OnPeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth())
{
PreventDefaultAction();
SetDuration(0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dred_grievious_bite_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_dred_grievious_bite_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_dred_grievious_bite_aura::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
class spell_dred_raptor_call : public SpellScriptLoader class spell_dred_raptor_call : public SpellScript
{ {
public: PrepareSpellScript(spell_dred_raptor_call);
spell_dred_raptor_call() : SpellScriptLoader("spell_dred_raptor_call") { }
class spell_dred_raptor_call_SpellScript : public SpellScript void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_dred_raptor_call_SpellScript); GetCaster()->SummonCreature(RAND(NPC_DRAKKARI_GUTRIPPER, NPC_DRAKKARI_SCYTHECLAW), -522.02f, -718.89f, 30.26f, 2.41f);
}
void HandleDummy(SpellEffIndex /*effIndex*/) void Register() override
{
GetCaster()->SummonCreature(RAND(NPC_DRAKKARI_GUTRIPPER, NPC_DRAKKARI_SCYTHECLAW), -522.02f, -718.89f, 30.26f, 2.41f);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dred_raptor_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_dred_raptor_call_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_dred_raptor_call::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
@@ -231,7 +209,7 @@ public:
void AddSC_boss_dred() void AddSC_boss_dred()
{ {
new boss_dred(); new boss_dred();
new spell_dred_grievious_bite(); RegisterSpellScript(spell_dred_grievious_bite_aura);
new spell_dred_raptor_call(); RegisterSpellScript(spell_dred_raptor_call);
new achievement_better_off_dred(); new achievement_better_off_dred();
} }
@@ -268,85 +268,62 @@ public:
} }
}; };
class spell_novos_despawn_crystal_handler : public SpellScriptLoader class spell_novos_despawn_crystal_handler : public SpellScript
{ {
public: PrepareSpellScript(spell_novos_despawn_crystal_handler);
spell_novos_despawn_crystal_handler() : SpellScriptLoader("spell_novos_despawn_crystal_handler") { }
class spell_novos_despawn_crystal_handler_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_novos_despawn_crystal_handler_SpellScript); return ValidateSpellInfo({ SPELL_BEAM_CHANNEL });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_BEAM_CHANNEL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_novos_despawn_crystal_handler_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_novos_despawn_crystal_handler_SpellScript(); if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_BEAM_CHANNEL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_novos_despawn_crystal_handler::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_novos_crystal_handler_death : public SpellScriptLoader class spell_novos_crystal_handler_death_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_novos_crystal_handler_death_aura);
spell_novos_crystal_handler_death() : SpellScriptLoader("spell_novos_crystal_handler_death") { }
class spell_novos_crystal_handler_death_AuraScript : public AuraScript void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_novos_crystal_handler_death_AuraScript) GetUnitOwner()->InterruptNonMeleeSpells(false);
if (GameObject* crystal = GetUnitOwner()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, 5.0f))
crystal->SetGoState(GO_STATE_READY);
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void Register() override
{
GetUnitOwner()->InterruptNonMeleeSpells(false);
if (GameObject* crystal = GetUnitOwner()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, 5.0f))
crystal->SetGoState(GO_STATE_READY);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_novos_crystal_handler_death_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_novos_crystal_handler_death_AuraScript(); OnEffectApply += AuraEffectApplyFn(spell_novos_crystal_handler_death_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_novos_summon_minions : public SpellScriptLoader class spell_novos_summon_minions : public SpellScript
{ {
public: PrepareSpellScript(spell_novos_summon_minions);
spell_novos_summon_minions() : SpellScriptLoader("spell_novos_summon_minions") { }
class spell_novos_summon_minions_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_novos_summon_minions_SpellScript); return ValidateSpellInfo({ SPELL_COPY_OF_SUMMON_MINIONS });
}
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{
for (uint8 i = 0; i < 4; ++i)
GetCaster()->CastSpell((Unit*)nullptr, SPELL_COPY_OF_SUMMON_MINIONS, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_novos_summon_minions_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_novos_summon_minions_SpellScript(); for (uint8 i = 0; i < 4; ++i)
GetCaster()->CastSpell((Unit*)nullptr, SPELL_COPY_OF_SUMMON_MINIONS, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_novos_summon_minions::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
@@ -364,8 +341,8 @@ public:
void AddSC_boss_novos() void AddSC_boss_novos()
{ {
new boss_novos(); new boss_novos();
new spell_novos_despawn_crystal_handler(); RegisterSpellScript(spell_novos_despawn_crystal_handler);
new spell_novos_crystal_handler_death(); RegisterSpellScript(spell_novos_crystal_handler_death_aura);
new spell_novos_summon_minions(); RegisterSpellScript(spell_novos_summon_minions);
new achievement_oh_novos(); new achievement_oh_novos();
} }
@@ -208,107 +208,79 @@ public:
}; };
}; };
class spell_tharon_ja_curse_of_life : public SpellScriptLoader class spell_tharon_ja_curse_of_life_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_tharon_ja_curse_of_life_aura);
spell_tharon_ja_curse_of_life() : SpellScriptLoader("spell_tharon_ja_curse_of_life") { }
class spell_tharon_ja_curse_of_life_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_tharon_ja_curse_of_life_AuraScript); if (GetUnitOwner()->HealthBelowPct(50))
void OnPeriodic(AuraEffect const* /*aurEff*/)
{ {
if (GetUnitOwner()->HealthBelowPct(50)) PreventDefaultAction();
{ SetDuration(0);
PreventDefaultAction();
SetDuration(0);
}
} }
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_tharon_ja_curse_of_life_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_tharon_ja_curse_of_life_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_tharon_ja_curse_of_life_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
class spell_tharon_ja_dummy : public SpellScriptLoader class spell_tharon_ja_dummy_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_tharon_ja_dummy_aura);
spell_tharon_ja_dummy() : SpellScriptLoader("spell_tharon_ja_dummy") { }
class spell_tharon_ja_dummy_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_tharon_ja_dummy_AuraScript) return ValidateSpellInfo({ SPELL_FLESH_VISUAL, SPELL_GIFT_OF_THARON_JA, SPELL_TURN_BONES });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLESH_VISUAL, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_GIFT_OF_THARON_JA, true);
GetUnitOwner()->SetDisplayId(GetUnitOwner()->GetNativeDisplayId() + 1);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
GetUnitOwner()->GetThreatMgr().ResetAllThreat();
GetUnitOwner()->GetMotionMaster()->Clear();
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_tharon_ja_dummy_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_tharon_ja_dummy_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_tharon_ja_dummy_AuraScript(); PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLESH_VISUAL, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_GIFT_OF_THARON_JA, true);
GetUnitOwner()->SetDisplayId(GetUnitOwner()->GetNativeDisplayId() + 1);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
GetUnitOwner()->GetThreatMgr().ResetAllThreat();
GetUnitOwner()->GetMotionMaster()->Clear();
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_tharon_ja_dummy_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_tharon_ja_dummy_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScriptLoader class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScript
{ {
public: PrepareSpellScript(spell_tharon_ja_clear_gift_of_tharon_ja);
spell_tharon_ja_clear_gift_of_tharon_ja() : SpellScriptLoader("spell_tharon_ja_clear_gift_of_tharon_ja") { }
class spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript : public SpellScript void HandleScript(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript); if (Unit* target = GetHitUnit())
target->RemoveAura(SPELL_GIFT_OF_THARON_JA);
}
void HandleScript(SpellEffIndex /*effIndex*/) void Register() override
{
if (Unit* target = GetHitUnit())
target->RemoveAura(SPELL_GIFT_OF_THARON_JA);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_tharon_ja_clear_gift_of_tharon_ja::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
void AddSC_boss_tharon_ja() void AddSC_boss_tharon_ja()
{ {
new boss_tharon_ja(); new boss_tharon_ja();
new spell_tharon_ja_curse_of_life(); RegisterSpellScript(spell_tharon_ja_curse_of_life_aura);
new spell_tharon_ja_dummy(); RegisterSpellScript(spell_tharon_ja_dummy_aura);
new spell_tharon_ja_clear_gift_of_tharon_ja(); RegisterSpellScript(spell_tharon_ja_clear_gift_of_tharon_ja);
} }
@@ -171,92 +171,69 @@ public:
} }
}; };
class spell_trollgore_consume : public SpellScriptLoader class spell_trollgore_consume : public SpellScript
{ {
public: PrepareSpellScript(spell_trollgore_consume);
spell_trollgore_consume() : SpellScriptLoader("spell_trollgore_consume") { }
class spell_trollgore_consume_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_trollgore_consume_SpellScript); return ValidateSpellInfo({ SPELL_CONSUME_AURA });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_CONSUME_AURA, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_trollgore_consume_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_trollgore_consume_SpellScript(); if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_CONSUME_AURA, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_trollgore_consume::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_trollgore_corpse_explode : public SpellScriptLoader class spell_trollgore_corpse_explode_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_trollgore_corpse_explode_aura);
spell_trollgore_corpse_explode() : SpellScriptLoader("spell_trollgore_corpse_explode") { }
class spell_trollgore_corpse_explode_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_trollgore_corpse_explode_AuraScript); return ValidateSpellInfo({ SPELL_CORPSE_EXPLODE_DAMAGE });
}
void PeriodicTick(AuraEffect const* aurEff) void PeriodicTick(AuraEffect const* aurEff)
{
if (aurEff->GetTickNumber() == 2)
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* target = GetTarget()->ToCreature())
target->DespawnOrUnsummon(1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_trollgore_corpse_explode_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
AfterEffectRemove += AuraEffectRemoveFn(spell_trollgore_corpse_explode_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_trollgore_corpse_explode_AuraScript(); if (aurEff->GetTickNumber() == 2)
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* target = GetTarget()->ToCreature())
target->DespawnOrUnsummon(1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_trollgore_corpse_explode_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
AfterEffectRemove += AuraEffectRemoveFn(spell_trollgore_corpse_explode_aura::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_trollgore_invader_taunt : public SpellScriptLoader class spell_trollgore_invader_taunt : public SpellScript
{ {
public: PrepareSpellScript(spell_trollgore_invader_taunt);
spell_trollgore_invader_taunt() : SpellScriptLoader("spell_trollgore_invader_taunt") { }
class spell_trollgore_invader_taunt_SpellScript : public SpellScript void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_trollgore_invader_taunt_SpellScript); if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void Register() override
{
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_trollgore_invader_taunt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_trollgore_invader_taunt_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_trollgore_invader_taunt::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
@@ -279,8 +256,8 @@ public:
void AddSC_boss_trollgore() void AddSC_boss_trollgore()
{ {
new boss_trollgore(); new boss_trollgore();
new spell_trollgore_consume(); RegisterSpellScript(spell_trollgore_consume);
new spell_trollgore_corpse_explode(); RegisterSpellScript(spell_trollgore_corpse_explode_aura);
new spell_trollgore_invader_taunt(); RegisterSpellScript(spell_trollgore_invader_taunt);
new achievement_consumption_junction(); new achievement_consumption_junction();
} }
@@ -77,67 +77,50 @@ public:
} }
}; };
class spell_dtk_raise_dead : public SpellScriptLoader class spell_dtk_raise_dead_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_dtk_raise_dead_aura);
spell_dtk_raise_dead() : SpellScriptLoader("spell_dtk_raise_dead") { }
class spell_dtk_raise_dead_AuraScript : public AuraScript bool Load() override
{ {
PrepareAuraScript(spell_dtk_raise_dead_AuraScript) return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
bool Load() override void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1);
GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner());
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_dtk_raise_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_dtk_raise_dead_AuraScript(); GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1);
GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner());
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_dtk_raise_dead_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_dtk_summon_random_drakkari : public SpellScriptLoader class spell_dtk_summon_random_drakkari : public SpellScript
{ {
public: PrepareSpellScript(spell_dtk_summon_random_drakkari);
spell_dtk_summon_random_drakkari() : SpellScriptLoader("spell_dtk_summon_random_drakkari") { }
class spell_dtk_summon_random_drakkari_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_dtk_summon_random_drakkari_SpellScript); return ValidateSpellInfo({ SPELL_SUMMON_DRAKKARI_SHAMAN, SPELL_SUMMON_DRAKKARI_GUARDIAN });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_DRAKKARI_SHAMAN, SPELL_SUMMON_DRAKKARI_GUARDIAN), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dtk_summon_random_drakkari_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_dtk_summon_random_drakkari_SpellScript(); GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_DRAKKARI_SHAMAN, SPELL_SUMMON_DRAKKARI_GUARDIAN), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dtk_summon_random_drakkari::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
void AddSC_instance_drak_tharon_keep() void AddSC_instance_drak_tharon_keep()
{ {
new instance_drak_tharon_keep(); new instance_drak_tharon_keep();
new spell_dtk_raise_dead(); RegisterSpellScript(spell_dtk_raise_dead_aura);
new spell_dtk_summon_random_drakkari(); RegisterSpellScript(spell_dtk_summon_random_drakkari);
} }
@@ -47,6 +47,7 @@ enum eSpells
SPELL_TELEPORT_VISUAL = 52096, SPELL_TELEPORT_VISUAL = 52096,
SPELL_SOULSTORM_VISUAL = 68870, SPELL_SOULSTORM_VISUAL = 68870,
SPELL_SOULSTORM_VISUAL2 = 68904,
SPELL_SOULSTORM = 68872, SPELL_SOULSTORM = 68872,
}; };
@@ -263,136 +264,102 @@ public:
} }
}; };
class spell_bronjahm_magic_bane : public SpellScriptLoader class spell_bronjahm_magic_bane : public SpellScript
{ {
public: PrepareSpellScript(spell_bronjahm_magic_bane);
spell_bronjahm_magic_bane() : SpellScriptLoader("spell_bronjahm_magic_bane") { }
class spell_bronjahm_magic_bane_SpellScript : public SpellScript void RecalculateDamage()
{ {
PrepareSpellScript(spell_bronjahm_magic_bane_SpellScript); if (GetHitUnit()->getPowerType() != POWER_MANA)
return;
void RecalculateDamage() if (Unit* caster = GetCaster())
{ {
if (GetHitUnit()->getPowerType() != POWER_MANA) const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000;
return; int32 newDamage = GetHitDamage();
newDamage += GetHitUnit()->GetMaxPower(POWER_MANA) / 2;
newDamage = std::min<int32>(maxDamage, newDamage);
if (Unit* caster = GetCaster()) SetHitDamage(newDamage);
{
const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000;
int32 newDamage = GetHitDamage();
newDamage += GetHitUnit()->GetMaxPower(POWER_MANA) / 2;
newDamage = std::min<int32>(maxDamage, newDamage);
SetHitDamage(newDamage);
}
} }
}
void Register() override void Register() override
{
OnHit += SpellHitFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_bronjahm_magic_bane_SpellScript(); OnHit += SpellHitFn(spell_bronjahm_magic_bane::RecalculateDamage);
} }
}; };
class spell_bronjahm_soulstorm_channel_ooc : public SpellScriptLoader class spell_bronjahm_soulstorm_channel_ooc_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_aura);
spell_bronjahm_soulstorm_channel_ooc() : SpellScriptLoader("spell_bronjahm_soulstorm_channel_ooc") { }
class spell_bronjahm_soulstorm_channel_ooc_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_AuraScript); return ValidateSpellInfo({ SPELL_SOULSTORM_VISUAL2, SPELL_SOULSTORM_VISUAL2+1, SPELL_SOULSTORM_VISUAL2+2, SPELL_SOULSTORM_VISUAL2+3 });
}
void HandlePeriodicTick(AuraEffect const* aurEff) void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), 68904 + (aurEff->GetTickNumber() % 4), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_bronjahm_soulstorm_channel_ooc_AuraScript(); PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), SPELL_SOULSTORM_VISUAL2 + (aurEff->GetTickNumber() % 4), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_bronjahm_soulstorm_visual : public SpellScriptLoader class spell_bronjahm_soulstorm_visual_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_bronjahm_soulstorm_visual_aura);
spell_bronjahm_soulstorm_visual() : SpellScriptLoader("spell_bronjahm_soulstorm_visual") { }
class spell_bronjahm_soulstorm_visual_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript); return ValidateSpellInfo({ 68886, 68896, 68897, 68898 });
}
void HandlePeriodicTick(AuraEffect const* aurEff) void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
uint32 spellId = 0;
switch (aurEff->GetTickNumber() % 4)
{
case 0:
spellId = 68886;
break;
case 1:
spellId = 68896;
break;
case 2:
spellId = 68897;
break;
case 3:
spellId = 68898;
break;
}
GetTarget()->CastSpell(GetTarget(), spellId, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_bronjahm_soulstorm_visual_AuraScript(); PreventDefaultAction();
uint32 spellId = 0;
switch (aurEff->GetTickNumber() % 4)
{
case 0:
spellId = 68886;
break;
case 1:
spellId = 68896;
break;
case 2:
spellId = 68897;
break;
case 3:
spellId = 68898;
break;
}
GetTarget()->CastSpell(GetTarget(), spellId, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader class spell_bronjahm_soulstorm_targeting : public SpellScript
{ {
public: PrepareSpellScript(spell_bronjahm_soulstorm_targeting);
spell_bronjahm_soulstorm_targeting() : SpellScriptLoader("spell_bronjahm_soulstorm_targeting") { }
class spell_bronjahm_soulstorm_targeting_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript); targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false));
}
void FilterTargets(std::list<WorldObject*>& targets) void Register() override
{
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_bronjahm_soulstorm_targeting_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
} }
}; };
@@ -401,9 +368,9 @@ void AddSC_boss_bronjahm()
new boss_bronjahm(); new boss_bronjahm();
new npc_fos_corrupted_soul_fragment(); new npc_fos_corrupted_soul_fragment();
new spell_bronjahm_magic_bane(); RegisterSpellScript(spell_bronjahm_magic_bane);
new spell_bronjahm_soulstorm_channel_ooc(); RegisterSpellScript(spell_bronjahm_soulstorm_channel_ooc_aura);
new spell_bronjahm_soulstorm_visual(); RegisterSpellScript(spell_bronjahm_soulstorm_visual_aura);
new spell_bronjahm_soulstorm_targeting(); RegisterSpellScript(spell_bronjahm_soulstorm_targeting);
} }
@@ -308,73 +308,67 @@ public:
} }
}; };
class spell_wailing_souls_periodic : public SpellScriptLoader class spell_wailing_souls_periodic_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_wailing_souls_periodic_aura);
spell_wailing_souls_periodic() : SpellScriptLoader("spell_wailing_souls_periodic") { }
class spell_wailing_souls_periodic_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_wailing_souls_periodic_AuraScript); return ValidateSpellInfo({ SPELL_WAILING_SOULS_DMG_N });
}
int8 dir; int8 dir;
bool Load() override bool Load() override
{
dir = urand(0, 1) ? 1 : -1;
return true;
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* t = GetTarget())
{ {
dir = urand(0, 1) ? 1 : -1; if (aurEff->GetTickNumber() < 30)
return true;
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* t = GetTarget())
{ {
if (aurEff->GetTickNumber() < 30) // spinning, casting, etc.
{ float diff = (2 * M_PI) / (4 * 30);
// spinning, casting, etc. float new_o = t->GetOrientation() + diff * dir;
float diff = (2 * M_PI) / (4 * 30); if (new_o >= 2 * M_PI)
float new_o = t->GetOrientation() + diff * dir; new_o -= 2 * M_PI;
if (new_o >= 2 * M_PI) else if (new_o < 0)
new_o -= 2 * M_PI; new_o += 2 * M_PI;
else if (new_o < 0) t->UpdateOrientation(new_o);
new_o += 2 * M_PI; t->SetFacingTo(new_o);
t->UpdateOrientation(new_o); t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true);
t->SetFacingTo(new_o);
t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true);
}
else if (aurEff->GetTickNumber() == 33)
{
t->SetControlled(false, UNIT_STATE_ROOT);
t->DisableRotate(false);
if (t->GetTypeId() == TYPEID_UNIT)
t->ToCreature()->SetReactState(REACT_AGGRESSIVE);
if (t->GetVictim())
{
t->SetGuidValue(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID());
t->GetMotionMaster()->MoveChase(t->GetVictim());
}
}
else if (aurEff->GetTickNumber() >= 34)
Remove(AURA_REMOVE_BY_EXPIRE);
} }
else if (aurEff->GetTickNumber() == 33)
{
t->SetControlled(false, UNIT_STATE_ROOT);
t->DisableRotate(false);
if (t->GetTypeId() == TYPEID_UNIT)
t->ToCreature()->SetReactState(REACT_AGGRESSIVE);
if (t->GetVictim())
{
t->SetGuidValue(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID());
t->GetMotionMaster()->MoveChase(t->GetVictim());
}
}
else if (aurEff->GetTickNumber() >= 34)
Remove(AURA_REMOVE_BY_EXPIRE);
} }
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_wailing_souls_periodic_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
void AddSC_boss_devourer_of_souls() void AddSC_boss_devourer_of_souls()
{ {
new boss_devourer_of_souls(); new boss_devourer_of_souls();
new spell_wailing_souls_periodic(); RegisterSpellScript(spell_wailing_souls_periodic_aura);
} }
@@ -256,45 +256,44 @@ public:
} }
}; };
class spell_shield_of_bones : public SpellScriptLoader enum ShieldOfBones
{ {
public: SPELL_SHIELD_OF_BONES_DAMAGE = 69642
spell_shield_of_bones() : SpellScriptLoader("spell_shield_of_bones") { } };
class spell_shield_of_bones_AuraScript : public AuraScript class spell_shield_of_bones_aura : public AuraScript
{
PrepareAuraScript(spell_shield_of_bones_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_shield_of_bones_AuraScript); return ValidateSpellInfo({ SPELL_SHIELD_OF_BONES_DAMAGE });
}
int32 amount; int32 amount;
bool fired; bool fired;
bool Load() override bool Load() override
{
fired = false;
amount = 0;
return true;
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{
amount += absorbAmount;
if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints + 1)
if (Unit* caster = GetCaster())
{
fired = true;
caster->CastSpell(caster, 69642, true);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_AuraScript::HandleAfterEffectAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_shield_of_bones_AuraScript(); fired = false;
amount = 0;
return true;
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{
amount += absorbAmount;
if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints + 1)
if (Unit* caster = GetCaster())
{
fired = true;
caster->CastSpell(caster, SPELL_SHIELD_OF_BONES_DAMAGE, true);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_aura::HandleAfterEffectAbsorb, EFFECT_0);
} }
}; };
@@ -302,6 +301,6 @@ void AddSC_forge_of_souls()
{ {
new npc_fos_leader(); new npc_fos_leader();
new npc_fos_leader_second(); new npc_fos_leader_second();
new spell_shield_of_bones(); RegisterSpellScript(spell_shield_of_bones_aura);
} }
@@ -169,50 +169,49 @@ public:
} }
}; };
class spell_hor_shared_suffering : public SpellScriptLoader enum SharedSufferingAura
{ {
public: SPELL_SHARED_SUFFERING_DAMAGE = 72373
spell_hor_shared_suffering() : SpellScriptLoader("spell_hor_shared_suffering") { } };
class spell_hor_shared_sufferingAuraScript : public AuraScript class spell_hor_shared_suffering_aura : public AuraScript
{
PrepareAuraScript(spell_hor_shared_suffering_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_hor_shared_sufferingAuraScript); return ValidateSpellInfo({ SPELL_SHARED_SUFFERING_DAMAGE });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled
if (Unit* caster = GetCaster())
if (Map* map = caster->FindMap())
if (Aura* a = aurEff->GetBase())
{
uint32 count = 0;
uint32 ticks = 0;
uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints;
Map::PlayerList const& pl = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource())
if (p->IsAlive())
++count;
ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1;
int32 dmg = (ticks * dmgPerTick) / count;
caster->CastCustomSpell(GetTarget(), 72373, nullptr, &dmg, nullptr, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_sufferingAuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hor_shared_sufferingAuraScript(); if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled
if (Unit* caster = GetCaster())
if (Map* map = caster->FindMap())
if (Aura* a = aurEff->GetBase())
{
uint32 count = 0;
uint32 ticks = 0;
uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints;
Map::PlayerList const& pl = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource())
if (p->IsAlive())
++count;
ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1;
int32 dmg = (ticks * dmgPerTick) / count;
caster->CastCustomSpell(GetTarget(), SPELL_SHARED_SUFFERING_DAMAGE, nullptr, &dmg, nullptr, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_suffering_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
} }
}; };
void AddSC_boss_marwyn() void AddSC_boss_marwyn()
{ {
new boss_marwyn(); new boss_marwyn();
new spell_hor_shared_suffering(); RegisterSpellScript(spell_hor_shared_suffering_aura);
} }
@@ -2315,34 +2315,33 @@ public:
} }
}; };
class spell_hor_gunship_cannon_fire : public SpellScriptLoader enum GunshipCannonFire
{ {
public: SPELL_GUNSHIP_CANNON_FIRE = 70021
spell_hor_gunship_cannon_fire() : SpellScriptLoader("spell_hor_gunship_cannon_fire") { } };
class spell_hor_gunship_cannon_fireAuraScript : public AuraScript class spell_hor_gunship_cannon_fire_aura : public AuraScript
{
PrepareAuraScript(spell_hor_gunship_cannon_fire_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_hor_gunship_cannon_fireAuraScript) return ValidateSpellInfo({ SPELL_GUNSHIP_CANNON_FIRE });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (Creature* c = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN, 1))
{
c->CastSpell((Unit*)nullptr, 70021, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fireAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hor_gunship_cannon_fireAuraScript(); PreventDefaultAction();
if (Unit* caster = GetCaster())
if (Creature* creature = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN, 1))
{
creature->CastSpell((Unit*)nullptr, SPELL_GUNSHIP_CANNON_FIRE, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fire_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -2403,7 +2402,7 @@ void AddSC_halls_of_reflection()
new npc_hor_raging_ghoul(); new npc_hor_raging_ghoul();
new npc_hor_risen_witch_doctor(); new npc_hor_risen_witch_doctor();
new npc_hor_lumbering_abomination(); new npc_hor_lumbering_abomination();
new spell_hor_gunship_cannon_fire(); RegisterSpellScript(spell_hor_gunship_cannon_fire_aura);
new at_hor_battered_hilt_start(); new at_hor_battered_hilt_start();
new at_hor_battered_hilt_throw(); new at_hor_battered_hilt_throw();
@@ -299,78 +299,67 @@ public:
} }
}; };
class spell_garfrost_permafrost : public SpellScriptLoader class spell_garfrost_permafrost : public SpellScript
{ {
public: PrepareSpellScript(spell_garfrost_permafrost);
spell_garfrost_permafrost() : SpellScriptLoader("spell_garfrost_permafrost") { }
class spell_garfrost_permafrost_SpellScript : public SpellScript std::list<WorldObject*> targetList;
void Unload() override
{ {
PrepareSpellScript(spell_garfrost_permafrost_SpellScript); targetList.clear();
}
std::list<WorldObject*> targetList; void FilterTargets(std::list<WorldObject*>& targets)
{
void Unload() override if (Unit* caster = GetCaster())
{ {
targetList.clear(); std::list<GameObject*> blockList;
} caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f);
void FilterTargets(std::list<WorldObject*>& targets) if (!blockList.empty())
{
if (Unit* caster = GetCaster())
{ {
std::list<GameObject*> blockList; for (std::list<WorldObject*>::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU)
caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f); if (WorldObject* target = (*itrU))
{
if (!blockList.empty()) bool valid = true;
{ if (!caster->IsWithinMeleeRange(target->ToUnit()))
for (std::list<WorldObject*>::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU) for (std::list<GameObject*>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
if (WorldObject* target = (*itrU)) if (!(*itr)->IsInvisibleDueToDespawn())
if ((*itr)->IsInBetween(caster, target, 4.0f))
{
valid = false;
break;
}
if (valid)
{ {
bool valid = true; if (Aura* aur = target->ToUnit()->GetAura(70336))
if (!caster->IsWithinMeleeRange(target->ToUnit())) if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT)
for (std::list<GameObject*>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount());
if (!(*itr)->IsInvisibleDueToDespawn()) targetList.push_back(*itrU);
if ((*itr)->IsInBetween(caster, target, 4.0f))
{
valid = false;
break;
}
if (valid)
{
if (Aura* aur = target->ToUnit()->GetAura(70336))
if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT)
caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount());
targetList.push_back(*itrU);
}
} }
} }
else }
{ else
targetList = targets; {
return; targetList = targets;
} return;
} }
targets = targetList;
} }
void FilterTargetsNext(std::list<WorldObject*>& targets) targets = targetList;
{ }
targets = targetList;
}
void Register() override void FilterTargetsNext(std::list<WorldObject*>& targets)
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_garfrost_permafrost_SpellScript(); targets = targetList;
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
} }
}; };
@@ -378,6 +367,6 @@ void AddSC_boss_garfrost()
{ {
new boss_garfrost(); new boss_garfrost();
new spell_garfrost_permafrost(); RegisterSpellScript(spell_garfrost_permafrost);
} }
@@ -458,74 +458,62 @@ public:
} }
}; };
class spell_krick_explosive_barrage : public SpellScriptLoader class spell_krick_explosive_barrage_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_krick_explosive_barrage_aura);
spell_krick_explosive_barrage() : SpellScriptLoader("spell_krick_explosive_barrage") { }
class spell_krick_explosive_barrage_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_krick_explosive_barrage_AuraScript); return ValidateSpellInfo({ SPELL_EXPLOSIVE_BARRAGE_SUMMON });
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/) void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_UNIT)
{
Map::PlayerList const& players = caster->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->IsWithinDist(caster, 100.0f))
caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_krick_explosive_barrage_AuraScript(); PreventDefaultAction();
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_UNIT)
{
Map::PlayerList const& players = caster->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->IsWithinDist(caster, 100.0f))
caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_exploding_orb_auto_grow : public SpellScriptLoader class spell_exploding_orb_auto_grow_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_exploding_orb_auto_grow_aura);
spell_exploding_orb_auto_grow() : SpellScriptLoader("spell_exploding_orb_auto_grow") { }
class spell_exploding_orb_auto_grow_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_exploding_orb_auto_grow_AuraScript); return ValidateSpellInfo({ SPELL_EXPLOSIVE_BARRAGE_DAMAGE, SPELL_HASTY_GROW, SPELL_AUTO_GROW, SPELL_EXPLODING_ORB_VISUAL });
}
void HandlePeriodicTick(AuraEffect const* aurEff) void HandlePeriodicTick(AuraEffect const* aurEff)
{
if (aurEff->GetTickNumber() >= 16)
if (Unit* target = GetTarget())
{
PreventDefaultAction();
target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false);
target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(2000);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_exploding_orb_auto_grow_AuraScript(); if (aurEff->GetTickNumber() >= 16)
if (Unit* target = GetTarget())
{
PreventDefaultAction();
target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false);
target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(2000);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -534,7 +522,7 @@ void AddSC_boss_ick()
new boss_ick(); new boss_ick();
new boss_krick(); new boss_krick();
new spell_krick_explosive_barrage(); RegisterSpellScript(spell_krick_explosive_barrage_aura);
new spell_exploding_orb_auto_grow(); RegisterSpellScript(spell_exploding_orb_auto_grow_aura);
} }
@@ -1301,31 +1301,30 @@ public:
} }
}; };
class spell_pos_empowered_blizzard : public SpellScriptLoader enum EmpoweredBlizzard
{ {
public: SPELL_EMPOWERED_BLIZZARD = 70131
spell_pos_empowered_blizzard() : SpellScriptLoader("spell_pos_empowered_blizzard") { } };
class spell_pos_empowered_blizzardAuraScript : public AuraScript class spell_pos_empowered_blizzard_aura : public AuraScript
{
PrepareAuraScript(spell_pos_empowered_blizzard_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_pos_empowered_blizzardAuraScript) return ValidateSpellInfo({ SPELL_EMPOWERED_BLIZZARD });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell((float)urand(447, 480), (float)urand(200, 235), 528.71f, 70131, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzardAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_pos_empowered_blizzardAuraScript(); PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell((float)urand(447, 480), (float)urand(200, 235), 528.71f, SPELL_EMPOWERED_BLIZZARD, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzard_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -1364,138 +1363,99 @@ private:
Creature& _owner; Creature& _owner;
}; };
class spell_pos_slave_trigger_closest : public SpellScriptLoader class spell_pos_slave_trigger_closest : public SpellScript
{ {
public: PrepareSpellScript(spell_pos_slave_trigger_closest);
spell_pos_slave_trigger_closest() : SpellScriptLoader("spell_pos_slave_trigger_closest") { }
class spell_pos_slave_trigger_closestSpellScript : public SpellScript void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_pos_slave_trigger_closestSpellScript); if (Unit* target = GetHitUnit())
if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times
void HandleDummy(SpellEffIndex /*effIndex*/) {
{
if (Unit* target = GetHitUnit())
if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times
{
if (Unit* caster = GetCaster())
if (Player* p = caster->ToPlayer())
{
p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance
p->RewardPlayerAndGroupAtEvent(36770, caster); // horde
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
if (Creature* c = target->ToCreature())
{
c->DespawnOrUnsummon(7000);
c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
}
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closestSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pos_slave_trigger_closestSpellScript();
}
};
class spell_pos_rimefang_frost_nova : public SpellScriptLoader
{
public:
spell_pos_rimefang_frost_nova() : SpellScriptLoader("spell_pos_rimefang_frost_nova") { }
class spell_pos_rimefang_frost_novaSpellScript : public SpellScript
{
PrepareSpellScript(spell_pos_rimefang_frost_novaSpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ if (Player* p = caster->ToPlayer())
Unit::Kill(caster, target); {
if (target->GetTypeId() == TYPEID_UNIT) p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance
target->ToCreature()->DespawnOrUnsummon(30000); p->RewardPlayerAndGroupAtEvent(36770, caster); // horde
}
}
void Register() override target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
{ if (Creature* c = target->ToCreature())
OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_novaSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); {
} c->DespawnOrUnsummon(7000);
}; c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
}
}
}
}
SpellScript* GetSpellScript() const override void Register() override
{ {
return new spell_pos_rimefang_frost_novaSpellScript(); OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_pos_blight : public SpellScriptLoader class spell_pos_rimefang_frost_nova : public SpellScript
{ {
public: PrepareSpellScript(spell_pos_rimefang_frost_nova);
spell_pos_blight() : SpellScriptLoader("spell_pos_blight") { }
class spell_pos_blightAuraScript : public AuraScript void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
PrepareAuraScript(spell_pos_blightAuraScript) if (Unit* target = GetHitUnit())
if (Unit* caster = GetCaster())
{
Unit::Kill(caster, target);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(30000);
}
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void Register() override
{
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* target = GetTarget())
target->CastSpell(target, 69604, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blightAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_pos_blightAuraScript(); OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_nova::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_pos_glacial_strike : public SpellScriptLoader class spell_pos_blight_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_pos_blight_aura);
spell_pos_glacial_strike() : SpellScriptLoader("spell_pos_glacial_strike") { }
class spell_pos_glacial_strikeAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_pos_glacial_strikeAuraScript) return ValidateSpellInfo({ 69604 });
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
{ {
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* target = GetTarget()) if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth()) target->CastSpell(target, 69604, true);
{ }
PreventDefaultAction();
aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE);
return;
}
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strikeAuraScript::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_pos_glacial_strikeAuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blight_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
class spell_pos_glacial_strike_aura : public AuraScript
{
PrepareAuraScript(spell_pos_glacial_strike_aura);
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth())
{
PreventDefaultAction();
aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE);
return;
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strike_aura::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
} }
}; };
@@ -1537,11 +1497,11 @@ void AddSC_pit_of_saron()
new npc_pos_freed_slave(); new npc_pos_freed_slave();
new npc_pos_leader_second(); new npc_pos_leader_second();
new spell_pos_empowered_blizzard(); RegisterSpellScript(spell_pos_empowered_blizzard_aura);
new spell_pos_slave_trigger_closest(); RegisterSpellScript(spell_pos_slave_trigger_closest);
new spell_pos_rimefang_frost_nova(); RegisterSpellScript(spell_pos_rimefang_frost_nova);
new spell_pos_blight(); RegisterSpellScript(spell_pos_blight_aura);
new spell_pos_glacial_strike(); RegisterSpellScript(spell_pos_glacial_strike_aura);
new at_tyrannus_event_starter(); new at_tyrannus_event_starter();
} }
@@ -406,86 +406,63 @@ public:
}; };
}; };
class spell_drakkari_colossus_emerge : public SpellScriptLoader class spell_drakkari_colossus_emerge : public SpellScript
{ {
public: PrepareSpellScript(spell_drakkari_colossus_emerge);
spell_drakkari_colossus_emerge() : SpellScriptLoader("spell_drakkari_colossus_emerge") { }
class spell_drakkari_colossus_emerge_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_drakkari_colossus_emerge_SpellScript); return ValidateSpellInfo({ SPELL_FREEZE_ANIM });
}
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetCaster(), SPELL_FREEZE_ANIM, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_emerge_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_drakkari_colossus_emerge_SpellScript(); GetCaster()->CastSpell(GetCaster(), SPELL_FREEZE_ANIM, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_emerge::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_drakkari_colossus_surge : public SpellScriptLoader class spell_drakkari_colossus_surge : public SpellScript
{ {
public: PrepareSpellScript(spell_drakkari_colossus_surge);
spell_drakkari_colossus_surge() : SpellScriptLoader("spell_drakkari_colossus_surge") { }
class spell_drakkari_colossus_surge_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_drakkari_colossus_surge_SpellScript); return ValidateSpellInfo({ SPELL_SURGE_DAMAGE });
}
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_SURGE_DAMAGE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_surge_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_drakkari_colossus_surge_SpellScript(); if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_SURGE_DAMAGE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_surge::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_drakkari_colossus_face_me : public SpellScriptLoader class spell_drakkari_colossus_face_me : public SpellScript
{ {
public: PrepareSpellScript(spell_drakkari_colossus_face_me);
spell_drakkari_colossus_face_me() : SpellScriptLoader("spell_drakkari_colossus_face_me") { }
class spell_drakkari_colossus_face_me_SpellScript : public SpellScript void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_drakkari_colossus_face_me_SpellScript); if (Unit* target = GetHitUnit())
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{ {
if (Unit* target = GetHitUnit()) GetCaster()->SetInFront(target);
{ GetCaster()->SetFacingTo(GetCaster()->GetAngle(target));
GetCaster()->SetInFront(target);
GetCaster()->SetFacingTo(GetCaster()->GetAngle(target));
}
} }
}
void Register() override void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_face_me_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_drakkari_colossus_face_me_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_drakkari_colossus_face_me::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
@@ -494,8 +471,8 @@ void AddSC_boss_drakkari_colossus()
new boss_drakkari_colossus(); new boss_drakkari_colossus();
new boss_drakkari_elemental(); new boss_drakkari_elemental();
new npc_living_mojo(); new npc_living_mojo();
new spell_drakkari_colossus_emerge(); RegisterSpellScript(spell_drakkari_colossus_emerge);
new spell_drakkari_colossus_surge(); RegisterSpellScript(spell_drakkari_colossus_surge);
new spell_drakkari_colossus_face_me(); RegisterSpellScript(spell_drakkari_colossus_face_me);
} }
@@ -219,57 +219,45 @@ public:
}; };
}; };
class spell_galdarah_impaling_charge : public SpellScriptLoader class spell_galdarah_impaling_charge : public SpellScript
{ {
public: PrepareSpellScript(spell_galdarah_impaling_charge);
spell_galdarah_impaling_charge() : SpellScriptLoader("spell_galdarah_impaling_charge") { }
class spell_galdarah_impaling_charge_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_galdarah_impaling_charge_SpellScript); return ValidateSpellInfo({ SPELL_IMPALING_CHARGE_VEHICLE });
}
void HandleApplyAura(SpellEffIndex /*effIndex*/) void HandleApplyAura(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_IMPALING_CHARGE_VEHICLE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_galdarah_impaling_charge_SpellScript::HandleApplyAura, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_galdarah_impaling_charge_SpellScript(); if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_IMPALING_CHARGE_VEHICLE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_galdarah_impaling_charge::HandleApplyAura, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
} }
}; };
class spell_galdarah_transform : public SpellScriptLoader class spell_galdarah_transform : public SpellScript
{ {
public: PrepareSpellScript(spell_galdarah_transform);
spell_galdarah_transform() : SpellScriptLoader("spell_galdarah_transform") { }
class spell_galdarah_transform_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_galdarah_transform_SpellScript); return ValidateSpellInfo({ SPELL_TRANSFORM_TO_RHINO });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->RemoveAurasDueToSpell(SPELL_TRANSFORM_TO_RHINO);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_galdarah_transform_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_galdarah_transform_SpellScript(); if (Unit* target = GetHitUnit())
target->RemoveAurasDueToSpell(SPELL_TRANSFORM_TO_RHINO);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_galdarah_transform::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
@@ -292,7 +280,7 @@ public:
void AddSC_boss_gal_darah() void AddSC_boss_gal_darah()
{ {
new boss_gal_darah(); new boss_gal_darah();
new spell_galdarah_impaling_charge(); RegisterSpellScript(spell_galdarah_impaling_charge);
new spell_galdarah_transform(); RegisterSpellScript(spell_galdarah_transform);
new achievement_share_the_love(); new achievement_share_the_love();
} }
@@ -170,34 +170,23 @@ public:
}; };
}; };
class spell_moorabi_mojo_frenzy : public SpellScriptLoader class spell_moorabi_mojo_frenzy_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_moorabi_mojo_frenzy_aura);
spell_moorabi_mojo_frenzy() : SpellScriptLoader("spell_moorabi_mojo_frenzy") { }
class spell_moorabi_mojo_frenzy_AuraScript : public AuraScript void HandlePeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_moorabi_mojo_frenzy_AuraScript); PreventDefaultAction();
void HandlePeriodic(AuraEffect const* /*aurEff*/) if (GetUnitOwner()->GetMap()->IsHeroic())
{ GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()*GetUnitOwner()->GetHealthPct() / 10000.0f));
PreventDefaultAction(); else
GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct() / 100.0f));
}
if (GetUnitOwner()->GetMap()->IsHeroic()) void Register() override
GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()*GetUnitOwner()->GetHealthPct() / 10000.0f));
else
GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct() / 100.0f));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_moorabi_mojo_frenzy_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_moorabi_mojo_frenzy_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_moorabi_mojo_frenzy_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -217,6 +206,6 @@ public:
void AddSC_boss_moorabi() void AddSC_boss_moorabi()
{ {
new boss_moorabi(); new boss_moorabi();
new spell_moorabi_mojo_frenzy(); RegisterSpellScript(spell_moorabi_mojo_frenzy_aura);
new achievement_less_rabi(); new achievement_less_rabi();
} }
@@ -200,34 +200,28 @@ public:
}; };
}; };
class spell_sladran_grip_of_sladran : public SpellScriptLoader class spell_sladran_grip_of_sladran_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_sladran_grip_of_sladran_aura);
spell_sladran_grip_of_sladran() : SpellScriptLoader("spell_sladran_grip_of_sladran") { }
class spell_sladran_grip_of_sladran_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_sladran_grip_of_sladran_AuraScript); return ValidateSpellInfo({ SPELL_SNAKE_WRAP });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/) void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetStackAmount() >= 5)
{
SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SNAKE_WRAP, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sladran_grip_of_sladran_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_sladran_grip_of_sladran_AuraScript(); PreventDefaultAction();
if (GetStackAmount() >= 5)
{
SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SNAKE_WRAP, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sladran_grip_of_sladran_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -250,6 +244,6 @@ public:
void AddSC_boss_slad_ran() void AddSC_boss_slad_ran()
{ {
new boss_slad_ran(); new boss_slad_ran();
new spell_sladran_grip_of_sladran(); RegisterSpellScript(spell_sladran_grip_of_sladran_aura);
new achievement_snakes_whyd_it_have_to_be_snakes(); new achievement_snakes_whyd_it_have_to_be_snakes();
} }
@@ -1488,59 +1488,48 @@ public:
} }
}; };
class spell_eoe_ph3_surge_of_power : public SpellScriptLoader class spell_eoe_ph3_surge_of_power : public SpellScript
{ {
public: PrepareSpellScript(spell_eoe_ph3_surge_of_power);
spell_eoe_ph3_surge_of_power() : SpellScriptLoader("spell_eoe_ph3_surge_of_power") { }
class spell_eoe_ph3_surge_of_power_SpellScript : public SpellScript ObjectGuid DrakeGUID[3];
bool Load() override
{ {
PrepareSpellScript(spell_eoe_ph3_surge_of_power_SpellScript); if (Unit* caster = GetCaster())
if (Creature* c = caster->ToCreature())
ObjectGuid DrakeGUID[3];
bool Load() override
{
if (Unit* caster = GetCaster())
if (Creature* c = caster->ToCreature())
{
uint8 i = 0;
std::list<Unit*> drakes;
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
{
DrakeGUID[i++] = (*itr)->GetGUID();
if (Vehicle* v = (*itr)->GetVehicleKit())
if (Unit* p = v->GetPassenger(0))
if (Player* plr = p->ToPlayer())
c->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, plr);
}
}
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (Unit* caster = GetCaster())
{ {
targets.clear(); uint8 i = 0;
for (uint8 i = 0; i < 3; ++i) std::list<Unit*> drakes;
if (DrakeGUID[i]) c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i])) for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
targets.push_back(u); {
DrakeGUID[i++] = (*itr)->GetGUID();
if (Vehicle* v = (*itr)->GetVehicleKit())
if (Unit* p = v->GetPassenger(0))
if (Player* plr = p->ToPlayer())
c->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, plr);
}
} }
}
void Register() override return true;
{ }
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override void FilterTargets(std::list<WorldObject*>& targets)
{ {
return new spell_eoe_ph3_surge_of_power_SpellScript(); if (Unit* caster = GetCaster())
{
targets.clear();
for (uint8 i = 0; i < 3; ++i)
if (DrakeGUID[i])
if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i]))
targets.push_back(u);
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
@@ -1556,5 +1545,5 @@ void AddSC_boss_malygos()
new npc_hover_disk(); new npc_hover_disk();
new npc_eoe_wyrmrest_skytalon(); new npc_eoe_wyrmrest_skytalon();
new spell_eoe_ph3_surge_of_power(); RegisterSpellScript(spell_eoe_ph3_surge_of_power);
} }
@@ -230,99 +230,82 @@ public:
}; };
}; };
class spell_boss_magus_telestra_summon_telestra_clones : public SpellScriptLoader class spell_boss_magus_telestra_summon_telestra_clones_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_boss_magus_telestra_summon_telestra_clones_aura);
spell_boss_magus_telestra_summon_telestra_clones() : SpellScriptLoader("spell_boss_magus_telestra_summon_telestra_clones") { }
class spell_boss_magus_telestra_summon_telestra_clones_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_boss_magus_telestra_summon_telestra_clones_AuraScript); return ValidateSpellInfo({ SPELL_FIRE_MAGUS_SUMMON, SPELL_FROST_MAGUS_SUMMON, SPELL_ARCANE_MAGUS_SUMMON });
}
bool Load() override bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true);
GetUnitOwner()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_boss_magus_telestra_summon_telestra_clones_AuraScript(); return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true);
GetUnitOwner()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_boss_magus_telestra_gravity_well : public SpellScriptLoader class spell_boss_magus_telestra_gravity_well : public SpellScript
{ {
public: PrepareSpellScript(spell_boss_magus_telestra_gravity_well);
spell_boss_magus_telestra_gravity_well() : SpellScriptLoader("spell_boss_magus_telestra_gravity_well") { }
class spell_boss_magus_telestra_gravity_well_SpellScript : public SpellScript void SelectTarget(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_boss_magus_telestra_gravity_well_SpellScript); targets.remove_if(Acore::RandomCheck(50));
}
void SelectTarget(std::list<WorldObject*>& targets) void HandlePull(SpellEffIndex effIndex)
{
targets.remove_if(Acore::RandomCheck(50));
}
void HandlePull(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
Position pos;
if (target->GetDistance(GetCaster()) < 5.0f)
{
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float o = frand(0, 2 * M_PI);
target->MovePositionToFirstCollision(pos, 20.0f, o);
pos.m_positionZ += frand(5.0f, 15.0f);
}
else
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f;
float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity;
target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_boss_magus_telestra_gravity_well_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_boss_magus_telestra_gravity_well_SpellScript(); PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
Position pos;
if (target->GetDistance(GetCaster()) < 5.0f)
{
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float o = frand(0, 2 * M_PI);
target->MovePositionToFirstCollision(pos, 20.0f, o);
pos.m_positionZ += frand(5.0f, 15.0f);
}
else
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f;
float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity;
target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_boss_magus_telestra_gravity_well::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST);
} }
}; };
@@ -345,7 +328,7 @@ public:
void AddSC_boss_magus_telestra() void AddSC_boss_magus_telestra()
{ {
new boss_magus_telestra(); new boss_magus_telestra();
new spell_boss_magus_telestra_summon_telestra_clones(); RegisterSpellScript(spell_boss_magus_telestra_summon_telestra_clones_aura);
new spell_boss_magus_telestra_gravity_well(); RegisterSpellScript(spell_boss_magus_telestra_gravity_well);
new achievement_split_personality(); new achievement_split_personality();
} }
@@ -532,486 +532,374 @@ public:
}; };
// 49838 - Stop Time // 49838 - Stop Time
class spell_oculus_stop_time : public SpellScriptLoader class spell_oculus_stop_time_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_stop_time_aura);
spell_oculus_stop_time() : SpellScriptLoader("spell_oculus_stop_time") { }
class spell_oculus_stop_time_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_oculus_stop_time_AuraScript); return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Unit* target = GetTarget();
for (uint32 i = 0; i < 5; ++i)
caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_oculus_stop_time_AuraScript(); Unit* caster = GetCaster();
if (!caster)
return;
Unit* target = GetTarget();
for (uint32 i = 0; i < 5; ++i)
caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_aura::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
} }
}; };
// 50240 - Evasive Maneuvers // 50240 - Evasive Maneuvers
class spell_oculus_evasive_maneuvers : public SpellScriptLoader class spell_oculus_evasive_maneuvers_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_evasive_maneuvers_aura);
spell_oculus_evasive_maneuvers() : SpellScriptLoader("spell_oculus_evasive_maneuvers") { }
class spell_oculus_evasive_maneuvers_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_oculus_evasive_maneuvers_AuraScript); return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES);
if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES))
SetDuration(0);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_oculus_evasive_maneuvers_AuraScript(); PreventDefaultAction();
GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES);
if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES))
SetDuration(0);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_aura::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);
} }
}; };
// 49840 - Shock Lance // 49840 - Shock Lance
class spell_oculus_shock_lance : public SpellScriptLoader class spell_oculus_shock_lance : public SpellScript
{ {
public: PrepareSpellScript(spell_oculus_shock_lance);
spell_oculus_shock_lance() : SpellScriptLoader("spell_oculus_shock_lance") { }
class spell_oculus_shock_lance_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_oculus_shock_lance_SpellScript); return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void CalcDamage()
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void CalcDamage()
{
int32 damage = GetHitDamage();
if (Unit* target = GetHitUnit())
if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster
{
damage += aura->GetStackAmount() * 6525;
aura->Remove();
}
SetHitDamage(damage);
}
void Register() override
{
OnHit += SpellHitFn(spell_oculus_shock_lance_SpellScript::CalcDamage);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_oculus_shock_lance_SpellScript(); int32 damage = GetHitDamage();
if (Unit* target = GetHitUnit())
if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster
{
damage += aura->GetStackAmount() * 6525;
aura->Remove();
}
SetHitDamage(damage);
}
void Register() override
{
OnHit += SpellHitFn(spell_oculus_shock_lance::CalcDamage);
} }
}; };
// 49592 - Temporal Rift // 49592 - Temporal Rift
class spell_oculus_temporal_rift : public SpellScriptLoader class spell_oculus_temporal_rift_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_temporal_rift_aura);
spell_oculus_temporal_rift() : SpellScriptLoader("spell_oculus_temporal_rift") { }
class spell_oculus_temporal_rift_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_oculus_temporal_rift_AuraScript); return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 amount = aurEff->GetAmount() + damageInfo->GetDamage();
uint8 num = amount / 15000;
if (amount >= 15000)
{
if (Unit* caster = GetCaster())
for (uint8 i = 0; i < num; ++i )
caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true);
}
const_cast<AuraEffect*>(aurEff)->SetAmount(amount - 15000 * num);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_oculus_temporal_rift_AuraScript(); PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 amount = aurEff->GetAmount() + damageInfo->GetDamage();
uint8 num = amount / 15000;
if (amount >= 15000)
{
if (Unit* caster = GetCaster())
for (uint8 i = 0; i < num; ++i )
caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true);
}
const_cast<AuraEffect*>(aurEff)->SetAmount(amount - 15000 * num);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_aura::HandleProc, EFFECT_2, SPELL_AURA_DUMMY);
} }
}; };
// 50341 - Touch the Nightmare // 50341 - Touch the Nightmare
class spell_oculus_touch_the_nightmare : public SpellScriptLoader class spell_oculus_touch_the_nightmare : public SpellScript
{ {
public: PrepareSpellScript(spell_oculus_touch_the_nightmare);
spell_oculus_touch_the_nightmare() : SpellScriptLoader("spell_oculus_touch_the_nightmare") { }
class spell_oculus_touch_the_nightmare_SpellScript : public SpellScript void HandleDamageCalc(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_oculus_touch_the_nightmare_SpellScript); SetHitDamage(int32(GetCaster()->CountPctFromMaxHealth(30)));
}
void HandleDamageCalc(SpellEffIndex /*effIndex*/) void Register() override
{
SetHitDamage(int32(GetCaster()->CountPctFromMaxHealth(30)));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oculus_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_oculus_touch_the_nightmare_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_oculus_touch_the_nightmare::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
} }
}; };
// 50344 - Dream Funnel // 50344 - Dream Funnel
class spell_oculus_dream_funnel : public SpellScriptLoader class spell_oculus_dream_funnel_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_dream_funnel_aura);
spell_oculus_dream_funnel() : SpellScriptLoader("spell_oculus_dream_funnel") { }
class spell_oculus_dream_funnel_AuraScript : public AuraScript void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
{ {
PrepareAuraScript(spell_oculus_dream_funnel_AuraScript); if (Unit* caster = GetCaster())
amount = int32(caster->CountPctFromMaxHealth(5));
void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) canBeRecalculated = false;
{ }
if (Unit* caster = GetCaster())
amount = int32(caster->CountPctFromMaxHealth(5));
canBeRecalculated = false; void Register() override
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_oculus_dream_funnel_AuraScript(); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_aura::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_aura::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
class spell_oculus_call_ruby_emerald_amber_drake : public SpellScriptLoader class spell_oculus_call_ruby_emerald_amber_drake : public SpellScript
{ {
public: PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake);
spell_oculus_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_oculus_call_ruby_emerald_amber_drake") { }
class spell_oculus_call_ruby_emerald_amber_drake_SpellScript : public SpellScript void SetDest(SpellDestination& dest)
{ {
PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake_SpellScript); // Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 12.0f, 0.0f };
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest) void Register() override
{
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 12.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_oculus_call_ruby_emerald_amber_drake_SpellScript(); OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_oculus_call_ruby_emerald_amber_drake::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
} }
}; };
class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader class spell_oculus_ride_ruby_emerald_amber_drake_que_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_aura);
spell_oculus_ride_ruby_emerald_amber_drake_que() : SpellScriptLoader("spell_oculus_ride_ruby_emerald_amber_drake_que") { }
class spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript : public AuraScript void HandlePeriodic(AuraEffect const* aurEff)
{ {
PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript); // caster of the triggered spell is wrong for an unknown reason, handle it here correctly
PreventDefaultAction();
if (Unit* caster = GetCaster())
GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void HandlePeriodic(AuraEffect const* aurEff) void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_oculus_evasive_charges_aura : public AuraScript
{
PrepareAuraScript(spell_oculus_evasive_charges_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_MANEUVERS });
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{ {
// caster of the triggered spell is wrong for an unknown reason, handle it here correctly caster->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_MANEUVERS);
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, false);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_evasive_charges_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_evasive_charges_aura::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_oculus_soar_aura : public AuraScript
{
PrepareAuraScript(spell_oculus_soar_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SOAR_BUFF });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->getAttackers().empty())
{
if (caster->HasAura(SPELL_SOAR_BUFF))
caster->RemoveAurasDueToSpell(SPELL_SOAR_BUFF);
PreventDefaultAction(); PreventDefaultAction();
if (Unit* caster = GetCaster()) return;
GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
} }
void Register() override if (!caster->HasAura(SPELL_SOAR_BUFF))
{ caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override // We handle the health regen here, normal heal regen isn't working....
if (caster->GetHealth() < caster->GetMaxHealth())
caster->SetHealth(caster->GetHealth() + (uint32)((double)caster->GetMaxHealth() * 0.2));
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
return new spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript(); Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_soar_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_oculus_soar_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_oculus_evasive_charges : public SpellScriptLoader class spell_oculus_rider_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_rider_aura);
spell_oculus_evasive_charges() : SpellScriptLoader("spell_oculus_evasive_charges") { }
class spell_oculus_evasive_chargesAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_oculus_evasive_chargesAuraScript); return ValidateSpellInfo({ SPELL_SOAR_TRIGGER, SPELL_RUBY_EVASIVE_AURA, SPELL_DRAKE_FLAG_VISUAL });
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
caster->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_MANEUVERS);
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, false);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_evasive_chargesAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_evasive_chargesAuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_evasive_chargesAuraScript();
} }
};
class spell_oculus_soar : public SpellScriptLoader ObjectGuid _drakeGUID;
{
public:
spell_oculus_soar() : SpellScriptLoader("spell_oculus_soar") { }
class spell_oculus_soarAuraScript : public AuraScript void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_oculus_soarAuraScript); Unit* caster = GetCaster();
if (!caster)
return;
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
return;
switch (aurEff->GetEffIndex())
{ {
Unit* caster = GetCaster(); case EFFECT_1:
_drakeGUID = drake->GetGUID();
if (!caster) caster->AddAura(SPELL_DRAKE_FLAG_VISUAL, caster);
return; caster->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!caster->getAttackers().empty()) drake->CastSpell(drake, SPELL_SOAR_TRIGGER);
{ if (drake->GetEntry() == NPC_RUBY_DRAKE)
if (caster->HasAura(SPELL_SOAR_BUFF)) drake->CastSpell(drake, SPELL_RUBY_EVASIVE_AURA);
caster->RemoveAurasDueToSpell(SPELL_SOAR_BUFF); break;
case EFFECT_2:
caster->AddAura(SPELL_SCALE_STATS, drake);
PreventDefaultAction(); PreventDefaultAction();
return; break;
}
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
// We handle the health regen here, normal heal regen isn't working....
if (caster->GetHealth() < caster->GetMaxHealth())
caster->SetHealth(caster->GetHealth() + (uint32)((double)caster->GetMaxHealth() * 0.2));
} }
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_soarAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_oculus_soarAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_oculus_soarAuraScript(); Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = ObjectAccessor::GetCreature(*caster, _drakeGUID);
if (drake)
{
drake->RemoveUnitFlag(UNIT_FLAG_POSSESSED);
drake->RemoveAurasDueToSpell(GetId());
drake->RemoveAurasDueToSpell(SPELL_SOAR_TRIGGER);
drake->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_AURA);
}
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_aura::HandleOnEffectApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_aura::HandleOnEffectApply, EFFECT_2, SPELL_AURA_LINKED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_rider_aura::HandleOnEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
} }
}; };
class spell_oculus_rider_aura : public SpellScriptLoader class spell_oculus_drake_flag_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_oculus_drake_flag_aura);
spell_oculus_rider_aura() : SpellScriptLoader("spell_oculus_rider_aura") { }
class spell_oculus_rider_auraAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_oculus_rider_auraAuraScript); return ValidateSpellInfo({ SPELL_DRAKE_FLAG_VISUAL });
}
ObjectGuid _drakeGUID; void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
{ {
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
return;
switch (aurEff->GetEffIndex())
{
case EFFECT_1:
_drakeGUID = drake->GetGUID();
caster->AddAura(SPELL_DRAKE_FLAG_VISUAL, caster);
caster->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
drake->CastSpell(drake, SPELL_SOAR_TRIGGER);
if (drake->GetEntry() == NPC_RUBY_DRAKE)
drake->CastSpell(drake, SPELL_RUBY_EVASIVE_AURA);
break;
case EFFECT_2:
caster->AddAura(SPELL_SCALE_STATS, drake);
PreventDefaultAction();
break;
}
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = ObjectAccessor::GetCreature(*caster, _drakeGUID);
if (drake)
{
drake->RemoveUnitFlag(UNIT_FLAG_POSSESSED);
drake->RemoveAurasDueToSpell(GetId());
drake->RemoveAurasDueToSpell(SPELL_SOAR_TRIGGER);
drake->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_AURA);
}
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL); caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
} }
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_auraAuraScript::HandleOnEffectApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_auraAuraScript::HandleOnEffectApply, EFFECT_2, SPELL_AURA_LINKED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_rider_auraAuraScript::HandleOnEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_rider_auraAuraScript();
} }
};
class spell_oculus_drake_flag : public SpellScriptLoader void Register() override
{
public:
spell_oculus_drake_flag() : SpellScriptLoader("spell_oculus_drake_flag") { }
class spell_oculus_drake_flagAuraScript : public AuraScript
{ {
PrepareAuraScript(spell_oculus_drake_flagAuraScript); OnEffectApply += AuraEffectApplyFn(spell_oculus_drake_flag_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
{
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_drake_flagAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_drake_flagAuraScript();
} }
}; };
@@ -1021,17 +909,17 @@ void AddSC_oculus()
new npc_oculus_drake(); new npc_oculus_drake();
new npc_centrifuge_construct(); new npc_centrifuge_construct();
new spell_oculus_stop_time(); RegisterSpellScript(spell_oculus_stop_time_aura);
new spell_oculus_evasive_maneuvers(); RegisterSpellScript(spell_oculus_evasive_maneuvers_aura);
new spell_oculus_shock_lance(); RegisterSpellScript(spell_oculus_shock_lance);
new spell_oculus_temporal_rift(); RegisterSpellScript(spell_oculus_temporal_rift_aura);
new spell_oculus_touch_the_nightmare(); RegisterSpellScript(spell_oculus_touch_the_nightmare);
new spell_oculus_dream_funnel(); RegisterSpellScript(spell_oculus_dream_funnel_aura);
new spell_oculus_call_ruby_emerald_amber_drake(); RegisterSpellScript(spell_oculus_call_ruby_emerald_amber_drake);
new spell_oculus_ride_ruby_emerald_amber_drake_que(); RegisterSpellScript(spell_oculus_ride_ruby_emerald_amber_drake_que_aura);
new spell_oculus_evasive_charges(); RegisterSpellScript(spell_oculus_evasive_charges_aura);
new spell_oculus_soar(); RegisterSpellScript(spell_oculus_soar_aura);
new spell_oculus_rider_aura(); RegisterSpellScript(spell_oculus_rider_aura);
new spell_oculus_drake_flag(); RegisterSpellScript(spell_oculus_drake_flag_aura);
} }
@@ -343,32 +343,26 @@ public:
}; };
}; };
class spell_frost_tomb : public SpellScriptLoader class spell_frost_tomb_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_frost_tomb_aura);
spell_frost_tomb() : SpellScriptLoader("spell_frost_tomb") { }
class spell_frost_tombAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_frost_tombAuraScript); return ValidateSpellInfo({ SPELL_FROST_TOMB_SUMMON });
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetTickNumber() == 1)
if( Unit* target = GetTarget() )
target->CastSpell((Unit*)nullptr, SPELL_FROST_TOMB_SUMMON, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_frost_tombAuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_frost_tombAuraScript(); PreventDefaultAction();
if (aurEff->GetTickNumber() == 1)
if( Unit* target = GetTarget() )
target->CastSpell((Unit*)nullptr, SPELL_FROST_TOMB_SUMMON, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_frost_tomb_aura::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -377,6 +371,6 @@ void AddSC_boss_keleseth()
new boss_keleseth(); new boss_keleseth();
new npc_frost_tomb(); new npc_frost_tomb();
new npc_vrykul_skeleton(); new npc_vrykul_skeleton();
new spell_frost_tomb(); RegisterSpellScript(spell_frost_tomb_aura);
} }
@@ -208,37 +208,26 @@ enum TickingTimeBomb
SPELL_TICKING_TIME_BOMB_EXPLODE = 59687 SPELL_TICKING_TIME_BOMB_EXPLODE = 59687
}; };
class spell_ticking_time_bomb : public SpellScriptLoader class spell_ticking_time_bomb_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_ticking_time_bomb_aura);
spell_ticking_time_bomb() : SpellScriptLoader("spell_ticking_time_bomb") { }
class spell_ticking_time_bomb_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_ticking_time_bomb_AuraScript); return ValidateSpellInfo({ SPELL_TICKING_TIME_BOMB_EXPLODE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */)
{
return ValidateSpellInfo({ SPELL_TICKING_TIME_BOMB_EXPLODE });
}
void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */)
{
if (GetCaster() == GetTarget())
{
GetTarget()->CastSpell(GetTarget(), SPELL_TICKING_TIME_BOMB_EXPLODE, true);
}
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_ticking_time_bomb_AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ticking_time_bomb_AuraScript(); if (GetCaster() == GetTarget())
{
GetTarget()->CastSpell(GetTarget(), SPELL_TICKING_TIME_BOMB_EXPLODE, true);
}
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_ticking_time_bomb_aura::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -247,6 +236,6 @@ void AddSC_utgarde_keep()
new npc_dragonflayer_forge_master(); new npc_dragonflayer_forge_master();
new npc_enslaved_proto_drake(); new npc_enslaved_proto_drake();
new spell_ticking_time_bomb(); RegisterSpellScript(spell_ticking_time_bomb_aura);
} }
@@ -396,56 +396,40 @@ public:
}; };
}; };
class spell_svala_ritual_strike : public SpellScriptLoader class spell_svala_ritual_strike : public SpellScript
{ {
public: PrepareSpellScript(spell_svala_ritual_strike);
spell_svala_ritual_strike() : SpellScriptLoader("spell_svala_ritual_strike") { }
class spell_svala_ritual_strike_SpellScript : public SpellScript void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_svala_ritual_strike_SpellScript); if (Unit* unitTarget = GetHitUnit())
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{ {
if (Unit* unitTarget = GetHitUnit()) if (unitTarget->GetTypeId() != TYPEID_UNIT)
{ return;
if (unitTarget->GetTypeId() != TYPEID_UNIT)
return;
Unit::DealDamage(GetCaster(), unitTarget, 7000, nullptr, DIRECT_DAMAGE); Unit::DealDamage(GetCaster(), unitTarget, 7000, nullptr, DIRECT_DAMAGE);
}
} }
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_svala_ritual_strike_SpellScript::HandleDummyEffect, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_svala_ritual_strike_SpellScript();
} }
class spell_svala_ritual_strike_AuraScript : public AuraScript void Register() override
{ {
PrepareAuraScript(spell_svala_ritual_strike_AuraScript); OnEffectHitTarget += SpellEffectFn(spell_svala_ritual_strike::HandleDummyEffect, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) class spell_svala_ritual_strike_aura : public AuraScript
{ {
// Set amount based on difficulty PrepareAuraScript(spell_svala_ritual_strike_aura);
amount = (GetCaster()->GetMap()->IsHeroic() ? 2000 : 1000);
}
void Register() override void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_svala_ritual_strike_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_svala_ritual_strike_AuraScript(); // Set amount based on difficulty
amount = (GetCaster()->GetMap()->IsHeroic() ? 2000 : 1000);
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_svala_ritual_strike_aura::CalculateAmount, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
@@ -453,6 +437,6 @@ void AddSC_boss_svala()
{ {
new boss_svala(); new boss_svala();
new npc_ritual_channeler(); new npc_ritual_channeler();
new spell_svala_ritual_strike(); RegisterSpellAndAuraScriptPair(spell_svala_ritual_strike, spell_svala_ritual_strike_aura);
} }
@@ -132,38 +132,27 @@ public:
}; };
}; };
class spell_optic_link : public SpellScriptLoader class spell_optic_link_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_optic_link_aura);
spell_optic_link() : SpellScriptLoader("spell_optic_link") { }
class spell_optic_linkAuraScript : public AuraScript void HandleEffectPeriodic(AuraEffect const* aurEff)
{ {
PrepareAuraScript(spell_optic_linkAuraScript) if (Unit* target = GetTarget())
if (Unit* caster = GetCaster())
if (GetAura() && GetAura()->GetEffect(0))
GetAura()->GetEffect(0)->SetAmount(aurEff->GetSpellInfo()->Effects[EFFECT_0].BasePoints + (((int32)target->GetExactDist(caster)) * 25) + (aurEff->GetTickNumber() * 100));
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void Register() override
{
if (Unit* target = GetTarget())
if (Unit* caster = GetCaster())
if (GetAura() && GetAura()->GetEffect(0))
GetAura()->GetEffect(0)->SetAmount(aurEff->GetSpellInfo()->Effects[EFFECT_0].BasePoints + (((int32)target->GetExactDist(caster)) * 25) + (aurEff->GetTickNumber() * 100));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_optic_linkAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_optic_linkAuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_optic_link_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
void AddSC_boss_moragg() void AddSC_boss_moragg()
{ {
new boss_moragg(); new boss_moragg();
new spell_optic_link(); RegisterSpellScript(spell_optic_link_aura);
} }
@@ -1157,32 +1157,21 @@ public:
** DESTROY DOOR SEAL SPELL SCRIPT ** DESTROY DOOR SEAL SPELL SCRIPT
***********/ ***********/
class spell_destroy_door_seal : public SpellScriptLoader class spell_destroy_door_seal_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_destroy_door_seal_aura);
spell_destroy_door_seal() : SpellScriptLoader("spell_destroy_door_seal") { }
class spell_destroy_door_sealAuraScript : public AuraScript void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_destroy_door_sealAuraScript) PreventDefaultAction();
if (Unit* target = GetTarget())
if (InstanceScript* pInstance = target->GetInstanceScript())
pInstance->SetData(DATA_DECRASE_DOOR_HEALTH, 0);
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
PreventDefaultAction();
if (Unit* target = GetTarget())
if (InstanceScript* pInstance = target->GetInstanceScript())
pInstance->SetData(DATA_DECRASE_DOOR_HEALTH, 0);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_destroy_door_sealAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_destroy_door_sealAuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_destroy_door_seal_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -1232,6 +1221,6 @@ void AddSC_violet_hold()
new npc_azure_raider(); new npc_azure_raider();
new npc_azure_stalker(); new npc_azure_stalker();
new spell_destroy_door_seal(); RegisterSpellScript(spell_destroy_door_seal_aura);
RegisterCreatureAI(npc_violet_hold_defense_system); RegisterCreatureAI(npc_violet_hold_defense_system);
} }