refactor(Scripts/Ulduar): Spell Scripts use registry macros (#19045)

* algalon phase punch

* algalon collapse

* algalon trigger 3 adds

* algalon cosmic smash damage

* algalon big bang

* algalon remove phase

* algalon supermassive fail

* auriaya sentinel blast

* ic shield of runes

* ic assembly meltdown

* ic rune of summoning

* thorim lightning pillar

* thorim trash impale

* kologarn ulduar stone grip cast target

* kologarn stone grip

* kologarn squeezed lifeless

* kologarn stone shout pair

* mimiron rapid burst

* mimiron laser barrage

* ignis scorch

* ignis grab initial

* ignis slag pot

* ulduar energy sap

* ulduar arachnopod damage

* xt tympanic tantrum

* xt gravity bomb damage

* xt gravity bomb pair

* xt searing light spwan life spark pair

* fl load into catapult

* fl auto repair

* fl systems shutdown

* fl pursue

* fl vehicle throw passenger

* fl tar blaze

* fl vehicle grab pyrite

* fl vehicle circuit overload

* fl orbital supports

* fl thorims hammer

* fl transitus shield beam

* fl shield generator

* fl demolisher ride vehicle

* yogg malady of the mind

* yogg brain_link pair

* yogg shadow beacon

* yogg destabilization matrix

* yogg titanic storm

* yogg lunatic gaze

* yogg protective gaze

* yogg empowered

* yogg insane periodic trigger

* yogg insane

* yogg sanity well

* yogg sanity reduce

* yogg empowering shadows

yogg empowering shadows

* yogg in the mwas of the old god

* yogg target selectors

* yogg grim reprisal

* add sql

* fixup! algalon phase punch

* fixup! algalon remove phase

* fixup! ic assembly meltdown

* vezax mark of the faceless periodic

* vezax mark of the faceless drainhealth

* vezax saronite vapors dummy

* vezax saronite vapors damage

* vezax aura of despair

vezax aura of despair style

vezax aura of despair add validate

* vezax aura of despair add validate hasspell

* Revert "vezax aura of despair add validate hasspell"

This reverts commit fccf163399a12119fc468c2fe41ea0798a55eefc.

* sort sql
This commit is contained in:
Jelle Meeus
2024-06-11 20:42:48 +02:00
committed by GitHub
parent 9684eb437a
commit 77d57efdd1
13 changed files with 1518 additions and 1982 deletions
@@ -0,0 +1,33 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_algalon_collapse_aura' WHERE `spell_id`=62018;
UPDATE `spell_script_names` SET `ScriptName`='spell_algalon_phase_punch_aura' WHERE `spell_id`=64412;
UPDATE `spell_script_names` SET `ScriptName`='spell_algalon_remove_phase_aura' WHERE `spell_id`=64445;
UPDATE `spell_script_names` SET `ScriptName`='spell_assembly_rune_of_summoning_aura' WHERE `spell_id`=62019;
UPDATE `spell_script_names` SET `ScriptName`='spell_aura_of_despair_aura' WHERE `spell_id`=62692;
UPDATE `spell_script_names` SET `ScriptName`='spell_ignis_scorch_aura' WHERE `spell_id` IN (62546, 63474);
UPDATE `spell_script_names` SET `ScriptName`='spell_ignis_slag_pot_aura' WHERE `spell_id` IN (62717, 63477);
UPDATE `spell_script_names` SET `ScriptName`='spell_load_into_catapult_aura' WHERE `spell_id`=64414;
UPDATE `spell_script_names` SET `ScriptName`='spell_mark_of_the_faceless_periodic_aura' WHERE `spell_id`=63276;
UPDATE `spell_script_names` SET `ScriptName`='spell_mimiron_p3wx2_laser_barrage_aura' WHERE `spell_id`=63274;
UPDATE `spell_script_names` SET `ScriptName`='spell_mimiron_rapid_burst_aura' WHERE `spell_id`=63382;
UPDATE `spell_script_names` SET `ScriptName`='spell_orbital_supports_aura' WHERE `spell_id` IN (64482, 65075, 65076, 65077);
UPDATE `spell_script_names` SET `ScriptName`='spell_saronite_vapors_dummy_aura' WHERE `spell_id`=63322;
UPDATE `spell_script_names` SET `ScriptName`='spell_shield_generator_aura' WHERE `spell_id`=64677;
UPDATE `spell_script_names` SET `ScriptName`='spell_shield_of_runes_aura' WHERE `spell_id` IN (62274, 63489);
UPDATE `spell_script_names` SET `ScriptName`='spell_systems_shutdown_aura' WHERE `spell_id`=62475;
UPDATE `spell_script_names` SET `ScriptName`='spell_tar_blaze_aura' WHERE `spell_id`=62292;
UPDATE `spell_script_names` SET `ScriptName`='spell_thorim_lightning_pillar_P2_aura' WHERE `spell_id`=62976;
UPDATE `spell_script_names` SET `ScriptName`='spell_thorim_trash_impale_aura' WHERE `spell_id` IN (62331, 62418);
UPDATE `spell_script_names` SET `ScriptName`='spell_transitus_shield_beam_aura' WHERE `spell_id`=48310;
UPDATE `spell_script_names` SET `ScriptName`='spell_ulduar_arachnopod_damaged_aura' WHERE `spell_id`=64770;
UPDATE `spell_script_names` SET `ScriptName`='spell_ulduar_energy_sap_aura' WHERE `spell_id` IN (64740, 64876);
UPDATE `spell_script_names` SET `ScriptName`='spell_ulduar_stone_grip_aura' WHERE `spell_id` IN (62056, 63985);
UPDATE `spell_script_names` SET `ScriptName`='spell_vehicle_circuit_overload_aura' WHERE `spell_id`=62399;
UPDATE `spell_script_names` SET `ScriptName`='spell_xt002_gravity_bomb' WHERE `spell_id` IN (63024, 64234);
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_empowered_aura' WHERE `spell_id`=64161;
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_grim_reprisal_aura' WHERE `spell_id`=63305;
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_insane_aura' WHERE `spell_id`=63120;
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_malady_of_the_mind_aura' WHERE `spell_id` IN (63830, 63881) AND `ScriptName` = 'spell_yogg_saron_malady_of_the_mind';
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_protective_gaze_aura' WHERE `spell_id`=64174 AND `ScriptName` = 'spell_yogg_saron_protective_gaze';
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_sanity_well_aura' WHERE `spell_id`=64169;
UPDATE `spell_script_names` SET `ScriptName`='spell_yogg_saron_shadow_beacon_aura' WHERE `spell_id`=64465;
@@ -1192,68 +1192,51 @@ public:
} }
}; };
class spell_algalon_phase_punch : public SpellScriptLoader class spell_algalon_phase_punch_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_algalon_phase_punch_aura);
spell_algalon_phase_punch() : SpellScriptLoader("spell_algalon_phase_punch") { }
class spell_algalon_phase_punch_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_algalon_phase_punch_AuraScript); return ValidateSpellInfo(PhasePunchAlphaId);
}
void HandlePeriodic(AuraEffect const* /*aurEff*/) void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetStackAmount() != 1)
GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]);
GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK);
if (GetStackAmount() == 5)
Remove(AURA_REMOVE_BY_DEFAULT);
}
void OnRemove(AuraEffect const*, AuraEffectHandleModes)
{
if (GetStackAmount() != 5)
GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_algalon_phase_punch_AuraScript(); PreventDefaultAction();
if (GetStackAmount() != 1)
GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]);
GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK);
if (GetStackAmount() == 5)
Remove(AURA_REMOVE_BY_DEFAULT);
}
void OnRemove(AuraEffect const*, AuraEffectHandleModes)
{
if (GetStackAmount() != 5)
GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_algalon_collapse : public SpellScriptLoader class spell_algalon_collapse_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_algalon_collapse_aura);
spell_algalon_collapse() : SpellScriptLoader("spell_algalon_collapse") { }
class spell_algalon_collapse_AuraScript : public AuraScript void HandlePeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_algalon_collapse_AuraScript); PreventDefaultAction();
Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(1), nullptr, NODAMAGE);
}
void HandlePeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
PreventDefaultAction();
Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(1), nullptr, NODAMAGE);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_algalon_collapse_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -1266,172 +1249,123 @@ public:
} }
}; };
class spell_algalon_trigger_3_adds : public SpellScriptLoader class spell_algalon_trigger_3_adds : public SpellScript
{ {
public: PrepareSpellScript(spell_algalon_trigger_3_adds);
spell_algalon_trigger_3_adds() : SpellScriptLoader("spell_algalon_trigger_3_adds") { }
class spell_algalon_trigger_3_adds_SpellScript : public SpellScript void SelectTarget(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript); targets.remove_if(ActiveConstellationFilter());
}
void SelectTarget(std::list<WorldObject*>& targets) void HandleDummyEffect(SpellEffIndex effIndex)
{
targets.remove_if(ActiveConstellationFilter());
}
void HandleDummyEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
target->AI()->DoAction(ACTION_ACTIVATE_STAR);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_algalon_trigger_3_adds_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_algalon_trigger_3_adds_SpellScript(); PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
target->AI()->DoAction(ACTION_ACTIVATE_STAR);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_algalon_trigger_3_adds::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_algalon_cosmic_smash_damage : public SpellScriptLoader class spell_algalon_cosmic_smash_damage : public SpellScript
{ {
public: PrepareSpellScript(spell_algalon_cosmic_smash_damage);
spell_algalon_cosmic_smash_damage() : SpellScriptLoader("spell_algalon_cosmic_smash_damage") { }
class spell_algalon_cosmic_smash_damage_SpellScript : public SpellScript void RecalculateDamage()
{ {
PrepareSpellScript(spell_algalon_cosmic_smash_damage_SpellScript); if (!GetExplTargetDest() || !GetHitUnit())
return;
void RecalculateDamage() float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY());
{ if (distance >= 10.0f)
if (!GetExplTargetDest() || !GetHitUnit()) SetHitDamage(int32(float(GetHitDamage()) / distance));
return; else if (distance > 6.0f)
SetHitDamage(int32(float(GetHitDamage()) / distance) * 2);
}
float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); void Register() override
if (distance >= 10.0f)
SetHitDamage(int32(float(GetHitDamage()) / distance));
else if (distance > 6.0f)
SetHitDamage(int32(float(GetHitDamage()) / distance) * 2);
}
void Register() override
{
OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_algalon_cosmic_smash_damage_SpellScript(); OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage::RecalculateDamage);
} }
}; };
class spell_algalon_big_bang : public SpellScriptLoader class spell_algalon_big_bang : public SpellScript
{ {
public: PrepareSpellScript(spell_algalon_big_bang);
spell_algalon_big_bang() : SpellScriptLoader("spell_algalon_big_bang") { }
class spell_algalon_big_bang_SpellScript : public SpellScript bool Load() override
{ {
PrepareSpellScript(spell_algalon_big_bang_SpellScript); _targetCount = 0;
return true;
}
bool Load() override void CountTargets(std::list<WorldObject*>& targets)
{
_targetCount = 0;
return true;
}
void CountTargets(std::list<WorldObject*>& targets)
{
_targetCount = targets.size();
}
void CheckTargets()
{
Unit* caster = GetCaster();
if (!_targetCount && caster && caster->GetAI())
caster->GetAI()->DoAction(ACTION_ASCEND);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets);
}
uint32 _targetCount;
};
SpellScript* GetSpellScript() const override
{ {
return new spell_algalon_big_bang_SpellScript(); _targetCount = targets.size();
}
void CheckTargets()
{
Unit* caster = GetCaster();
if (!_targetCount && caster && caster->GetAI())
caster->GetAI()->DoAction(ACTION_ASCEND);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_big_bang::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
AfterCast += SpellCastFn(spell_algalon_big_bang::CheckTargets);
}
private:
uint32 _targetCount;
};
class spell_algalon_remove_phase_aura : public AuraScript
{
PrepareAuraScript(spell_algalon_remove_phase_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_BLACK_HOLE_DAMAGE });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE);
GetTarget()->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_DAMAGE);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_algalon_remove_phase : public SpellScriptLoader class spell_algalon_supermassive_fail : public SpellScript
{ {
public: PrepareSpellScript(spell_algalon_supermassive_fail);
spell_algalon_remove_phase() : SpellScriptLoader("spell_algalon_remove_phase") { }
class spell_algalon_remove_phase_AuraScript : public AuraScript void RecalculateDamage()
{ {
PrepareAuraScript(spell_algalon_remove_phase_AuraScript); if (!GetHitPlayer())
return;
void HandlePeriodic(AuraEffect const* /*aurEff*/) GetHitPlayer()->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
{
PreventDefaultAction();
GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE);
GetTarget()->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_DAMAGE);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_algalon_remove_phase_AuraScript();
} }
};
class spell_algalon_supermassive_fail : public SpellScriptLoader void Register() override
{
public:
spell_algalon_supermassive_fail() : SpellScriptLoader("spell_algalon_supermassive_fail") { }
class spell_algalon_supermassive_fail_SpellScript : public SpellScript
{ {
PrepareSpellScript(spell_algalon_supermassive_fail_SpellScript); OnHit += SpellHitFn(spell_algalon_supermassive_fail::RecalculateDamage);
void RecalculateDamage()
{
if (!GetHitPlayer())
return;
GetHitPlayer()->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
}
void Register() override
{
OnHit += SpellHitFn(spell_algalon_supermassive_fail_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_algalon_supermassive_fail_SpellScript();
} }
}; };
@@ -1470,13 +1404,13 @@ void AddSC_boss_algalon_the_observer()
new go_celestial_planetarium_access(); new go_celestial_planetarium_access();
// Spells // Spells
new spell_algalon_phase_punch(); RegisterSpellScript(spell_algalon_phase_punch_aura);
new spell_algalon_collapse(); RegisterSpellScript(spell_algalon_collapse_aura);
new spell_algalon_trigger_3_adds(); RegisterSpellScript(spell_algalon_trigger_3_adds);
new spell_algalon_cosmic_smash_damage(); RegisterSpellScript(spell_algalon_cosmic_smash_damage);
new spell_algalon_big_bang(); RegisterSpellScript(spell_algalon_big_bang);
new spell_algalon_remove_phase(); RegisterSpellScript(spell_algalon_remove_phase_aura);
new spell_algalon_supermassive_fail(); RegisterSpellScript(spell_algalon_supermassive_fail);
// Achievements // Achievements
new achievement_algalon_he_feeds_on_your_tears(); new achievement_algalon_he_feeds_on_your_tears();
@@ -844,94 +844,71 @@ public:
}; };
}; };
class spell_shield_of_runes : public SpellScriptLoader class spell_shield_of_runes_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_shield_of_runes_aura);
spell_shield_of_runes() : SpellScriptLoader("spell_shield_of_runes") { }
class spell_shield_of_runes_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_shield_of_runes_AuraScript); return ValidateSpellInfo({ SPELL_SHIELD_OF_RUNES_BUFF });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Unit* owner = GetUnitOwner())
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && aurEff->GetAmount() <= 0)
owner->CastSpell(owner, SPELL_SHIELD_OF_RUNES_BUFF, false);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_shield_of_runes_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_shield_of_runes_AuraScript(); if (Unit* owner = GetUnitOwner())
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && aurEff->GetAmount() <= 0)
owner->CastSpell(owner, SPELL_SHIELD_OF_RUNES_BUFF, false);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_shield_of_runes_aura::OnRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_assembly_meltdown : public SpellScriptLoader class spell_assembly_meltdown : public SpellScript
{ {
public: PrepareSpellScript(spell_assembly_meltdown);
spell_assembly_meltdown() : SpellScriptLoader("spell_assembly_meltdown") { }
class spell_assembly_meltdown_SpellScript : public SpellScript void HandleInstaKill(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_assembly_meltdown_SpellScript); if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER)))
Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
}
void HandleInstaKill(SpellEffIndex /*effIndex*/) void Register() override
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER)))
Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_assembly_meltdown_SpellScript::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_assembly_meltdown_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_assembly_meltdown::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL);
} }
}; };
class spell_assembly_rune_of_summoning : public SpellScriptLoader class spell_assembly_rune_of_summoning_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_assembly_rune_of_summoning_aura);
spell_assembly_rune_of_summoning() : SpellScriptLoader("spell_assembly_rune_of_summoning") { }
class spell_assembly_rune_of_summoning_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_assembly_rune_of_summoning_AuraScript); return ValidateSpellInfo({ SPELL_RUNE_OF_SUMMONING_SUMMON });
}
void OnPeriodic(AuraEffect const* aurEff) void OnPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetTickNumber() % 2 == 0)
GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, nullptr, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (TempSummon* summ = GetTarget()->ToTempSummon())
summ->DespawnOrUnsummon(1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_assembly_rune_of_summoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectRemove += AuraEffectRemoveFn(spell_assembly_rune_of_summoning_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_assembly_rune_of_summoning_AuraScript(); PreventDefaultAction();
if (aurEff->GetTickNumber() % 2 == 0)
GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, nullptr, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (TempSummon* summ = GetTarget()->ToTempSummon())
summ->DespawnOrUnsummon(1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_assembly_rune_of_summoning_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectRemove += AuraEffectRemoveFn(spell_assembly_rune_of_summoning_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -978,9 +955,9 @@ void AddSC_boss_assembly_of_iron()
new boss_stormcaller_brundir(); new boss_stormcaller_brundir();
new npc_assembly_lightning(); new npc_assembly_lightning();
new spell_shield_of_runes(); RegisterSpellScript(spell_shield_of_runes_aura);
new spell_assembly_meltdown(); RegisterSpellScript(spell_assembly_meltdown);
new spell_assembly_rune_of_summoning(); RegisterSpellScript(spell_assembly_rune_of_summoning_aura);
new achievement_assembly_of_iron("achievement_but_im_on_your_side", 0); new achievement_assembly_of_iron("achievement_but_im_on_your_side", 0);
new achievement_assembly_of_iron("achievement_assembly_steelbreaker", NPC_STEELBREAKER); new achievement_assembly_of_iron("achievement_assembly_steelbreaker", NPC_STEELBREAKER);
@@ -432,29 +432,18 @@ public:
}; };
}; };
class spell_auriaya_sentinel_blast : public SpellScriptLoader class spell_auriaya_sentinel_blast : public SpellScript
{ {
public: PrepareSpellScript(spell_auriaya_sentinel_blast);
spell_auriaya_sentinel_blast() : SpellScriptLoader("spell_auriaya_sentinel_blast") { }
class spell_auriaya_sentinel_blast_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& unitList)
{ {
PrepareSpellScript(spell_auriaya_sentinel_blast_SpellScript); unitList.remove_if(PlayerOrPetCheck());
}
void FilterTargets(std::list<WorldObject*>& unitList) void Register() override
{
unitList.remove_if(PlayerOrPetCheck());
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_auriaya_sentinel_blast_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
@@ -496,7 +485,7 @@ void AddSC_boss_auriaya()
new npc_auriaya_sanctum_sentry(); new npc_auriaya_sanctum_sentry();
new npc_auriaya_feral_defender(); new npc_auriaya_feral_defender();
new spell_auriaya_sentinel_blast(); RegisterSpellScript(spell_auriaya_sentinel_blast);
new achievement_auriaya_crazy_cat_lady(); new achievement_auriaya_crazy_cat_lady();
new achievement_auriaya_nine_lives(); new achievement_auriaya_nine_lives();
@@ -1437,151 +1437,133 @@ public:
} }
}; };
class spell_load_into_catapult : public SpellScriptLoader enum LoadIntoCataPult
{ {
enum Spells SPELL_PASSENGER_LOADED = 62340
};
class spell_load_into_catapult_aura : public AuraScript
{
PrepareAuraScript(spell_load_into_catapult_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
SPELL_PASSENGER_LOADED = 62340, return ValidateSpellInfo({ SPELL_PASSENGER_LOADED });
}; }
public: void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
spell_load_into_catapult() : SpellScriptLoader("spell_load_into_catapult") { }
class spell_load_into_catapult_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_load_into_catapult_AuraScript); Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) owner->CastSpell(owner, SPELL_PASSENGER_LOADED, true);
{ }
Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
owner->CastSpell(owner, SPELL_PASSENGER_LOADED, true); void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
owner->RemoveAurasDueToSpell(SPELL_PASSENGER_LOADED);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_load_into_catapult_AuraScript::OnApply, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_load_into_catapult_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_load_into_catapult_AuraScript(); Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
owner->RemoveAurasDueToSpell(SPELL_PASSENGER_LOADED);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_load_into_catapult_aura::OnApply, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_load_into_catapult_aura::OnRemove, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
} }
}; };
class spell_auto_repair : public SpellScriptLoader enum AutoRepair
{ {
enum Spells SPELL_AUTO_REPAIR = 62705,
};
class spell_auto_repair : public SpellScript
{
PrepareSpellScript(spell_auto_repair);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
SPELL_AUTO_REPAIR = 62705, return ValidateSpellInfo({ SPELL_AUTO_REPAIR });
}; }
public: void FilterTargets(std::list<WorldObject*>& targets)
spell_auto_repair() : SpellScriptLoader("spell_auto_repair") {}
class spell_auto_repair_SpellScript : public SpellScript
{ {
PrepareSpellScript(spell_auto_repair_SpellScript); std::list<WorldObject*> tmplist;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (!(*itr)->ToUnit()->HasAura(SPELL_AUTO_REPAIR))
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*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) }
if (!(*itr)->ToUnit()->HasAura(SPELL_AUTO_REPAIR))
tmplist.push_back(*itr);
targets.clear(); void HandleScript(SpellEffIndex /*eff*/)
for (std::list<WorldObject*>::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr)
targets.push_back(*itr);
}
void HandleScript(SpellEffIndex /*eff*/)
{
Vehicle* vehicle = GetHitUnit()->GetVehicleKit();
if (!vehicle)
return;
Unit* driver = vehicle->GetPassenger(0);
if (!driver)
return;
//driver->TextEmote(VEHICLE_EMOTE_REPAIR, driver, true); // No source
// Actually should/could use basepoints (100) for this spell effect as percentage of health, but oh well.
vehicle->GetBase()->SetFullHealth();
// Achievement
if (InstanceScript* instance = vehicle->GetBase()->GetInstanceScript())
instance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auto_repair_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_auto_repair_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_auto_repair_SpellScript(); Vehicle* vehicle = GetHitUnit()->GetVehicleKit();
if (!vehicle)
return;
Unit* driver = vehicle->GetPassenger(0);
if (!driver)
return;
//driver->TextEmote(VEHICLE_EMOTE_REPAIR, driver, true); // No source
// Actually should/could use basepoints (100) for this spell effect as percentage of health, but oh well.
vehicle->GetBase()->SetFullHealth();
// Achievement
if (InstanceScript* instance = vehicle->GetBase()->GetInstanceScript())
instance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auto_repair::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_auto_repair::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_systems_shutdown : public SpellScriptLoader class spell_systems_shutdown_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_systems_shutdown_aura);
spell_systems_shutdown() : SpellScriptLoader("spell_systems_shutdown") { }
class spell_systems_shutdown_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_systems_shutdown_AuraScript); return ValidateSpellInfo({ SPELL_GATHERING_SPEED });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* owner = GetOwner()->ToCreature();
if (!owner)
return;
owner->SetControlled(true, UNIT_STATE_STUNNED);
owner->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
if (Vehicle* veh = owner->GetVehicleKit())
if (Unit* cannon = veh->GetPassenger(SEAT_CANNON))
cannon->GetAI()->DoAction(ACTION_DELAY_CANNON);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* owner = GetOwner()->ToCreature();
if (!owner)
return;
owner->SetControlled(false, UNIT_STATE_STUNNED);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_systems_shutdown_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_systems_shutdown_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_systems_shutdown_AuraScript(); Creature* owner = GetOwner()->ToCreature();
if (!owner)
return;
owner->SetControlled(true, UNIT_STATE_STUNNED);
owner->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
if (Vehicle* vehicle = owner->GetVehicleKit())
if (Unit* cannon = vehicle->GetPassenger(SEAT_CANNON))
cannon->GetAI()->DoAction(ACTION_DELAY_CANNON);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* owner = GetOwner()->ToCreature();
if (!owner)
return;
owner->SetControlled(false, UNIT_STATE_STUNNED);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_systems_shutdown_aura::OnApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_systems_shutdown_aura::OnRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -1625,431 +1607,344 @@ public:
} }
}; };
class spell_pursue : public SpellScriptLoader class spell_pursue : public SpellScript
{ {
public: PrepareSpellScript(spell_pursue);
spell_pursue() : SpellScriptLoader("spell_pursue") {}
class spell_pursue_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_pursue_SpellScript); targets.remove_if(FlameLeviathanPursuedTargetSelector());
if (targets.empty())
void FilterTargets(std::list<WorldObject*>& targets)
{ {
targets.remove_if(FlameLeviathanPursuedTargetSelector()); if (Creature* caster = GetCaster()->ToCreature())
if (targets.empty()) caster->AI()->EnterEvadeMode();
{
if (Creature* caster = GetCaster()->ToCreature())
caster->AI()->EnterEvadeMode();
}
else
{
//! In the end, only one target should be selected
WorldObject* _target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
if (_target)
targets.push_back(_target);
}
} }
else
void HandleScript(SpellEffIndex /*eff*/)
{ {
Creature* target = GetHitCreature(); //! In the end, only one target should be selected
Unit* caster = GetCaster(); WorldObject* _target = Acore::Containers::SelectRandomContainerElement(targets);
if (!target || !caster) targets.clear();
return; if (_target)
targets.push_back(_target);
caster->GetThreatMgr().ResetAllThreat();
caster->GetAI()->AttackStart(target); // Chase target
caster->AddThreat(target, 10000000.0f);
} }
}
void Register() override void HandleScript(SpellEffIndex /*eff*/)
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_pursue_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_pursue_SpellScript(); Creature* target = GetHitCreature();
Unit* caster = GetCaster();
if (!target || !caster)
return;
caster->GetThreatMgr().ResetAllThreat();
caster->GetAI()->AttackStart(target); // Chase target
caster->AddThreat(target, 10000000.0f);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_pursue::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
} }
}; };
class spell_vehicle_throw_passenger : public SpellScriptLoader class spell_vehicle_throw_passenger : public SpellScript
{ {
public: PrepareSpellScript(spell_vehicle_throw_passenger);
spell_vehicle_throw_passenger() : SpellScriptLoader("spell_vehicle_throw_passenger") {}
class spell_vehicle_throw_passenger_SpellScript : public SpellScript void HandleScript()
{ {
PrepareSpellScript(spell_vehicle_throw_passenger_SpellScript); Spell* baseSpell = GetSpell();
void HandleScript() SpellCastTargets targets = baseSpell->m_targets;
{ if (Vehicle* vehicle = GetCaster()->GetVehicleKit())
Spell* baseSpell = GetSpell(); if (Unit* passenger = vehicle->GetPassenger(3))
SpellCastTargets targets = baseSpell->m_targets; {
if (Vehicle* vehicle = GetCaster()->GetVehicleKit()) // use 99 because it is 3d search
if (Unit* passenger = vehicle->GetPassenger(3)) std::list<WorldObject*> targetList;
Acore::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, nullptr);
Acore::WorldObjectListSearcher<Acore::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check);
Cell::VisitAllObjects(GetCaster(), searcher, 99.0f);
float minDist = 99 * 99;
Unit* target = nullptr;
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{ {
// use 99 because it is 3d search if (Unit* unit = (*itr)->ToUnit())
std::list<WorldObject*> targetList; if (unit->GetEntry() == NPC_SEAT)
Acore::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, nullptr); if (Vehicle* seat = unit->GetVehicleKit())
Acore::WorldObjectListSearcher<Acore::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check); if (!seat->GetPassenger(0))
Cell::VisitAllObjects(GetCaster(), searcher, 99.0f); if (Unit* device = seat->GetPassenger(2))
float minDist = 99 * 99; if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
Unit* target = nullptr; {
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) float dist = unit->GetExactDistSq(targets.GetDstPos());
{ if (dist < minDist)
if (Unit* unit = (*itr)->ToUnit())
if (unit->GetEntry() == NPC_SEAT)
if (Vehicle* seat = unit->GetVehicleKit())
if (!seat->GetPassenger(0))
if (Unit* device = seat->GetPassenger(2))
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{ {
float dist = unit->GetExactDistSq(targets.GetDstPos()); minDist = dist;
if (dist < minDist) target = unit;
{
minDist = dist;
target = unit;
}
} }
} }
if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[EFFECT_0].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
{
passenger->ExitVehicle();
passenger->EnterVehicle(target, 0);
}
else
{
passenger->ExitVehicle();
float x, y, z;
targets.GetDstPos()->GetPosition(x, y, z);
passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ());
}
} }
} if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[EFFECT_0].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
void Register() override
{
AfterCast += SpellCastFn(spell_vehicle_throw_passenger_SpellScript::HandleScript);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_vehicle_throw_passenger_SpellScript();
}
};
class spell_tar_blaze : public SpellScriptLoader
{
public:
spell_tar_blaze() : SpellScriptLoader("spell_tar_blaze") { }
class spell_tar_blaze_AuraScript : public AuraScript
{
PrepareAuraScript(spell_tar_blaze_AuraScript);
void OnPeriodic(AuraEffect const* aurEff)
{
GetUnitOwner()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_tar_blaze_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_tar_blaze_AuraScript();
}
};
class spell_vehicle_grab_pyrite : public SpellScriptLoader
{
public:
spell_vehicle_grab_pyrite() : SpellScriptLoader("spell_vehicle_grab_pyrite") {}
class spell_vehicle_grab_pyrite_SpellScript : public SpellScript
{
PrepareSpellScript(spell_vehicle_grab_pyrite_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (Unit* seat = GetCaster()->GetVehicleBase())
{ {
if (Vehicle* vSeat = seat->GetVehicleKit()) passenger->ExitVehicle();
if (Unit* pyrite = vSeat->GetPassenger(1)) passenger->EnterVehicle(target, 0);
pyrite->ExitVehicle();
if (Unit* parent = seat->GetVehicleBase())
{
GetCaster()->CastSpell(parent, 62496 /*SPELL_ADD_PYRITE*/, true);
target->CastSpell(seat, GetEffectValue());
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(1300);
}
} }
} else
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_vehicle_grab_pyrite_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_vehicle_grab_pyrite_SpellScript();
}
};
class spell_vehicle_circuit_overload : public SpellScriptLoader
{
public:
spell_vehicle_circuit_overload() : SpellScriptLoader("spell_vehicle_circuit_overload") { }
class spell_vehicle_circuit_overload_AuraScript : public AuraScript
{
PrepareAuraScript(spell_vehicle_circuit_overload_AuraScript);
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* target = GetTarget())
if (int(target->GetAppliedAuras().count(SPELL_OVERLOAD_CIRCUIT)) >= (target->GetMap()->Is25ManRaid() ? 4 : 2))
{ {
target->CastSpell(target, SPELL_SYSTEMS_SHUTDOWN, true); passenger->ExitVehicle();
target->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT); float x, y, z;
targets.GetDstPos()->GetPosition(x, y, z);
passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ());
} }
} }
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_vehicle_circuit_overload_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_vehicle_circuit_overload_AuraScript(); AfterCast += SpellCastFn(spell_vehicle_throw_passenger::HandleScript);
} }
}; };
class spell_orbital_supports : public SpellScriptLoader class spell_tar_blaze_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_tar_blaze_aura);
spell_orbital_supports() : SpellScriptLoader("spell_orbital_supports") { }
class spell_orbital_supports_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* aurEff)
{ {
PrepareAuraScript(spell_orbital_supports_AuraScript); GetUnitOwner()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
bool CheckAreaTarget(Unit* target) void Register() override
{
return target->GetEntry() == NPC_LEVIATHAN;
}
void Register() override
{
DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_orbital_supports_AuraScript::CheckAreaTarget);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_orbital_supports_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_tar_blaze_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_thorims_hammer : public SpellScriptLoader enum VehicleGrabPyrite
{ {
public: SPELL_ADD_PYRITE = 62496
spell_thorims_hammer() : SpellScriptLoader("spell_thorims_hammer") { } };
class spell_thorims_hammer_SpellScript : public SpellScript class spell_vehicle_grab_pyrite : public SpellScript
{
PrepareSpellScript(spell_vehicle_grab_pyrite);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_thorims_hammer_SpellScript); return ValidateSpellInfo({ SPELL_ADD_PYRITE });
}
void RecalculateDamage(SpellEffIndex effIndex) void HandleScript(SpellEffIndex /*effIndex*/)
{
if (!GetHitUnit() || effIndex == EFFECT_1)
{
PreventHitDefaultEffect(effIndex);
return;
}
float dist = GetHitUnit()->GetExactDist2d(GetCaster());
if (dist <= 7.0f)
{
SetHitDamage(GetSpellInfo()->Effects[EFFECT_1].CalcValue());
}
else
{
dist -= 6.0f;
SetHitDamage(int32(GetSpellInfo()->Effects[EFFECT_1].CalcValue() / std::max(dist, 1.0f)));
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_thorims_hammer_SpellScript::RecalculateDamage, EFFECT_ALL, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_thorims_hammer_SpellScript(); if (Unit* target = GetHitUnit())
if (Unit* seat = GetCaster()->GetVehicleBase())
{
if (Vehicle* vehicle = seat->GetVehicleKit())
if (Unit* pyrite = vehicle->GetPassenger(1))
pyrite->ExitVehicle();
if (Unit* parent = seat->GetVehicleBase())
{
GetCaster()->CastSpell(parent, SPELL_ADD_PYRITE, true);
target->CastSpell(seat, GetEffectValue());
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(1300);
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_vehicle_grab_pyrite::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_transitus_shield_beam : public SpellScriptLoader class spell_vehicle_circuit_overload_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_vehicle_circuit_overload_aura);
spell_transitus_shield_beam() : SpellScriptLoader("spell_transitus_shield_beam") { }
class spell_transitus_shield_beam_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_transitus_shield_beam_AuraScript); return ValidateSpellInfo({ SPELL_SYSTEMS_SHUTDOWN });
}
void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void OnPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* caster = GetCaster();
if (!caster)
{
return;
}
Unit* target = GetTarget();
if (!target)
{
return;
}
switch (aurEff->GetEffIndex())
{
case EFFECT_0:
caster->AddAura(SPELL_TRANSITUS_SHIELD_IMPACT, target);
break;
}
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
{
return;
}
Unit* target = GetTarget();
if (target)
{
target->RemoveAurasDueToSpell(SPELL_TRANSITUS_SHIELD_IMPACT);
}
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_transitus_shield_beam_AuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_transitus_shield_beam_AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_transitus_shield_beam_AuraScript(); if (Unit* target = GetTarget())
if (int(target->GetAppliedAuras().count(SPELL_OVERLOAD_CIRCUIT)) >= (target->GetMap()->Is25ManRaid() ? 4 : 2))
{
target->CastSpell(target, SPELL_SYSTEMS_SHUTDOWN, true);
target->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_vehicle_circuit_overload_aura::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_shield_generator : public SpellScriptLoader class spell_orbital_supports_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_orbital_supports_aura);
spell_shield_generator() : SpellScriptLoader("spell_shield_generator") { }
class spell_shield_generator_AuraScript : public AuraScript bool CheckAreaTarget(Unit* target)
{ {
PrepareAuraScript(spell_shield_generator_AuraScript); return target->GetEntry() == NPC_LEVIATHAN;
}
uint32 absorbPct; void Register() override
bool Load() override
{
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_shield_generator_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_shield_generator_AuraScript::Absorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_shield_generator_AuraScript(); DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_orbital_supports_aura::CheckAreaTarget);
} }
}; };
class spell_demolisher_ride_vehicle : public SpellScriptLoader class spell_thorims_hammer : public SpellScript
{ {
public: PrepareSpellScript(spell_thorims_hammer);
spell_demolisher_ride_vehicle() : SpellScriptLoader("spell_demolisher_ride_vehicle") {}
class spell_demolisher_ride_vehicle_SpellScript : public SpellScript void RecalculateDamage(SpellEffIndex effIndex)
{ {
PrepareSpellScript(spell_demolisher_ride_vehicle_SpellScript); if (!GetHitUnit() || effIndex == EFFECT_1)
SpellCastResult CheckCast()
{ {
if (GetCaster()->GetTypeId() != TYPEID_PLAYER) PreventHitDefaultEffect(effIndex);
return SPELL_CAST_OK; return;
}
Unit* target = this->GetExplTargetUnit(); float dist = GetHitUnit()->GetExactDist2d(GetCaster());
if (!target || target->GetEntry() != NPC_SALVAGED_DEMOLISHER) if (dist <= 7.0f)
return SPELL_FAILED_DONT_REPORT; {
SetHitDamage(GetSpellInfo()->Effects[EFFECT_1].CalcValue());
}
else
{
dist -= 6.0f;
SetHitDamage(int32(GetSpellInfo()->Effects[EFFECT_1].CalcValue() / std::max(dist, 1.0f)));
}
}
Vehicle* veh = target->GetVehicleKit(); void Register() override
if (veh && veh->GetPassenger(0)) {
if (Unit* target2 = veh->GetPassenger(1)) OnEffectHitTarget += SpellEffectFn(spell_thorims_hammer::RecalculateDamage, EFFECT_ALL, SPELL_EFFECT_SCHOOL_DAMAGE);
if (Vehicle* veh2 = target2->GetVehicleKit()) }
{ };
if (!veh2->GetPassenger(0))
target2->HandleSpellClick(GetCaster());
return SPELL_FAILED_DONT_REPORT; class spell_transitus_shield_beam_aura : public AuraScript
} {
PrepareAuraScript(spell_transitus_shield_beam_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_TRANSITUS_SHIELD_IMPACT });
}
void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
{
return;
}
Unit* target = GetTarget();
if (!target)
{
return;
}
switch (aurEff->GetEffIndex())
{
case EFFECT_0:
caster->AddAura(SPELL_TRANSITUS_SHIELD_IMPACT, target);
break;
}
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
{
return;
}
Unit* target = GetTarget();
if (target)
{
target->RemoveAurasDueToSpell(SPELL_TRANSITUS_SHIELD_IMPACT);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_transitus_shield_beam_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_transitus_shield_beam_aura::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
class spell_shield_generator_aura : public AuraScript
{
PrepareAuraScript(spell_shield_generator_aura);
bool Load() override
{
_absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = CalculatePct(dmgInfo.GetDamage(), _absorbPct);
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_shield_generator_aura::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_shield_generator_aura::Absorb, EFFECT_0);
}
private:
uint32 _absorbPct;
};
class spell_demolisher_ride_vehicle : public SpellScript
{
PrepareSpellScript(spell_demolisher_ride_vehicle);
SpellCastResult CheckCast()
{
if (GetCaster()->GetTypeId() != TYPEID_PLAYER)
return SPELL_CAST_OK; return SPELL_CAST_OK;
}
void Register() override Unit* target = this->GetExplTargetUnit();
{ if (!target || target->GetEntry() != NPC_SALVAGED_DEMOLISHER)
OnCheckCast += SpellCheckCastFn(spell_demolisher_ride_vehicle_SpellScript::CheckCast); return SPELL_FAILED_DONT_REPORT;
}
};
SpellScript* GetSpellScript() const override Vehicle* vehicle = target->GetVehicleKit();
if (vehicle && vehicle->GetPassenger(0))
if (Unit* target2 = vehicle->GetPassenger(1))
if (Vehicle* vehicle2 = target2->GetVehicleKit())
{
if (!vehicle2->GetPassenger(0))
target2->HandleSpellClick(GetCaster());
return SPELL_FAILED_DONT_REPORT;
}
return SPELL_CAST_OK;
}
void Register() override
{ {
return new spell_demolisher_ride_vehicle_SpellScript(); OnCheckCast += SpellCheckCastFn(spell_demolisher_ride_vehicle::CheckCast);
} }
}; };
@@ -2143,19 +2038,19 @@ void AddSC_boss_flame_leviathan()
new go_ulduar_tower(); new go_ulduar_tower();
// Spells // Spells
new spell_load_into_catapult(); RegisterSpellScript(spell_load_into_catapult_aura);
new spell_auto_repair(); RegisterSpellScript(spell_auto_repair);
new spell_systems_shutdown(); RegisterSpellScript(spell_systems_shutdown_aura);
new spell_pursue(); RegisterSpellScript(spell_pursue);
new spell_vehicle_throw_passenger(); RegisterSpellScript(spell_vehicle_throw_passenger);
new spell_tar_blaze(); RegisterSpellScript(spell_tar_blaze_aura);
new spell_vehicle_grab_pyrite(); RegisterSpellScript(spell_vehicle_grab_pyrite);
new spell_vehicle_circuit_overload(); RegisterSpellScript(spell_vehicle_circuit_overload_aura);
new spell_orbital_supports(); RegisterSpellScript(spell_orbital_supports_aura);
new spell_thorims_hammer(); RegisterSpellScript(spell_thorims_hammer);
new spell_transitus_shield_beam(); RegisterSpellScript(spell_transitus_shield_beam_aura);
new spell_shield_generator(); RegisterSpellScript(spell_shield_generator_aura);
new spell_demolisher_ride_vehicle(); RegisterSpellScript(spell_demolisher_ride_vehicle);
// Achievements // Achievements
new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_bombardment", 1); new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_bombardment", 1);
@@ -472,173 +472,138 @@ public:
}; };
}; };
class spell_aura_of_despair : public SpellScriptLoader class spell_aura_of_despair_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_aura_of_despair_aura);
spell_aura_of_despair() : SpellScriptLoader("spell_aura_of_despair") { }
class spell_aura_of_despair_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_aura_of_despair_AuraScript) return ValidateSpellInfo({ SPELL_AURA_OF_DESPAIR_2, SPELL_CORRUPTED_RAGE, SPELL_CORRUPTED_WISDOM });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->CastSpell(target, SPELL_AURA_OF_DESPAIR_2, true);
if( target->HasSpell(SPELL_SHAMANISTIC_RAGE) )
caster->CastSpell(target, SPELL_CORRUPTED_RAGE, true);
else if( target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 + 1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 + 2) )
caster->CastSpell(target, SPELL_CORRUPTED_WISDOM, true);
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget()) if (Unit* target = GetTarget())
{ {
target->RemoveAurasDueToSpell(SPELL_AURA_OF_DESPAIR_2); if (target->GetTypeId() != TYPEID_PLAYER)
target->RemoveAurasDueToSpell(SPELL_CORRUPTED_RAGE); return;
target->RemoveAurasDueToSpell(SPELL_CORRUPTED_WISDOM);
target->CastSpell(target, SPELL_AURA_OF_DESPAIR_2, true);
if (target->HasSpell(SPELL_SHAMANISTIC_RAGE))
caster->CastSpell(target, SPELL_CORRUPTED_RAGE, true);
else if (target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 + 1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 + 2))
caster->CastSpell(target, SPELL_CORRUPTED_WISDOM, true);
} }
} }
void Register() override void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
OnEffectApply += AuraEffectApplyFn(spell_aura_of_despair_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_aura_of_despair_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_aura_of_despair_AuraScript(); if (Unit* target = GetTarget())
{
target->RemoveAurasDueToSpell(SPELL_AURA_OF_DESPAIR_2);
target->RemoveAurasDueToSpell(SPELL_CORRUPTED_RAGE);
target->RemoveAurasDueToSpell(SPELL_CORRUPTED_WISDOM);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_aura_of_despair_aura::OnApply, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_aura_of_despair_aura::OnRemove, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_mark_of_the_faceless_periodic : public SpellScriptLoader class spell_mark_of_the_faceless_periodic_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_mark_of_the_faceless_periodic_aura);
spell_mark_of_the_faceless_periodic() : SpellScriptLoader("spell_mark_of_the_faceless_periodic") { }
class spell_mark_of_the_faceless_periodic_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_mark_of_the_faceless_periodic_AuraScript) return ValidateSpellInfo({ SPELL_MARK_OF_THE_FACELESS_EFFECT });
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
if (target->GetMapId() == 603)
{
int32 dmg = 5000;
caster->CastCustomSpell(target, SPELL_MARK_OF_THE_FACELESS_EFFECT, 0, &dmg, 0, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_the_faceless_periodic_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_mark_of_the_faceless_periodic_AuraScript();
} }
};
class spell_mark_of_the_faceless_drainhealth : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
public:
spell_mark_of_the_faceless_drainhealth() : SpellScriptLoader("spell_mark_of_the_faceless_drainhealth") { }
class spell_mark_of_the_faceless_drainhealth_SpellScript : public SpellScript
{ {
PrepareSpellScript(spell_mark_of_the_faceless_drainhealth_SpellScript); if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
void FilterTargets(std::list<WorldObject*>& targets) if (target->GetMapId() == 603)
{
targets.remove(GetExplTargetUnit());
if (targets.empty())
Cancel();
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_the_faceless_drainhealth_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_mark_of_the_faceless_drainhealth_SpellScript();
}
};
class spell_saronite_vapors_dummy : public SpellScriptLoader
{
public:
spell_saronite_vapors_dummy() : SpellScriptLoader("spell_saronite_vapors_dummy") { }
class spell_saronite_vapors_dummy_AuraScript : public AuraScript
{
PrepareAuraScript(spell_saronite_vapors_dummy_AuraScript)
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
int32 damage = 100 * pow(2.0f, (float)GetStackAmount());
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, nullptr, nullptr, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_saronite_vapors_dummy_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_saronite_vapors_dummy_AuraScript();
}
};
class spell_saronite_vapors_damage : public SpellScriptLoader
{
public:
spell_saronite_vapors_damage() : SpellScriptLoader("spell_saronite_vapors_damage") { }
class spell_saronite_vapors_damage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_saronite_vapors_damage_SpellScript);
void HandleAfterHit()
{
if (Unit* caster = GetCaster())
if (GetHitDamage() > 2)
{ {
int32 mana = GetHitDamage() / 2; int32 dmg = 5000;
if (Unit* t = GetHitUnit()) caster->CastCustomSpell(target, SPELL_MARK_OF_THE_FACELESS_EFFECT, 0, &dmg, 0, true);
caster->CastCustomSpell(t, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, nullptr, nullptr, true);
} }
} }
void Register() override void Register() override
{
AfterHit += SpellHitFn(spell_saronite_vapors_damage_SpellScript::HandleAfterHit);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_saronite_vapors_damage_SpellScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_the_faceless_periodic_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_mark_of_the_faceless_drainhealth : public SpellScript
{
PrepareSpellScript(spell_mark_of_the_faceless_drainhealth);
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove(GetExplTargetUnit());
if (targets.empty())
Cancel();
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_the_faceless_drainhealth::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
class spell_saronite_vapors_dummy_aura : public AuraScript
{
PrepareAuraScript(spell_saronite_vapors_dummy_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SARONITE_VAPORS_DMG });
}
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
int32 damage = 100 * pow(2.0f, (float)GetStackAmount());
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, nullptr, nullptr, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_saronite_vapors_dummy_aura::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
class spell_saronite_vapors_damage : public SpellScript
{
PrepareSpellScript(spell_saronite_vapors_damage);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SARONITE_VAPORS_ENERGIZE });
}
void HandleAfterHit()
{
if (Unit* caster = GetCaster())
if (GetHitDamage() > 2)
{
int32 mana = GetHitDamage() / 2;
if (Unit* target = GetHitUnit())
caster->CastCustomSpell(target, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, nullptr, nullptr, true);
}
}
void Register() override
{
AfterHit += SpellHitFn(spell_saronite_vapors_damage::HandleAfterHit);
} }
}; };
@@ -693,11 +658,11 @@ void AddSC_boss_vezax()
new npc_ulduar_saronite_vapors(); new npc_ulduar_saronite_vapors();
new npc_ulduar_saronite_animus(); new npc_ulduar_saronite_animus();
new spell_aura_of_despair(); RegisterSpellScript(spell_aura_of_despair_aura);
new spell_mark_of_the_faceless_periodic(); RegisterSpellScript(spell_mark_of_the_faceless_periodic_aura);
new spell_mark_of_the_faceless_drainhealth(); RegisterSpellScript(spell_mark_of_the_faceless_drainhealth);
new spell_saronite_vapors_dummy(); RegisterSpellScript(spell_saronite_vapors_dummy_aura);
new spell_saronite_vapors_damage(); RegisterSpellScript(spell_saronite_vapors_damage);
new achievement_smell_saronite(); new achievement_smell_saronite();
new achievement_shadowdodger(); new achievement_shadowdodger();
@@ -426,112 +426,112 @@ public:
}; };
}; };
class spell_ignis_scorch : public SpellScriptLoader class spell_ignis_scorch_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_ignis_scorch_aura);
spell_ignis_scorch() : SpellScriptLoader("spell_ignis_scorch") { }
class spell_ignis_scorch_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_ignis_scorch_AuraScript) return ValidateSpellInfo( { SPELL_SCORCHED_GROUND_10, SPELL_SCORCHED_GROUND_25 });
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* c = GetCaster())
if (Creature* s = c->SummonCreature(NPC_SCORCHED_GROUND, c->GetPositionX() + 20.0f * cos(c->GetOrientation()), c->GetPositionY() + 20.0f * std::sin(c->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000))
{
if (!s->FindNearestCreature(NPC_WATER_TRIGGER, 25.0f, true)) // must be away from the water
s->CastSpell(s, (aurEff->GetId() == 62546 ? SPELL_SCORCHED_GROUND_10 : SPELL_SCORCHED_GROUND_25), true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_scorch_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ignis_scorch_AuraScript(); if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* caster = GetCaster())
if (Creature* summon = caster->SummonCreature(NPC_SCORCHED_GROUND, caster->GetPositionX() + 20.0f * cos(caster->GetOrientation()), caster->GetPositionY() + 20.0f * std::sin(caster->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000))
{
if (!summon->FindNearestCreature(NPC_WATER_TRIGGER, 25.0f, true)) // must be away from the water
summon->CastSpell(summon, (aurEff->GetId() == SPELL_SCORCH_10 ? SPELL_SCORCHED_GROUND_10 : SPELL_SCORCHED_GROUND_25), true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_scorch_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_ignis_grab_initial : public SpellScriptLoader class spell_ignis_grab_initial : public SpellScript
{ {
public: PrepareSpellScript(spell_ignis_grab_initial);
spell_ignis_grab_initial() : SpellScriptLoader("spell_ignis_grab_initial") { }
class spell_ignis_grab_initial_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_ignis_grab_initial_SpellScript); return ValidateSpellInfo( { SPELL_GRAB_TRIGGERED });
}
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* t = GetHitUnit())
t->CastSpell(t, SPELL_GRAB_TRIGGERED, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ignis_grab_initial_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_ignis_grab_initial_SpellScript(); if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_GRAB_TRIGGERED, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ignis_grab_initial::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_ignis_slag_pot : public SpellScriptLoader enum SlagPot
{ {
public: SPELL_SLAG_POT_DAMAGE_1 = 65722,
spell_ignis_slag_pot() : SpellScriptLoader("spell_ignis_slag_pot") { } SPELL_SLAG_POT_DAMAGE_2 = 65723,
SPELL_SCORCH_DAMAGE_1 = 62549,
SPELL_SCORCH_DAMAGE_2 = 63475,
SPELL_SLAG_IMBUED_1 = 62836,
SPELL_SLAG_IMBUED_2 = 63536
};
class spell_ignis_slag_pot_AuraScript : public AuraScript class spell_ignis_slag_pot_aura : public AuraScript
{
PrepareAuraScript(spell_ignis_slag_pot_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_ignis_slag_pot_AuraScript) return ValidateSpellInfo(
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* c = GetCaster())
if (Unit* t = GetTarget())
c->CastSpell(t, (GetId() == 62717 ? 65722 : 65723), true);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* t = GetTarget())
{ {
t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, true); SPELL_SLAG_POT_DAMAGE_1,
t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, true); SPELL_SLAG_POT_DAMAGE_2,
} SPELL_SCORCH_DAMAGE_1,
} SPELL_SCORCH_DAMAGE_2,
SPELL_SLAG_IMBUED_1,
SPELL_SLAG_IMBUED_2
});
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* t = GetTarget())
{
t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, false);
t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, false);
if (t->IsAlive())
t->CastSpell(t, (GetId() == 62717 ? 62836 : 63536), true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_slag_pot_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_ignis_slag_pot_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_ignis_slag_pot_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ignis_slag_pot_AuraScript(); if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
caster->CastSpell(target, (GetId() == SPELL_SLAG_POT_10 ? SPELL_SLAG_POT_DAMAGE_1 : SPELL_SLAG_POT_DAMAGE_2), true);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
{
target->ApplySpellImmune(GetId(), IMMUNITY_ID, SPELL_SCORCH_DAMAGE_1, true);
target->ApplySpellImmune(GetId(), IMMUNITY_ID, SPELL_SCORCH_DAMAGE_2, true);
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
{
target->ApplySpellImmune(GetId(), IMMUNITY_ID, SPELL_SCORCH_DAMAGE_1, false);
target->ApplySpellImmune(GetId(), IMMUNITY_ID, SPELL_SCORCH_DAMAGE_2, false);
if (target->IsAlive())
target->CastSpell(target, (GetId() == SPELL_SLAG_POT_10 ? SPELL_SLAG_IMBUED_1 : SPELL_SLAG_IMBUED_2), true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_slag_pot_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_ignis_slag_pot_aura::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_ignis_slag_pot_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -552,8 +552,8 @@ void AddSC_boss_ignis()
{ {
new boss_ignis(); new boss_ignis();
new npc_ulduar_iron_construct(); new npc_ulduar_iron_construct();
new spell_ignis_scorch(); RegisterSpellScript(spell_ignis_scorch_aura);
new spell_ignis_grab_initial(); RegisterSpellScript(spell_ignis_grab_initial);
new spell_ignis_slag_pot(); RegisterSpellScript(spell_ignis_slag_pot_aura);
new achievement_ignis_shattered(); new achievement_ignis_shattered();
} }
@@ -718,156 +718,107 @@ private:
Unit const* _victim; Unit const* _victim;
}; };
class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader class spell_ulduar_stone_grip_cast_target : public SpellScript
{ {
public: PrepareSpellScript(spell_ulduar_stone_grip_cast_target);
spell_ulduar_stone_grip_cast_target() : SpellScriptLoader("spell_ulduar_stone_grip_cast_target") { }
class spell_ulduar_stone_grip_cast_target_SpellScript : public SpellScript bool Load() override
{ {
PrepareSpellScript(spell_ulduar_stone_grip_cast_target_SpellScript); if (GetCaster()->GetTypeId() != TYPEID_UNIT)
return false;
return true;
}
bool Load() override void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
if (GetCaster()->GetTypeId() != TYPEID_UNIT)
return false;
return true;
}
void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
// Remove "main tank" and non-player targets
targets.remove_if (StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->GetVictim()));
// Maximum affected targets per difficulty mode
uint32 maxTargets = 1;
if (GetSpellInfo()->Id == 63981)
maxTargets = 3;
// Return a random amount of targets based on maxTargets
while (maxTargets < targets.size())
{
std::list<WorldObject*>::iterator itr = targets.begin();
advance(itr, urand(0, targets.size() - 1));
targets.erase(itr);
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_ulduar_stone_grip_cast_target_SpellScript(); // Remove "main tank" and non-player targets
targets.remove_if (StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->GetVictim()));
// Maximum affected targets per difficulty mode
uint32 maxTargets = 1;
if (GetSpellInfo()->Id == 63981)
maxTargets = 3;
// Return a random amount of targets based on maxTargets
while (maxTargets < targets.size())
{
std::list<WorldObject*>::iterator itr = targets.begin();
advance(itr, urand(0, targets.size() - 1));
targets.erase(itr);
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target::FilterTargetsInitial, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
class spell_ulduar_stone_grip : public SpellScriptLoader class spell_ulduar_stone_grip_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_ulduar_stone_grip_aura);
spell_ulduar_stone_grip() : SpellScriptLoader("spell_ulduar_stone_grip") { }
class spell_ulduar_stone_grip_AuraScript : public AuraScript void OnRemoveStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_ulduar_stone_grip_AuraScript); if (Player* owner = GetOwner()->ToPlayer())
owner->RemoveAurasDueToSpell(aurEff->GetAmount());
}
void OnRemoveStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void Register() override
{
if (Player* owner = GetOwner()->ToPlayer())
owner->RemoveAurasDueToSpell(aurEff->GetAmount());
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_ulduar_stone_grip_AuraScript::OnRemoveStun, EFFECT_2, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ulduar_stone_grip_AuraScript(); OnEffectRemove += AuraEffectRemoveFn(spell_ulduar_stone_grip_aura::OnRemoveStun, EFFECT_2, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_ulduar_squeezed_lifeless : public SpellScriptLoader class spell_ulduar_squeezed_lifeless : public SpellScript
{ {
public: PrepareSpellScript(spell_ulduar_squeezed_lifeless);
spell_ulduar_squeezed_lifeless() : SpellScriptLoader("spell_ulduar_squeezed_lifeless") { }
class spell_ulduar_squeezed_lifeless_SpellScript : public SpellScript void HandleInstaKill(SpellEffIndex /*effIndex*/)
{ {
PrepareSpellScript(spell_ulduar_squeezed_lifeless_SpellScript); if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle())
return;
void HandleInstaKill(SpellEffIndex /*effIndex*/) // Hack to set correct position is in _ExitVehicle()
{ GetHitPlayer()->ExitVehicle();
if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle()) }
return;
// Hack to set correct position is in _ExitVehicle() void Register() override
GetHitPlayer()->ExitVehicle();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ulduar_squeezed_lifeless_SpellScript::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_ulduar_squeezed_lifeless_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_ulduar_squeezed_lifeless::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL);
} }
}; };
class spell_kologarn_stone_shout : public SpellScriptLoader class spell_kologarn_stone_shout : public SpellScript
{ {
public: PrepareSpellScript(spell_kologarn_stone_shout);
spell_kologarn_stone_shout() : SpellScriptLoader("spell_kologarn_stone_shout") { }
class spell_kologarn_stone_shout_AuraScript : public AuraScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareAuraScript(spell_kologarn_stone_shout_AuraScript); targets.remove_if (PlayerOrPetCheck());
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
uint32 triggerSpellId = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
if (Unit* caster = GetCaster())
caster->CastSpell(caster, triggerSpellId, false);
}
void Register() override
{
if (m_scriptSpellId == SPELL_STONE_SHOUT_10 || m_scriptSpellId == SPELL_STONE_SHOUT_25)
OnEffectPeriodic += AuraEffectPeriodicFn(spell_kologarn_stone_shout_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_kologarn_stone_shout_AuraScript();
} }
class spell_kologarn_stone_shout_SpellScript : public SpellScript void Register() override
{ {
PrepareSpellScript(spell_kologarn_stone_shout_SpellScript); if (m_scriptSpellId != SPELL_STONE_SHOUT_10 && m_scriptSpellId != SPELL_STONE_SHOUT_25)
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
void FilterTargets(std::list<WorldObject*>& targets) class spell_kologarn_stone_shout_aura : public AuraScript
{ {
targets.remove_if (PlayerOrPetCheck()); PrepareAuraScript(spell_kologarn_stone_shout_aura);
}
void Register() override void OnPeriodic(AuraEffect const* /*aurEff*/)
{
if (m_scriptSpellId != SPELL_STONE_SHOUT_10 && m_scriptSpellId != SPELL_STONE_SHOUT_25)
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_kologarn_stone_shout_SpellScript(); uint32 triggerSpellId = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
if (Unit* caster = GetCaster())
caster->CastSpell(caster, triggerSpellId, false);
}
void Register() override
{
if (m_scriptSpellId == SPELL_STONE_SHOUT_10 || m_scriptSpellId == SPELL_STONE_SHOUT_25)
OnEffectPeriodic += AuraEffectPeriodicFn(spell_kologarn_stone_shout_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -928,10 +879,10 @@ void AddSC_boss_kologarn()
RegisterUlduarCreatureAI(boss_kologarn_pit_kill_bunny); RegisterUlduarCreatureAI(boss_kologarn_pit_kill_bunny);
// Spells // Spells
new spell_ulduar_stone_grip_cast_target(); RegisterSpellScript(spell_ulduar_stone_grip_cast_target);
new spell_ulduar_stone_grip(); RegisterSpellScript(spell_ulduar_stone_grip_aura);
new spell_ulduar_squeezed_lifeless(); RegisterSpellScript(spell_ulduar_squeezed_lifeless);
new spell_kologarn_stone_shout(); RegisterSpellAndAuraScriptPair(spell_kologarn_stone_shout, spell_kologarn_stone_shout_aura);
// Achievements // Achievements
new achievement_kologarn_looks_could_kill(); new achievement_kologarn_looks_could_kill();
@@ -2104,87 +2104,83 @@ public:
}; };
}; };
class spell_mimiron_rapid_burst : public SpellScriptLoader class spell_mimiron_rapid_burst_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_mimiron_rapid_burst_aura);
spell_mimiron_rapid_burst() : SpellScriptLoader("spell_mimiron_rapid_burst") { }
class spell_mimiron_rapid_burst_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_mimiron_rapid_burst_AuraScript) return ValidateSpellInfo(
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* c = GetCaster())
{ {
uint32 id = ( c->GetMap()->Is25ManRaid() ? ((aurEff->GetTickNumber() % 2) ? SPELL_RAPID_BURST_DAMAGE_25_2 : SPELL_RAPID_BURST_DAMAGE_25_1) : ((aurEff->GetTickNumber() % 2) ? SPELL_RAPID_BURST_DAMAGE_10_2 : SPELL_RAPID_BURST_DAMAGE_10_1) ); SPELL_RAPID_BURST_DAMAGE_10_1,
c->CastSpell((Unit*)nullptr, id, true); SPELL_RAPID_BURST_DAMAGE_10_2,
} SPELL_RAPID_BURST_DAMAGE_25_1,
} SPELL_RAPID_BURST_DAMAGE_25_2
});
}
void Register() override void HandleEffectPeriodic(AuraEffect const* aurEff)
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_rapid_burst_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_mimiron_rapid_burst_AuraScript(); if (Unit* caster = GetCaster())
{
uint32 id = (caster->GetMap()->Is25ManRaid() ? ((aurEff->GetTickNumber() % 2) ? SPELL_RAPID_BURST_DAMAGE_25_2 : SPELL_RAPID_BURST_DAMAGE_25_1) : ((aurEff->GetTickNumber() % 2) ? SPELL_RAPID_BURST_DAMAGE_10_2 : SPELL_RAPID_BURST_DAMAGE_10_1));
caster->CastSpell((Unit*)nullptr, id, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_rapid_burst_aura::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_mimiron_p3wx2_laser_barrage : public SpellScriptLoader enum p3wx2LaserBarrage
{ {
public: SPELL_P3WX2_LASER_BARRAGE_1 = 63297,
spell_mimiron_p3wx2_laser_barrage() : SpellScriptLoader("spell_mimiron_p3wx2_laser_barrage") { } SPELL_P3WX2_LASER_BARRAGE_2 = 64042
};
class spell_mimiron_p3wx2_laser_barrage_AuraScript : public AuraScript class spell_mimiron_p3wx2_laser_barrage_aura : public AuraScript
{
PrepareAuraScript(spell_mimiron_p3wx2_laser_barrage_aura);
bool Load() override
{ {
PrepareAuraScript(spell_mimiron_p3wx2_laser_barrage_AuraScript) _lastMSTime = GameTime::GetGameTimeMS().count();
_lastOrientation = -1.0f;
uint32 lastMSTime; return true;
float lastOrientation;
bool Load() override
{
lastMSTime = GameTime::GetGameTimeMS().count();
lastOrientation = -1.0f;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* c = GetCaster())
{
if (c->GetTypeId() != TYPEID_UNIT)
return;
uint32 diff = getMSTimeDiff(lastMSTime, GameTime::GetGameTimeMS().count());
if (lastOrientation == -1.0f)
{
lastOrientation = (c->ToCreature()->AI()->GetData(0) * 2 * M_PI) / 100.0f;
diff = 0;
}
float new_o = Position::NormalizeOrientation(lastOrientation - (M_PI / 60) * (diff / 250.0f));
lastMSTime = GameTime::GetGameTimeMS().count();
lastOrientation = new_o;
c->SetFacingTo(new_o);
c->CastSpell((Unit*)nullptr, 63297, true);
c->CastSpell((Unit*)nullptr, 64042, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_p3wx2_laser_barrage_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_mimiron_p3wx2_laser_barrage_AuraScript();
} }
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* caster = GetCaster())
{
if (caster->GetTypeId() != TYPEID_UNIT)
return;
uint32 diff = getMSTimeDiff(_lastMSTime, GameTime::GetGameTimeMS().count());
if (_lastOrientation == -1.0f)
{
_lastOrientation = (caster->ToCreature()->AI()->GetData(0) * 2 * M_PI) / 100.0f;
diff = 0;
}
float new_o = Position::NormalizeOrientation(_lastOrientation - (M_PI / 60) * (diff / 250.0f));
_lastMSTime = GameTime::GetGameTimeMS().count();
_lastOrientation = new_o;
caster->SetFacingTo(new_o);
caster->CastSpell((Unit*)nullptr, SPELL_P3WX2_LASER_BARRAGE_1, true);
caster->CastSpell((Unit*)nullptr, SPELL_P3WX2_LASER_BARRAGE_2, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_p3wx2_laser_barrage_aura::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
private:
uint32 _lastMSTime;
float _lastOrientation;
}; };
class go_ulduar_do_not_push_this_button : public GameObjectScript class go_ulduar_do_not_push_this_button : public GameObjectScript
@@ -2518,8 +2514,8 @@ void AddSC_boss_mimiron()
new npc_ulduar_mimiron_rocket(); new npc_ulduar_mimiron_rocket();
new npc_ulduar_magnetic_core(); new npc_ulduar_magnetic_core();
new npc_ulduar_bot_summon_trigger(); new npc_ulduar_bot_summon_trigger();
new spell_mimiron_rapid_burst(); RegisterSpellScript(spell_mimiron_rapid_burst_aura);
new spell_mimiron_p3wx2_laser_barrage(); RegisterSpellScript(spell_mimiron_p3wx2_laser_barrage_aura);
new go_ulduar_do_not_push_this_button(); new go_ulduar_do_not_push_this_button();
new npc_ulduar_flames_initial(); new npc_ulduar_flames_initial();
new npc_ulduar_flames_spread(); new npc_ulduar_flames_spread();
@@ -1729,59 +1729,37 @@ public:
} }
}; };
class spell_thorim_lightning_pillar_P2 : public SpellScriptLoader class spell_thorim_lightning_pillar_P2_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_thorim_lightning_pillar_P2_aura);
spell_thorim_lightning_pillar_P2() : SpellScriptLoader("spell_thorim_lightning_pillar_P2") { }
class spell_thorim_lightning_pillar_P2_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* aurEff)
{ {
PrepareAuraScript(spell_thorim_lightning_pillar_P2_AuraScript); PreventDefaultAction();
if (Unit* caster = GetCaster())
GetUnitOwner()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void OnPeriodic(AuraEffect const* aurEff) void Register() override
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
GetUnitOwner()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_thorim_lightning_pillar_P2_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_thorim_lightning_pillar_P2_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_thorim_lightning_pillar_P2_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_thorim_trash_impale : public SpellScriptLoader class spell_thorim_trash_impale_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_thorim_trash_impale_aura);
spell_thorim_trash_impale() : SpellScriptLoader("spell_thorim_trash_impale") { }
class spell_thorim_trash_impale_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_thorim_trash_impale_AuraScript); // deals damage until target is healed above 90%
if (GetUnitOwner()->HealthAbovePct(90))
SetDuration(0);
}
void OnPeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
// deals damage until target is healed above 90%
if (GetUnitOwner()->HealthAbovePct(90))
SetDuration(0);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_thorim_trash_impale_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_thorim_trash_impale_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_thorim_trash_impale_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
@@ -1838,8 +1816,8 @@ void AddSC_boss_thorim()
new go_thorim_lever(); new go_thorim_lever();
// Spells // Spells
new spell_thorim_lightning_pillar_P2(); RegisterSpellScript(spell_thorim_lightning_pillar_P2_aura);
new spell_thorim_trash_impale(); RegisterSpellScript(spell_thorim_trash_impale_aura);
// Achievements // Achievements
new achievement_thorim_stand_in_the_lightning(); new achievement_thorim_stand_in_the_lightning();
@@ -857,191 +857,147 @@ public:
}; };
// 62775 - Tympanic Tantrum // 62775 - Tympanic Tantrum
class spell_xt002_tympanic_tantrum : public SpellScriptLoader class spell_xt002_tympanic_tantrum : public SpellScript
{ {
public: PrepareSpellScript(spell_xt002_tympanic_tantrum);
spell_xt002_tympanic_tantrum() : SpellScriptLoader("spell_xt002_tympanic_tantrum") { }
class spell_xt002_tympanic_tantrum_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_xt002_tympanic_tantrum_SpellScript); targets.remove_if(PlayerOrPetCheck());
}
void FilterTargets(std::list<WorldObject*>& targets) void RecalculateDamage()
{
targets.remove_if(PlayerOrPetCheck());
}
void RecalculateDamage()
{
if (GetHitUnit())
SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage()));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_xt002_tympanic_tantrum_SpellScript(); if (GetHitUnit())
SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage()));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnHit += SpellHitFn(spell_xt002_tympanic_tantrum::RecalculateDamage);
} }
}; };
// 64234, 63024 - Gravity Bomb // 64234, 63024 - Gravity Bomb
class spell_xt002_gravity_bomb_aura : public SpellScriptLoader enum GravityBomb
{ {
public: SPELL_GRAVTY_BOMB_10 = 63025
spell_xt002_gravity_bomb_aura() : SpellScriptLoader("spell_xt002_gravity_bomb_aura") { } };
class spell_xt002_gravity_bomb_aura_AuraScript : public AuraScript class spell_xt002_gravity_bomb : public SpellScript
{
PrepareSpellScript(spell_xt002_gravity_bomb);
void SelectTarget(std::list<WorldObject*>& targets)
{ {
PrepareAuraScript(spell_xt002_gravity_bomb_aura_AuraScript); if (Unit* victim = GetCaster()->GetVictim())
targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true));
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetOwner()->ToPlayer())
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
if (Creature* cr = xt002->SummonCreature(NPC_VOID_ZONE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000))
{
int32 damage = GetSpellInfo()->Id == 63025 ? 5000 : 7500;
cr->CastCustomSpell(cr, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* xt002 = GetCaster();
if (!xt002)
return;
Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
if (aurEff->GetAmount() >= int32(owner->GetHealth()))
if (xt002->GetAI())
xt002->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_xt002_gravity_bomb_aura_AuraScript::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
AfterEffectRemove += AuraEffectRemoveFn(spell_xt002_gravity_bomb_aura_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_xt002_gravity_bomb_aura_AuraScript();
} }
class spell_xt002_gravity_bomb_aura_SpellScript : public SpellScript void Register() override
{ {
PrepareSpellScript(spell_xt002_gravity_bomb_aura_SpellScript); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_gravity_bomb::SelectTarget, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
void SelectTarget(std::list<WorldObject*>& targets) class spell_xt002_gravity_bomb_aura : public AuraScript
{ {
if (Unit* victim = GetCaster()->GetVictim()) PrepareAuraScript(spell_xt002_gravity_bomb_aura);
targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true));
}
void Register() override bool Validate(SpellInfo const* /*spellInfo*/) override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_gravity_bomb_aura_SpellScript::SelectTarget, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_xt002_gravity_bomb_aura_SpellScript(); return ValidateSpellInfo({ SPELL_VOID_ZONE_DAMAGE });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetOwner()->ToPlayer())
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
if (Creature* creature = xt002->SummonCreature(NPC_VOID_ZONE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000))
{
int32 damage = GetSpellInfo()->Id == SPELL_GRAVTY_BOMB_10 ? 5000 : 7500;
creature->CastCustomSpell(creature, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* xt002 = GetCaster();
if (!xt002)
return;
Unit* owner = GetOwner()->ToUnit();
if (!owner)
return;
if (aurEff->GetAmount() >= int32(owner->GetHealth()))
if (xt002->GetAI())
xt002->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_xt002_gravity_bomb_aura::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
AfterEffectRemove += AuraEffectRemoveFn(spell_xt002_gravity_bomb_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
} }
}; };
// 64233, 63025 - Gravity Bomb // 64233, 63025 - Gravity Bomb
class spell_xt002_gravity_bomb_damage : public SpellScriptLoader class spell_xt002_gravity_bomb_damage : public SpellScript
{ {
public: PrepareSpellScript(spell_xt002_gravity_bomb_damage);
spell_xt002_gravity_bomb_damage() : SpellScriptLoader("spell_xt002_gravity_bomb_damage") { }
class spell_xt002_gravity_bomb_damage_SpellScript : public SpellScript void HandleScript(SpellEffIndex /*eff*/)
{ {
PrepareSpellScript(spell_xt002_gravity_bomb_damage_SpellScript); Unit* caster = GetCaster();
if (!caster)
return;
void HandleScript(SpellEffIndex /*eff*/) if (GetHitDamage() >= int32(GetHitUnit()->GetHealth()))
{ if (caster->GetAI())
Unit* caster = GetCaster(); caster->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV);
if (!caster) }
return;
if (GetHitDamage() >= int32(GetHitUnit()->GetHealth())) void Register() override
if (caster->GetAI())
caster->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_xt002_gravity_bomb_damage_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_xt002_gravity_bomb_damage_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_xt002_gravity_bomb_damage::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
} }
}; };
// 63018, 65121 - Searing Light // 63018, 65121 - Searing Light
class spell_xt002_searing_light_spawn_life_spark : public SpellScriptLoader class spell_xt002_searing_light_spawn_life_spark : public SpellScript
{ {
public: PrepareSpellScript(spell_xt002_searing_light_spawn_life_spark);
spell_xt002_searing_light_spawn_life_spark() : SpellScriptLoader("spell_xt002_searing_light_spawn_life_spark") { }
class spell_xt002_searing_light_spawn_life_spark_AuraScript : public AuraScript void SelectTarget(std::list<WorldObject*>& targets)
{ {
PrepareAuraScript(spell_xt002_searing_light_spawn_life_spark_AuraScript); if (Unit* victim = GetCaster()->GetVictim())
targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true));
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetOwner()->ToPlayer())
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
xt002->SummonCreature(NPC_LIFE_SPARK, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_xt002_searing_light_spawn_life_spark_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_xt002_searing_light_spawn_life_spark_AuraScript();
} }
class spell_xt002_searing_light_spawn_life_spark_SpellScript : public SpellScript void Register() override
{ {
PrepareSpellScript(spell_xt002_searing_light_spawn_life_spark_SpellScript); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_searing_light_spawn_life_spark::SelectTarget, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
void SelectTarget(std::list<WorldObject*>& targets) class spell_xt002_searing_light_spawn_life_spark_aura : public AuraScript
{ {
if (Unit* victim = GetCaster()->GetVictim()) PrepareAuraScript(spell_xt002_searing_light_spawn_life_spark_aura);
targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true));
}
void Register() override void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_searing_light_spawn_life_spark_SpellScript::SelectTarget, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_xt002_searing_light_spawn_life_spark_SpellScript(); if (Player* player = GetOwner()->ToPlayer())
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
xt002->SummonCreature(NPC_LIFE_SPARK, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_xt002_searing_light_spawn_life_spark_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -1088,10 +1044,10 @@ void AddSC_boss_xt002()
new npc_xt002_life_spark(); new npc_xt002_life_spark();
// Spells // Spells
new spell_xt002_tympanic_tantrum(); RegisterSpellScript(spell_xt002_tympanic_tantrum);
new spell_xt002_gravity_bomb_aura(); RegisterSpellAndAuraScriptPair(spell_xt002_gravity_bomb, spell_xt002_gravity_bomb_aura);
new spell_xt002_gravity_bomb_damage(); RegisterSpellScript(spell_xt002_gravity_bomb_damage);
new spell_xt002_searing_light_spawn_life_spark(); RegisterSpellAndAuraScriptPair(spell_xt002_searing_light_spawn_life_spark, spell_xt002_searing_light_spawn_life_spark_aura);
// Achievements // Achievements
new achievement_xt002_nerf_engineering(); new achievement_xt002_nerf_engineering();
File diff suppressed because it is too large Load Diff
@@ -79,7 +79,8 @@ enum UldSpells
{ {
SPELL_SIMPLE_TELEPORT = 12980, SPELL_SIMPLE_TELEPORT = 12980,
SPELL_KEEPER_TELEPORT = 62940, SPELL_KEEPER_TELEPORT = 62940,
SPELL_SNOW_MOUND_PARTICLES = 64615 SPELL_SNOW_MOUND_PARTICLES = 64615,
SPELL_ENERGY_SAP_10 = 64740
}; };
class npc_ulduar_keeper : public CreatureScript class npc_ulduar_keeper : public CreatureScript
@@ -201,30 +202,30 @@ public:
} }
}; };
class spell_ulduar_energy_sap : public SpellScriptLoader enum EnergySap
{ {
public: SPELL_ENERGY_SAP_DAMAGE_1 = 64747,
spell_ulduar_energy_sap() : SpellScriptLoader("spell_ulduar_energy_sap") { } SPELL_ENERGY_SAP_DAMAGE_2 = 64863,
};
class spell_ulduar_energy_sap_AuraScript : public AuraScript class spell_ulduar_energy_sap_aura : public AuraScript
{
PrepareAuraScript(spell_ulduar_energy_sap_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_ulduar_energy_sap_AuraScript) return ValidateSpellInfo({ SPELL_ENERGY_SAP_DAMAGE_1, SPELL_ENERGY_SAP_DAMAGE_2 });
}
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* target = GetTarget())
target->CastSpell(target, (aurEff->GetId() == 64740) ? 64747 : 64863, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_energy_sap_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ulduar_energy_sap_AuraScript(); if (Unit* target = GetTarget())
target->CastSpell(target, (aurEff->GetId() == SPELL_ENERGY_SAP_10) ? SPELL_ENERGY_SAP_DAMAGE_1 : SPELL_ENERGY_SAP_DAMAGE_2, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_energy_sap_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
@@ -500,30 +501,19 @@ public:
}; };
}; };
class spell_ulduar_arachnopod_damaged : public SpellScriptLoader class spell_ulduar_arachnopod_damaged_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_ulduar_arachnopod_damaged_aura);
spell_ulduar_arachnopod_damaged() : SpellScriptLoader("spell_ulduar_arachnopod_damaged") { }
class spell_ulduar_arachnopod_damaged_AuraScript : public AuraScript void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_ulduar_arachnopod_damaged_AuraScript) if (Unit* caster = GetCaster())
Unit::Kill(caster, caster, false);
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
if (Unit* c = GetCaster())
Unit::Kill(c, c, false);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_arachnopod_damaged_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_ulduar_arachnopod_damaged_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_arachnopod_damaged_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -576,11 +566,11 @@ struct npc_salvaged_siege_engine : public VehicleAI
void AddSC_ulduar() void AddSC_ulduar()
{ {
new npc_ulduar_keeper(); new npc_ulduar_keeper();
new spell_ulduar_energy_sap(); RegisterSpellScript(spell_ulduar_energy_sap_aura);
RegisterUlduarCreatureAI(npc_ulduar_snow_mound); RegisterUlduarCreatureAI(npc_ulduar_snow_mound);
new npc_ulduar_storm_tempered_keeper(); new npc_ulduar_storm_tempered_keeper();
new npc_ulduar_arachnopod_destroyer(); new npc_ulduar_arachnopod_destroyer();
new spell_ulduar_arachnopod_damaged(); RegisterSpellScript(spell_ulduar_arachnopod_damaged_aura);
new AreaTrigger_at_celestial_planetarium_enterance(); new AreaTrigger_at_celestial_planetarium_enterance();
RegisterCreatureAI(npc_salvaged_siege_engine); RegisterCreatureAI(npc_salvaged_siege_engine);
} }