refactor(Scripts/BlackTemple): Spell Scripts use registry macros (#19122)

This commit is contained in:
Jelle Meeus
2024-06-22 10:20:06 +02:00
committed by GitHub
parent f65283c35a
commit 9f348fc96d
7 changed files with 828 additions and 1164 deletions

View File

@@ -0,0 +1,26 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_mother_shahraz_random_periodic_aura' WHERE `spell_id`=40867;
UPDATE `spell_script_names` SET `ScriptName`='spell_mother_shahraz_beam_periodic_aura' WHERE `spell_id` IN (40862,40863,40865,40866);
UPDATE `spell_script_names` SET `ScriptName`='spell_mother_shahraz_saber_lash_aura' WHERE `spell_id`=40816;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidari_council_balance_of_power_aura' WHERE `spell_id`=41341;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidari_council_reflective_shield_aura' WHERE `spell_id`=41475;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidari_council_deadly_strike_aura' WHERE `spell_id`=41480;
UPDATE `spell_script_names` SET `ScriptName`='spell_reliquary_of_souls_aura_of_suffering_aura' WHERE `spell_id`=41292;
UPDATE `spell_script_names` SET `ScriptName`='spell_reliquary_of_souls_aura_of_desire_aura' WHERE `spell_id`=41350;
UPDATE `spell_script_names` SET `ScriptName`='spell_reliquary_of_souls_aura_of_anger_aura' WHERE `spell_id`=41337;
UPDATE `spell_script_names` SET `ScriptName`='spell_reliquary_of_souls_spite_aura' WHERE `spell_id`=41376;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_template_harpooners_mark_aura' WHERE `spell_id`=40084;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_curse_of_the_bleakheart_aura' WHERE `spell_id`=41170;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_skeleton_shot_aura' WHERE `spell_id`=41171;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_wyvern_sting_aura' WHERE `spell_id`=41186;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_charge_rage_aura' WHERE `spell_id`=39575;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_shadow_inferno_aura' WHERE `spell_id`=39645;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_spell_absorption_aura' WHERE `spell_id`=41034;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_consuming_strikes_aura' WHERE `spell_id`=41248;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_curse_of_vitality_aura' WHERE `spell_id`=41351;
UPDATE `spell_script_names` SET `ScriptName`='spell_black_temple_dementia_aura' WHERE `spell_id`=41404;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidan_parasitic_shadowfiend_aura' WHERE `spell_id`=41917;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidan_tear_of_azzinoth_summon_channel_aura' WHERE `spell_id`=39857;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidan_demon_transform1_aura' WHERE `spell_id`=40511;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidan_demon_transform2_aura' WHERE `spell_id`=40398;
UPDATE `spell_script_names` SET `ScriptName`='spell_illidan_cage_trap_stun_aura' WHERE `spell_id`=40760;

View File

@@ -198,73 +198,51 @@ public:
}; };
}; };
class spell_gurtogg_bloodboil : public SpellScriptLoader class spell_gurtogg_bloodboil : public SpellScript
{ {
public: PrepareSpellScript(spell_gurtogg_bloodboil);
spell_gurtogg_bloodboil() : SpellScriptLoader("spell_gurtogg_bloodboil") { }
class spell_gurtogg_bloodboil_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_gurtogg_bloodboil_SpellScript); if (targets.empty())
return;
void FilterTargets(std::list<WorldObject*>& targets) targets.sort(Acore::ObjectDistanceOrderPred(GetCaster(), false));
if (targets.size() > GetSpellValue()->MaxAffectedTargets)
{ {
if (targets.empty()) std::list<WorldObject*>::iterator itr = targets.begin();
return; std::advance(itr, GetSpellValue()->MaxAffectedTargets);
targets.erase(itr, targets.end());
targets.sort(Acore::ObjectDistanceOrderPred(GetCaster(), false));
if (targets.size() > GetSpellValue()->MaxAffectedTargets)
{
std::list<WorldObject*>::iterator itr = targets.begin();
std::advance(itr, GetSpellValue()->MaxAffectedTargets);
targets.erase(itr, targets.end());
}
} }
}
void Register() override void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gurtogg_bloodboil_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_gurtogg_bloodboil_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gurtogg_bloodboil::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
class spell_gurtogg_eject : public SpellScriptLoader class spell_gurtogg_eject : public SpellScript
{ {
public: PrepareSpellScript(spell_gurtogg_eject);
spell_gurtogg_eject() : SpellScriptLoader("spell_gurtogg_eject") { }
class spell_gurtogg_eject_SpellScript : public SpellScript void HandleScriptEffect(SpellEffIndex effIndex)
{ {
PrepareSpellScript(spell_gurtogg_eject_SpellScript); PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
GetCaster()->GetThreatMgr().ModifyThreatByPercent(target, -20);
}
void HandleScriptEffect(SpellEffIndex effIndex) void Register() override
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
GetCaster()->GetThreatMgr().ModifyThreatByPercent(target, -20);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gurtogg_eject_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_gurtogg_eject_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_gurtogg_eject::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
void AddSC_boss_gurtogg_bloodboil() void AddSC_boss_gurtogg_bloodboil()
{ {
new boss_gurtogg_bloodboil(); new boss_gurtogg_bloodboil();
new spell_gurtogg_bloodboil(); RegisterSpellScript(spell_gurtogg_bloodboil);
new spell_gurtogg_eject(); RegisterSpellScript(spell_gurtogg_eject);
} }

View File

@@ -1023,419 +1023,337 @@ public:
} }
}; };
class spell_illidan_draw_soul : public SpellScriptLoader class spell_illidan_draw_soul : public SpellScript
{ {
public: PrepareSpellScript(spell_illidan_draw_soul);
spell_illidan_draw_soul() : SpellScriptLoader("spell_illidan_draw_soul") { }
class spell_illidan_draw_soul_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_illidan_draw_soul_SpellScript); return ValidateSpellInfo({ SPELL_DRAW_SOUL_HEAL });
}
void HandleScriptEffect(SpellEffIndex effIndex) void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_DRAW_SOUL_HEAL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_draw_soul_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_illidan_draw_soul_SpellScript(); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_DRAW_SOUL_HEAL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_draw_soul::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_illidan_parasitic_shadowfiend : public SpellScriptLoader class spell_illidan_parasitic_shadowfiend_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidan_parasitic_shadowfiend_aura);
spell_illidan_parasitic_shadowfiend() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend") { }
class spell_illidan_parasitic_shadowfiend_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_illidan_parasitic_shadowfiend_AuraScript) return ValidateSpellInfo({ SPELL_SUMMON_PARASITIC_SHADOWFIENDS });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress())
GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_illidan_parasitic_shadowfiend_AuraScript(); if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress())
GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_illidan_parasitic_shadowfiend_trigger : public SpellScriptLoader class spell_illidan_parasitic_shadowfiend_trigger : public SpellScript
{ {
public: PrepareSpellScript(spell_illidan_parasitic_shadowfiend_trigger);
spell_illidan_parasitic_shadowfiend_trigger() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend_trigger") { }
class spell_illidan_parasitic_shadowfiend_trigger_AuraScript : public AuraScript void HandleScriptEffect(SpellEffIndex effIndex)
{ {
PrepareAuraScript(spell_illidan_parasitic_shadowfiend_trigger_AuraScript) PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) target->DespawnOrUnsummon(1);
{
if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress())
GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_trigger_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_illidan_parasitic_shadowfiend_trigger_AuraScript();
} }
class spell_illidan_parasitic_shadowfiend_trigger_SpellScript : public SpellScript void Register() override
{ {
PrepareSpellScript(spell_illidan_parasitic_shadowfiend_trigger_SpellScript); OnEffectHitTarget += SpellEffectFn(spell_illidan_parasitic_shadowfiend_trigger::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
target->DespawnOrUnsummon(1);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_parasitic_shadowfiend_trigger_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_illidan_parasitic_shadowfiend_trigger_SpellScript();
} }
}; };
class spell_illidan_glaive_throw : public SpellScriptLoader class spell_illidan_parasitic_shadowfiend_trigger_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidan_parasitic_shadowfiend_trigger_aura);
spell_illidan_glaive_throw() : SpellScriptLoader("spell_illidan_glaive_throw") { }
class spell_illidan_glaive_throw_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_illidan_glaive_throw_SpellScript); return ValidateSpellInfo({ SPELL_SUMMON_PARASITIC_SHADOWFIENDS });
}
void HandleDummy(SpellEffIndex effIndex) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_SUMMON_GLAIVE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_glaive_throw_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_illidan_glaive_throw_SpellScript(); if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress())
GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_trigger_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_illidan_tear_of_azzinoth_summon_channel : public SpellScriptLoader class spell_illidan_glaive_throw : public SpellScript
{ {
public: PrepareSpellScript(spell_illidan_glaive_throw);
spell_illidan_tear_of_azzinoth_summon_channel() : SpellScriptLoader("spell_illidan_tear_of_azzinoth_summon_channel") { }
class spell_illidan_tear_of_azzinoth_summon_channel_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_illidan_tear_of_azzinoth_summon_channel_AuraScript); return ValidateSpellInfo({ SPELL_SUMMON_GLAIVE });
}
void OnPeriodic(AuraEffect const* /*aurEff*/) void HandleDummy(SpellEffIndex effIndex)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
if (GetTarget()->GetDistance2d(caster) > 25.0f)
{
SetDuration(0);
GetTarget()->CastSpell(GetTarget(), SPELL_UNCAGED_WRATH, true);
}
}
// xinef: ugly hax, dunno how it really works on blizz
Map::PlayerList const& pl = GetTarget()->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->GetPositionX() > 693.4f || player->GetPositionY() < 271.8f || player->GetPositionX() < 658.43f || player->GetPositionY() > 338.68f)
{
GetTarget()->CastSpell(player, SPELL_CHARGE, true);
break;
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_tear_of_azzinoth_summon_channel_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_illidan_tear_of_azzinoth_summon_channel_AuraScript(); PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_SUMMON_GLAIVE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_glaive_throw::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
class spell_illidan_shadow_prison : public SpellScriptLoader class spell_illidan_tear_of_azzinoth_summon_channel_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidan_tear_of_azzinoth_summon_channel_aura);
spell_illidan_shadow_prison() : SpellScriptLoader("spell_illidan_shadow_prison") { }
class spell_illidan_shadow_prison_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_illidan_shadow_prison_SpellScript); return ValidateSpellInfo({ SPELL_UNCAGED_WRATH, SPELL_CHARGE });
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(PlayerOrPetCheck());
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_illidan_shadow_prison_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_illidan_shadow_prison_SpellScript();
} }
};
class spell_illidan_demon_transform1 : public SpellScriptLoader void OnPeriodic(AuraEffect const* /*aurEff*/)
{
public:
spell_illidan_demon_transform1() : SpellScriptLoader("spell_illidan_demon_transform1") { }
class spell_illidan_demon_transform1_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_illidan_demon_transform1_AuraScript); PreventDefaultAction();
if (Unit* caster = GetCaster())
bool Load() override
{ {
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; if (GetTarget()->GetDistance2d(caster) > 25.0f)
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_2, true);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_demon_transform1_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_illidan_demon_transform1_AuraScript();
}
};
class spell_illidan_demon_transform2 : public SpellScriptLoader
{
public:
spell_illidan_demon_transform2() : SpellScriptLoader("spell_illidan_demon_transform2") { }
class spell_illidan_demon_transform2_AuraScript : public AuraScript
{
PrepareAuraScript(spell_illidan_demon_transform2_AuraScript);
bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void OnPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetTickNumber() == 1)
{
if (GetUnitOwner()->GetDisplayId() == GetUnitOwner()->GetNativeDisplayId())
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_FORM, true);
else
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DEMON_FORM);
}
else if (aurEff->GetTickNumber() == 2)
{ {
SetDuration(0); SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_3, true); GetTarget()->CastSpell(GetTarget(), SPELL_UNCAGED_WRATH, true);
if (Aura* aura = GetUnitOwner()->GetAura(SPELL_DEMON_TRANSFORM_3))
aura->SetDuration(4500);
if (!GetUnitOwner()->HasAura(SPELL_DEMON_FORM))
GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
} }
} }
void Register() override // xinef: ugly hax, dunno how it really works on blizz
{ Map::PlayerList const& pl = GetTarget()->GetMap()->GetPlayers();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_demon_transform2_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
} if (Player* player = itr->GetSource())
}; if (player->GetPositionX() > 693.4f || player->GetPositionY() < 271.8f || player->GetPositionX() < 658.43f || player->GetPositionY() > 338.68f)
AuraScript* GetAuraScript() const override
{
return new spell_illidan_demon_transform2_AuraScript();
}
};
class spell_illidan_flame_burst : public SpellScriptLoader
{
public:
spell_illidan_flame_burst() : SpellScriptLoader("spell_illidan_flame_burst") { }
class spell_illidan_flame_burst_SpellScript : public SpellScript
{
PrepareSpellScript(spell_illidan_flame_burst_SpellScript);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_FLAME_BURST_EFFECT, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_flame_burst_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_illidan_flame_burst_SpellScript();
}
};
class spell_illidan_found_target : public SpellScriptLoader
{
public:
spell_illidan_found_target() : SpellScriptLoader("spell_illidan_found_target") { }
class spell_illidan_found_target_SpellScript : public SpellScript
{
PrepareSpellScript(spell_illidan_found_target_SpellScript);
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
if (GetCaster()->GetDistance(target) < 2.0f)
{ {
GetCaster()->CastSpell(target, SPELL_CONSUME_SOUL, true); GetTarget()->CastSpell(player, SPELL_CHARGE, true);
GetCaster()->CastSpell(GetCaster(), SPELL_FIND_TARGET, true); break;
} }
} }
void Register() override void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_found_target_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_illidan_found_target_SpellScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_tear_of_azzinoth_summon_channel_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_illidan_cage_trap : public SpellScriptLoader class spell_illidan_shadow_prison : public SpellScript
{ {
public: PrepareSpellScript(spell_illidan_shadow_prison);
spell_illidan_cage_trap() : SpellScriptLoader("spell_illidan_cage_trap") { }
class spell_illidan_cage_trap_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_illidan_cage_trap_SpellScript); targets.remove_if(PlayerOrPetCheck());
}
bool Load() override void Register() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Creature* target = GetHitCreature())
if (GetCaster()->GetExactDist2d(target) < 4.0f)
{
target->AI()->DoAction(ACTION_ILLIDAN_CAGED);
target->CastSpell(target, SPELL_CAGE_TRAP, true);
GetCaster()->ToCreature()->DespawnOrUnsummon(1);
if (GameObject* gobject = GetCaster()->FindNearestGameObject(GO_CAGE_TRAP, 10.0f))
gobject->SetLootState(GO_JUST_DEACTIVATED);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_cage_trap_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_illidan_cage_trap_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_illidan_shadow_prison::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
class spell_illidan_cage_trap_stun : public SpellScriptLoader class spell_illidan_demon_transform1_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidan_demon_transform1_aura);
spell_illidan_cage_trap_stun() : SpellScriptLoader("spell_illidan_cage_trap_stun") { }
class spell_illidan_cage_trap_stun_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_illidan_cage_trap_stun_AuraScript); return ValidateSpellInfo({ SPELL_DEMON_TRANSFORM_2 });
}
void OnPeriodic(AuraEffect const* /*aurEff*/) bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_2, true);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_demon_transform1_aura::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_illidan_demon_transform2_aura : public AuraScript
{
PrepareAuraScript(spell_illidan_demon_transform2_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DEMON_FORM, SPELL_DEMON_TRANSFORM_3 });
}
bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void OnPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetTickNumber() == 1)
{
if (GetUnitOwner()->GetDisplayId() == GetUnitOwner()->GetNativeDisplayId())
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_FORM, true);
else
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DEMON_FORM);
}
else if (aurEff->GetTickNumber() == 2)
{ {
PreventDefaultAction();
SetDuration(0); SetDuration(0);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_3, true);
if (Aura* aura = GetUnitOwner()->GetAura(SPELL_DEMON_TRANSFORM_3))
aura->SetDuration(4500);
for (uint32 i = SPELL_CAGED_SUMMON1; i <= SPELL_CAGED_SUMMON8; ++i) if (!GetUnitOwner()->HasAura(SPELL_DEMON_FORM))
GetTarget()->CastSpell(GetTarget(), i, true); GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
GetTarget()->CastSpell(GetTarget(), SPELL_CAGED_DEBUFF, true);
} }
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_cage_trap_stun_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_illidan_cage_trap_stun_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_demon_transform2_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_illidan_flame_burst : public SpellScript
{
PrepareSpellScript(spell_illidan_flame_burst);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FLAME_BURST_EFFECT });
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_FLAME_BURST_EFFECT, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_flame_burst::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_illidan_found_target : public SpellScript
{
PrepareSpellScript(spell_illidan_found_target);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CONSUME_SOUL, SPELL_FIND_TARGET });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
if (GetCaster()->GetDistance(target) < 2.0f)
{
GetCaster()->CastSpell(target, SPELL_CONSUME_SOUL, true);
GetCaster()->CastSpell(GetCaster(), SPELL_FIND_TARGET, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_found_target::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_illidan_cage_trap : public SpellScript
{
PrepareSpellScript(spell_illidan_cage_trap);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CAGE_TRAP });
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (Creature* target = GetHitCreature())
if (GetCaster()->GetExactDist2d(target) < 4.0f)
{
target->AI()->DoAction(ACTION_ILLIDAN_CAGED);
target->CastSpell(target, SPELL_CAGE_TRAP, true);
GetCaster()->ToCreature()->DespawnOrUnsummon(1);
if (GameObject* gobject = GetCaster()->FindNearestGameObject(GO_CAGE_TRAP, 10.0f))
gobject->SetLootState(GO_JUST_DEACTIVATED);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidan_cage_trap::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_illidan_cage_trap_stun_aura : public AuraScript
{
PrepareAuraScript(spell_illidan_cage_trap_stun_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CAGED_DEBUFF, SPELL_CAGED_SUMMON1, SPELL_CAGED_SUMMON1+1, SPELL_CAGED_SUMMON1+2, SPELL_CAGED_SUMMON1+3, SPELL_CAGED_SUMMON1+4, SPELL_CAGED_SUMMON1+5, SPELL_CAGED_SUMMON1+6, SPELL_CAGED_SUMMON8 });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
SetDuration(0);
for (uint32 i = SPELL_CAGED_SUMMON1; i <= SPELL_CAGED_SUMMON8; ++i)
GetTarget()->CastSpell(GetTarget(), i, true);
GetTarget()->CastSpell(GetTarget(), SPELL_CAGED_DEBUFF, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidan_cage_trap_stun_aura::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
@@ -1443,17 +1361,17 @@ void AddSC_boss_illidan()
{ {
new boss_illidan_stormrage(); new boss_illidan_stormrage();
new npc_akama_illidan(); new npc_akama_illidan();
new spell_illidan_draw_soul(); RegisterSpellScript(spell_illidan_draw_soul);
new spell_illidan_parasitic_shadowfiend(); RegisterSpellScript(spell_illidan_parasitic_shadowfiend_aura);
new spell_illidan_parasitic_shadowfiend_trigger(); RegisterSpellAndAuraScriptPair(spell_illidan_parasitic_shadowfiend_trigger, spell_illidan_parasitic_shadowfiend_trigger_aura);
new spell_illidan_glaive_throw(); RegisterSpellScript(spell_illidan_glaive_throw);
new spell_illidan_tear_of_azzinoth_summon_channel(); RegisterSpellScript(spell_illidan_tear_of_azzinoth_summon_channel_aura);
new spell_illidan_shadow_prison(); RegisterSpellScript(spell_illidan_shadow_prison);
new spell_illidan_demon_transform1(); RegisterSpellScript(spell_illidan_demon_transform1_aura);
new spell_illidan_demon_transform2(); RegisterSpellScript(spell_illidan_demon_transform2_aura);
new spell_illidan_flame_burst(); RegisterSpellScript(spell_illidan_flame_burst);
new spell_illidan_found_target(); RegisterSpellScript(spell_illidan_found_target);
new spell_illidan_cage_trap(); RegisterSpellScript(spell_illidan_cage_trap);
new spell_illidan_cage_trap_stun(); RegisterSpellScript(spell_illidan_cage_trap_stun_aura);
} }

View File

@@ -171,213 +171,162 @@ public:
}; };
}; };
class spell_mother_shahraz_random_periodic : public SpellScriptLoader class spell_mother_shahraz_random_periodic_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_mother_shahraz_random_periodic_aura);
spell_mother_shahraz_random_periodic() : SpellScriptLoader("spell_mother_shahraz_random_periodic") { }
class spell_mother_shahraz_random_periodic_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_mother_shahraz_random_periodic_AuraScript); return ValidateSpellInfo({ SPELL_SINFUL_PERIODIC, SPELL_SINISTER_PERIODIC, SPELL_VILE_PERIODIC, SPELL_WICKED_PERIODIC });
}
void Update(AuraEffect const* effect) void Update(AuraEffect const* effect)
{
PreventDefaultAction();
if (effect->GetTickNumber() % 5 == 1)
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SINFUL_PERIODIC, SPELL_SINISTER_PERIODIC, SPELL_VILE_PERIODIC, SPELL_WICKED_PERIODIC), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_random_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_mother_shahraz_random_periodic_AuraScript(); PreventDefaultAction();
if (effect->GetTickNumber() % 5 == 1)
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SINFUL_PERIODIC, SPELL_SINISTER_PERIODIC, SPELL_VILE_PERIODIC, SPELL_WICKED_PERIODIC), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_random_periodic_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_mother_shahraz_beam_periodic : public SpellScriptLoader class spell_mother_shahraz_beam_periodic_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_mother_shahraz_beam_periodic_aura);
spell_mother_shahraz_beam_periodic() : SpellScriptLoader("spell_mother_shahraz_beam_periodic") { }
class spell_mother_shahraz_beam_periodic_AuraScript : public AuraScript void Update(AuraEffect const* effect)
{ {
PrepareAuraScript(spell_mother_shahraz_beam_periodic_AuraScript); PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void Update(AuraEffect const* effect) void Register() override
{
PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_beam_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_mother_shahraz_beam_periodic_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_beam_periodic_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_mother_shahraz_saber_lash : public SpellScriptLoader class spell_mother_shahraz_saber_lash_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_mother_shahraz_saber_lash_aura);
spell_mother_shahraz_saber_lash() : SpellScriptLoader("spell_mother_shahraz_saber_lash") { }
class spell_mother_shahraz_saber_lash_AuraScript : public AuraScript bool CheckProc(ProcEventInfo& /*eventInfo*/)
{ {
PrepareAuraScript(spell_mother_shahraz_saber_lash_AuraScript); return false;
}
bool CheckProc(ProcEventInfo& /*eventInfo*/) void Update(AuraEffect const* effect)
{
return false;
}
void Update(AuraEffect const* effect)
{
PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetVictim())
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_mother_shahraz_saber_lash_AuraScript::CheckProc);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_saber_lash_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_mother_shahraz_saber_lash_AuraScript(); PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetVictim())
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_mother_shahraz_saber_lash_aura::CheckProc);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_saber_lash_aura::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_mother_shahraz_fatal_attraction : public SpellScriptLoader class spell_mother_shahraz_fatal_attraction : public SpellScript
{ {
public: PrepareSpellScript(spell_mother_shahraz_fatal_attraction);
spell_mother_shahraz_fatal_attraction() : SpellScriptLoader("spell_mother_shahraz_fatal_attraction") { }
class spell_mother_shahraz_fatal_attraction_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_mother_shahraz_fatal_attraction_SpellScript); return ValidateSpellInfo({ SPELL_FATAL_ATTRACTION_AURA });
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY));
if (targets.size() <= 1)
FinishCast(SPELL_FAILED_DONT_REPORT);
}
void SetDest(SpellDestination& dest)
{
std::list<TargetInfo> const* targetsInfo = GetSpell()->GetUniqueTargetInfo();
for (std::list<TargetInfo>::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
if (Unit* target = ObjectAccessor::GetUnit(*GetCaster(), ihit->targetGUID))
{
dest.Relocate(*target);
if (roll_chance_i(50))
break;
}
}
void HandleTeleportUnits(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_FATAL_ATTRACTION_AURA, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mother_shahraz_fatal_attraction_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_mother_shahraz_fatal_attraction_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER_RANDOM);
OnEffectHitTarget += SpellEffectFn(spell_mother_shahraz_fatal_attraction_SpellScript::HandleTeleportUnits, EFFECT_1, SPELL_EFFECT_TELEPORT_UNITS);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_mother_shahraz_fatal_attraction_SpellScript();
} }
};
class spell_mother_shahraz_fatal_attraction_dummy : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets)
{
public:
spell_mother_shahraz_fatal_attraction_dummy() : SpellScriptLoader("spell_mother_shahraz_fatal_attraction_dummy") { }
class spell_mother_shahraz_fatal_attraction_dummy_SpellScript : public SpellScript
{ {
PrepareSpellScript(spell_mother_shahraz_fatal_attraction_dummy_SpellScript); targets.remove_if(Acore::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY));
if (targets.size() <= 1)
FinishCast(SPELL_FAILED_DONT_REPORT);
}
void HandleDummy(SpellEffIndex /*effIndex*/) void SetDest(SpellDestination& dest)
{ {
if (Unit* target = GetHitUnit()) std::list<TargetInfo> const* targetsInfo = GetSpell()->GetUniqueTargetInfo();
for (std::list<TargetInfo>::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
if (Unit* target = ObjectAccessor::GetUnit(*GetCaster(), ihit->targetGUID))
{ {
target->CastSpell(target, SPELL_FATAL_ATTRACTION_DAMAGE, true); dest.Relocate(*target);
if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_FATAL_ATTRACTION_AURA, EFFECT_1)) if (roll_chance_i(50))
aurEff->SetAmount(aurEff->GetTickNumber()); break;
} }
} }
void Register() override void HandleTeleportUnits(SpellEffIndex /*effIndex*/)
{
OnEffectHitTarget += SpellEffectFn(spell_mother_shahraz_fatal_attraction_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_mother_shahraz_fatal_attraction_dummy_SpellScript(); if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_FATAL_ATTRACTION_AURA, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mother_shahraz_fatal_attraction::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_mother_shahraz_fatal_attraction::SetDest, EFFECT_1, TARGET_DEST_CASTER_RANDOM);
OnEffectHitTarget += SpellEffectFn(spell_mother_shahraz_fatal_attraction::HandleTeleportUnits, EFFECT_1, SPELL_EFFECT_TELEPORT_UNITS);
} }
}; };
class spell_mother_shahraz_fatal_attraction_aura : public SpellScriptLoader class spell_mother_shahraz_fatal_attraction_dummy : public SpellScript
{ {
public: PrepareSpellScript(spell_mother_shahraz_fatal_attraction_dummy);
spell_mother_shahraz_fatal_attraction_aura() : SpellScriptLoader("spell_mother_shahraz_fatal_attraction_aura") { }
class spell_mother_shahraz_fatal_attraction_aura_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_mother_shahraz_fatal_attraction_aura_AuraScript); return ValidateSpellInfo({ SPELL_FATAL_ATTRACTION_DAMAGE });
}
void Update(AuraEffect const* effect) void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (effect->GetTickNumber() > uint32(effect->GetAmount() + 1))
{
PreventDefaultAction();
SetDuration(0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_fatal_attraction_aura_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_mother_shahraz_fatal_attraction_aura_AuraScript(); if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_FATAL_ATTRACTION_DAMAGE, true);
if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_FATAL_ATTRACTION_AURA, EFFECT_1))
aurEff->SetAmount(aurEff->GetTickNumber());
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_mother_shahraz_fatal_attraction_dummy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_mother_shahraz_fatal_attraction_aura : public AuraScript
{
PrepareAuraScript(spell_mother_shahraz_fatal_attraction_aura);
void Update(AuraEffect const* effect)
{
if (effect->GetTickNumber() > uint32(effect->GetAmount() + 1))
{
PreventDefaultAction();
SetDuration(0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_fatal_attraction_aura::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
void AddSC_boss_mother_shahraz() void AddSC_boss_mother_shahraz()
{ {
new boss_mother_shahraz(); new boss_mother_shahraz();
new spell_mother_shahraz_random_periodic(); RegisterSpellScript(spell_mother_shahraz_random_periodic_aura);
new spell_mother_shahraz_beam_periodic(); RegisterSpellScript(spell_mother_shahraz_beam_periodic_aura);
new spell_mother_shahraz_saber_lash(); RegisterSpellScript(spell_mother_shahraz_saber_lash_aura);
new spell_mother_shahraz_fatal_attraction(); RegisterSpellScript(spell_mother_shahraz_fatal_attraction);
new spell_mother_shahraz_fatal_attraction_dummy(); RegisterSpellScript(spell_mother_shahraz_fatal_attraction_dummy);
new spell_mother_shahraz_fatal_attraction_aura(); RegisterSpellScript(spell_mother_shahraz_fatal_attraction_aura);
} }

View File

@@ -582,200 +582,155 @@ public:
}; };
}; };
class spell_reliquary_of_souls_aura_of_suffering : public SpellScriptLoader class spell_reliquary_of_souls_aura_of_suffering_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_reliquary_of_souls_aura_of_suffering_aura);
spell_reliquary_of_souls_aura_of_suffering() : SpellScriptLoader("spell_reliquary_of_souls_aura_of_suffering") { }
class spell_reliquary_of_souls_aura_of_suffering_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_reliquary_of_souls_aura_of_suffering_AuraScript) return ValidateSpellInfo({ SPELL_AURA_OF_SUFFERING_TRIGGER });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->CastSpell(GetTarget(), SPELL_AURA_OF_SUFFERING_TRIGGER, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAurasDueToSpell(SPELL_AURA_OF_SUFFERING_TRIGGER);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_reliquary_of_souls_aura_of_suffering_AuraScript(); GetTarget()->CastSpell(GetTarget(), SPELL_AURA_OF_SUFFERING_TRIGGER, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAurasDueToSpell(SPELL_AURA_OF_SUFFERING_TRIGGER);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_reliquary_of_souls_fixate : public SpellScriptLoader class spell_reliquary_of_souls_fixate : public SpellScript
{ {
public: PrepareSpellScript(spell_reliquary_of_souls_fixate);
spell_reliquary_of_souls_fixate() : SpellScriptLoader("spell_reliquary_of_souls_fixate") { }
class spell_reliquary_of_souls_fixate_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_reliquary_of_souls_fixate_SpellScript); if (targets.empty())
return;
void FilterTargets(std::list<WorldObject*>& targets) targets.sort(Acore::ObjectDistanceOrderPred(GetCaster()));
{ WorldObject* target = targets.front();
if (targets.empty()) targets.clear();
return; targets.push_back(target);
targets.sort(Acore::ObjectDistanceOrderPred(GetCaster()));
WorldObject* target = targets.front();
targets.clear();
targets.push_back(target);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_reliquary_of_souls_fixate_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_reliquary_of_souls_fixate_SpellScript();
} }
class spell_reliquary_of_souls_fixate_AuraScript : public AuraScript void Register() override
{ {
PrepareAuraScript(spell_reliquary_of_souls_fixate_AuraScript) OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_reliquary_of_souls_fixate::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, GetTarget()->GetGUID());
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_reliquary_of_souls_fixate_AuraScript();
} }
}; };
class spell_reliquary_of_souls_aura_of_desire : public SpellScriptLoader class spell_reliquary_of_souls_fixate_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_reliquary_of_souls_fixate_aura);
spell_reliquary_of_souls_aura_of_desire() : SpellScriptLoader("spell_reliquary_of_souls_aura_of_desire") { }
class spell_reliquary_of_souls_aura_of_desire_AuraScript : public AuraScript void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_reliquary_of_souls_aura_of_desire_AuraScript); if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, GetTarget()->GetGUID());
}
bool CheckProc(ProcEventInfo& eventInfo) void Register() override
{
return eventInfo.GetActor() && eventInfo.GetActionTarget();
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActionTarget()->CastCustomSpell(SPELL_AURA_OF_DESIRE_DAMAGE, SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage() / 2, eventInfo.GetActor(), true);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2))
amount = std::max<int32>(-100, -5 * int32(effect->GetTickNumber()));
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
effect->RecalculateAmount();
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_reliquary_of_souls_aura_of_desire_AuraScript(); OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_fixate_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_reliquary_of_souls_aura_of_anger : public SpellScriptLoader class spell_reliquary_of_souls_aura_of_desire_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_reliquary_of_souls_aura_of_desire_aura);
spell_reliquary_of_souls_aura_of_anger() : SpellScriptLoader("spell_reliquary_of_souls_aura_of_anger") { }
class spell_reliquary_of_souls_aura_of_anger_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_reliquary_of_souls_aura_of_anger_AuraScript); return ValidateSpellInfo({ SPELL_AURA_OF_DESIRE_DAMAGE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) bool CheckProc(ProcEventInfo& eventInfo)
{
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
amount = amount * effect->GetTickNumber();
}
void Update(AuraEffect const* /*effect*/)
{
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
effect->RecalculateAmount();
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
effect->RecalculateAmount();
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_reliquary_of_souls_aura_of_anger_AuraScript(); return eventInfo.GetActor() && eventInfo.GetActionTarget();
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActionTarget()->CastCustomSpell(SPELL_AURA_OF_DESIRE_DAMAGE, SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage() / 2, eventInfo.GetActor(), true);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2))
amount = std::max<int32>(-100, -5 * int32(effect->GetTickNumber()));
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
effect->RecalculateAmount();
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_reliquary_of_souls_aura_of_desire_aura::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_reliquary_of_souls_aura_of_desire_aura::HandleProc, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_desire_aura::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_desire_aura::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_reliquary_of_souls_spite : public SpellScriptLoader class spell_reliquary_of_souls_aura_of_anger_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_reliquary_of_souls_aura_of_anger_aura);
spell_reliquary_of_souls_spite() : SpellScriptLoader("spell_reliquary_of_souls_spite") { }
class spell_reliquary_of_souls_spite_AuraScript : public AuraScript void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
PrepareAuraScript(spell_reliquary_of_souls_spite_AuraScript) if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
amount = amount * effect->GetTickNumber();
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void Update(AuraEffect const* /*effect*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_SPITE_DAMAGE, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_spite_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DAMAGE_IMMUNITY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_reliquary_of_souls_spite_AuraScript(); if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
effect->RecalculateAmount();
if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
effect->RecalculateAmount();
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_aura::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_aura::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_anger_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
class spell_reliquary_of_souls_spite_aura : public AuraScript
{
PrepareAuraScript(spell_reliquary_of_souls_spite_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SPITE_DAMAGE });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_SPITE_DAMAGE, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_spite_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DAMAGE_IMMUNITY, AURA_EFFECT_HANDLE_REAL);
} }
}; };
@@ -785,10 +740,10 @@ void AddSC_boss_reliquary_of_souls()
new boss_essence_of_suffering(); new boss_essence_of_suffering();
new boss_essence_of_desire(); new boss_essence_of_desire();
new boss_essence_of_anger(); new boss_essence_of_anger();
new spell_reliquary_of_souls_aura_of_suffering(); RegisterSpellScript(spell_reliquary_of_souls_aura_of_suffering_aura);
new spell_reliquary_of_souls_fixate(); RegisterSpellAndAuraScriptPair(spell_reliquary_of_souls_fixate, spell_reliquary_of_souls_fixate_aura);
new spell_reliquary_of_souls_aura_of_desire(); RegisterSpellScript(spell_reliquary_of_souls_aura_of_desire_aura);
new spell_reliquary_of_souls_aura_of_anger(); RegisterSpellScript(spell_reliquary_of_souls_aura_of_anger_aura);
new spell_reliquary_of_souls_spite(); RegisterSpellScript(spell_reliquary_of_souls_spite_aura);
} }

View File

@@ -556,191 +556,141 @@ public:
}; };
}; };
class spell_illidari_council_balance_of_power : public SpellScriptLoader class spell_illidari_council_balance_of_power_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidari_council_balance_of_power_aura);
spell_illidari_council_balance_of_power() : SpellScriptLoader("spell_illidari_council_balance_of_power") { }
class spell_illidari_council_balance_of_power_AuraScript : public AuraScript void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
PrepareAuraScript(spell_illidari_council_balance_of_power_AuraScript); // Set absorbtion amount to unlimited (no absorb)
amount = -1;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) void Register() override
{
// Set absorbtion amount to unlimited (no absorb)
amount = -1;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_illidari_council_balance_of_power_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_illidari_council_balance_of_power_AuraScript(); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_illidari_council_balance_of_power_aura::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
} }
}; };
class spell_illidari_council_empyreal_balance : public SpellScriptLoader class spell_illidari_council_empyreal_balance : public SpellScript
{ {
public: PrepareSpellScript(spell_illidari_council_empyreal_balance);
spell_illidari_council_empyreal_balance() : SpellScriptLoader("spell_illidari_council_empyreal_balance") { }
class spell_illidari_council_empyreal_balance_SpellScript : public SpellScript bool Load() override
{ {
PrepareSpellScript(spell_illidari_council_empyreal_balance_SpellScript); _sharedHealth = 0;
_sharedHealthMax = 0;
_targetCount = 0;
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
bool Load() override void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{ {
_sharedHealth = 0; _targetCount++;
_sharedHealthMax = 0; _sharedHealth += target->GetHealth();
_targetCount = 0; _sharedHealthMax += target->GetMaxHealth();
return GetCaster()->GetTypeId() == TYPEID_UNIT; }
}
void HandleAfterCast()
{
if (_targetCount != 4)
{
GetCaster()->ToCreature()->AI()->EnterEvadeMode();
return;
} }
void HandleDummy(SpellEffIndex effIndex) float pct = (_sharedHealth / _sharedHealthMax) * 100.0f;
{ std::list<TargetInfo> const* targetsInfo = GetSpell()->GetUniqueTargetInfo();
PreventHitDefaultEffect(effIndex); for (std::list<TargetInfo>::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
if (Unit* target = GetHitUnit()) if (Creature* target = ObjectAccessor::GetCreature(*GetCaster(), ihit->targetGUID))
{ {
_targetCount++; target->LowerPlayerDamageReq(target->GetMaxHealth());
_sharedHealth += target->GetHealth(); target->SetHealth(CalculatePct(target->GetMaxHealth(), pct));
_sharedHealthMax += target->GetMaxHealth();
} }
} }
void HandleAfterCast() void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidari_council_empyreal_balance::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_illidari_council_empyreal_balance::HandleAfterCast);
}
private:
float _sharedHealth;
float _sharedHealthMax;
uint8 _targetCount;
};
class spell_illidari_council_reflective_shield_aura : public AuraScript
{
PrepareAuraScript(spell_illidari_council_reflective_shield_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_T });
}
void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
Unit* target = GetTarget();
if (dmgInfo.GetAttacker() == target)
return;
int32 bp = absorbAmount / 2;
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, nullptr, nullptr, true, nullptr, aurEff);
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_illidari_council_reflective_shield_aura::ReflectDamage, EFFECT_0);
}
};
class spell_illidari_council_judgement : public SpellScript
{
PrepareSpellScript(spell_illidari_council_judgement);
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit::AuraEffectList const& auras = GetCaster()->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
{ {
if (_targetCount != 4) if ((*i)->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL && (*i)->GetEffIndex() == EFFECT_2)
{ if (sSpellMgr->GetSpellInfo((*i)->GetAmount()))
GetCaster()->ToCreature()->AI()->EnterEvadeMode();
return;
}
float pct = (_sharedHealth / _sharedHealthMax) * 100.0f;
std::list<TargetInfo> const* targetsInfo = GetSpell()->GetUniqueTargetInfo();
for (std::list<TargetInfo>::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
if (Creature* target = ObjectAccessor::GetCreature(*GetCaster(), ihit->targetGUID))
{ {
target->LowerPlayerDamageReq(target->GetMaxHealth()); GetCaster()->CastSpell(GetHitUnit(), (*i)->GetAmount(), true);
target->SetHealth(CalculatePct(target->GetMaxHealth(), pct)); break;
} }
} }
}
void Register() override void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidari_council_empyreal_balance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_illidari_council_empyreal_balance_SpellScript::HandleAfterCast);
}
private:
float _sharedHealth;
float _sharedHealthMax;
uint8 _targetCount;
};
SpellScript* GetSpellScript() const override
{ {
return new spell_illidari_council_empyreal_balance_SpellScript(); OnEffectHitTarget += SpellEffectFn(spell_illidari_council_judgement::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_illidari_council_reflective_shield : public SpellScriptLoader class spell_illidari_council_deadly_strike_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_illidari_council_deadly_strike_aura);
spell_illidari_council_reflective_shield() : SpellScriptLoader("spell_illidari_council_reflective_shield") { }
class spell_illidari_council_reflective_shield_AuraScript : public AuraScript void Update(AuraEffect const* effect)
{ {
PrepareAuraScript(spell_illidari_council_reflective_shield_AuraScript); PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{ {
Unit* target = GetTarget(); GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
if (dmgInfo.GetAttacker() == target) GetUnitOwner()->m_Events.AddEvent(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), GetUnitOwner()->m_Events.CalculateTime(urand(1500, 3500)));
return;
int32 bp = absorbAmount / 2;
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, nullptr, nullptr, true, nullptr, aurEff);
} }
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_illidari_council_reflective_shield_AuraScript::ReflectDamage, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_illidari_council_reflective_shield_AuraScript();
} }
};
class spell_illidari_council_judgement : public SpellScriptLoader void Register() override
{
public:
spell_illidari_council_judgement() : SpellScriptLoader("spell_illidari_council_judgement") { }
class spell_illidari_council_judgement_SpellScript : public SpellScript
{ {
PrepareSpellScript(spell_illidari_council_judgement_SpellScript); OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidari_council_deadly_strike_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit::AuraEffectList const& auras = GetCaster()->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
{
if ((*i)->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL && (*i)->GetEffIndex() == EFFECT_2)
if (sSpellMgr->GetSpellInfo((*i)->GetAmount()))
{
GetCaster()->CastSpell(GetHitUnit(), (*i)->GetAmount(), true);
break;
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_illidari_council_judgement_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_illidari_council_judgement_SpellScript();
}
};
class spell_illidari_council_deadly_strike : public SpellScriptLoader
{
public:
spell_illidari_council_deadly_strike() : SpellScriptLoader("spell_illidari_council_deadly_strike") { }
class spell_illidari_council_deadly_strike_AuraScript : public AuraScript
{
PrepareAuraScript(spell_illidari_council_deadly_strike_AuraScript);
void Update(AuraEffect const* effect)
{
PreventDefaultAction();
if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
{
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
GetUnitOwner()->m_Events.AddEvent(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), GetUnitOwner()->m_Events.CalculateTime(urand(1500, 3500)));
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidari_council_deadly_strike_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_illidari_council_deadly_strike_AuraScript();
} }
}; };
@@ -751,10 +701,10 @@ void AddSC_boss_illidari_council()
new boss_lady_malande(); new boss_lady_malande();
new boss_veras_darkshadow(); new boss_veras_darkshadow();
new boss_high_nethermancer_zerevor(); new boss_high_nethermancer_zerevor();
new spell_illidari_council_balance_of_power(); RegisterSpellScript(spell_illidari_council_balance_of_power_aura);
new spell_illidari_council_empyreal_balance(); RegisterSpellScript(spell_illidari_council_empyreal_balance);
new spell_illidari_council_reflective_shield(); RegisterSpellScript(spell_illidari_council_reflective_shield_aura);
new spell_illidari_council_judgement(); RegisterSpellScript(spell_illidari_council_judgement);
new spell_illidari_council_deadly_strike(); RegisterSpellScript(spell_illidari_council_deadly_strike_aura);
} }

View File

@@ -188,402 +188,290 @@ public:
} }
}; };
class spell_black_template_harpooners_mark : public SpellScriptLoader class spell_black_template_harpooners_mark_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_template_harpooners_mark_aura);
spell_black_template_harpooners_mark() : SpellScriptLoader("spell_black_template_harpooners_mark") { }
class spell_black_template_harpooners_mark_AuraScript : public AuraScript bool Load() override
{ {
PrepareAuraScript(spell_black_template_harpooners_mark_AuraScript) _turtleSet.clear();
return true;
}
bool Load() override void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
std::list<Creature*> creatureList;
GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_DRAGON_TURTLE);
for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{ {
_turtleSet.clear(); (*itr)->TauntApply(GetUnitOwner());
return true; (*itr)->AddThreat(GetUnitOwner(), 10000000.0f);
_turtleSet.insert((*itr)->GetGUID());
} }
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
std::list<Creature*> creatureList; for (ObjectGuid const& guid : _turtleSet)
GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_DRAGON_TURTLE); if (Creature* turtle = ObjectAccessor::GetCreature(*GetUnitOwner(), guid))
for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{ {
(*itr)->TauntApply(GetUnitOwner()); turtle->TauntFadeOut(GetUnitOwner());
(*itr)->AddThreat(GetUnitOwner(), 10000000.0f); turtle->AddThreat(GetUnitOwner(), -10000000.0f);
_turtleSet.insert((*itr)->GetGUID());
} }
} }
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void Register() override
{
for (ObjectGuid const& guid : _turtleSet)
if (Creature* turtle = ObjectAccessor::GetCreature(*GetUnitOwner(), guid))
{
turtle->TauntFadeOut(GetUnitOwner());
turtle->AddThreat(GetUnitOwner(), -10000000.0f);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
GuidSet _turtleSet;
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_template_harpooners_mark_AuraScript(); OnEffectApply += AuraEffectApplyFn(spell_black_template_harpooners_mark_aura::HandleEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_black_template_harpooners_mark_aura::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
private:
GuidSet _turtleSet;
};
class spell_black_template_free_friend : public SpellScript
{
PrepareSpellScript(spell_black_template_free_friend);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->RemoveAurasWithMechanic(IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_black_template_free_friend::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_black_template_free_friend : public SpellScriptLoader class spell_black_temple_curse_of_the_bleakheart_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_curse_of_the_bleakheart_aura);
spell_black_template_free_friend() : SpellScriptLoader("spell_black_template_free_friend") { }
class spell_black_template_free_friend_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_black_template_free_friend_SpellScript); return ValidateSpellInfo({ SPELL_CHEST_PAINS });
}
void HandleScriptEffect(SpellEffIndex effIndex) void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->RemoveAurasWithMechanic(IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_black_template_free_friend_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_black_template_free_friend_SpellScript(); isPeriodic = true;
amplitude = 5000;
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (roll_chance_i(20))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_CHEST_PAINS, true);
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_black_temple_curse_of_the_bleakheart_aura::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_the_bleakheart_aura::Update, EFFECT_0, SPELL_AURA_DUMMY);
} }
}; };
class spell_black_temple_curse_of_the_bleakheart : public SpellScriptLoader class spell_black_temple_skeleton_shot_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_skeleton_shot_aura);
spell_black_temple_curse_of_the_bleakheart() : SpellScriptLoader("spell_black_temple_curse_of_the_bleakheart") { }
class spell_black_temple_curse_of_the_bleakheart_AuraScript : public AuraScript void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_black_temple_curse_of_the_bleakheart_AuraScript); if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_2].CalcValue(), true);
}
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) void Register() override
{
isPeriodic = true;
amplitude = 5000;
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (roll_chance_i(20))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_CHEST_PAINS, true);
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_curse_of_the_bleakheart_AuraScript(); AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_skeleton_shot_aura::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_black_temple_skeleton_shot : public SpellScriptLoader class spell_black_temple_wyvern_sting_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_wyvern_sting_aura);
spell_black_temple_skeleton_shot() : SpellScriptLoader("spell_black_temple_skeleton_shot") { }
class spell_black_temple_skeleton_shot_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_black_temple_skeleton_shot_AuraScript) return ValidateSpellInfo({ SPELL_WYVERN_STING });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_2].CalcValue(), true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_skeleton_shot_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_skeleton_shot_AuraScript(); if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_WYVERN_STING, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_wyvern_sting_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
} }
}; };
class spell_black_temple_wyvern_sting : public SpellScriptLoader class spell_black_temple_charge_rage_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_charge_rage_aura);
spell_black_temple_wyvern_sting() : SpellScriptLoader("spell_black_temple_wyvern_sting") { }
class spell_black_temple_wyvern_sting_AuraScript : public AuraScript void Update(AuraEffect const* effect)
{ {
PrepareAuraScript(spell_black_temple_wyvern_sting_AuraScript) PreventDefaultAction();
if (Unit* target = GetUnitOwner()->SelectNearbyNoTotemTarget((Unit*)nullptr, 50.0f))
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void Register() override
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_WYVERN_STING, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_wyvern_sting_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_charge_rage_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_black_temple_charge_rage : public SpellScriptLoader class spell_black_temple_shadow_inferno_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_shadow_inferno_aura);
spell_black_temple_charge_rage() : SpellScriptLoader("spell_black_temple_charge_rage") { }
class spell_black_temple_charge_rage_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_black_temple_charge_rage_AuraScript); return ValidateSpellInfo({ SPELL_SHADOW_INFERNO_DAMAGE });
}
void Update(AuraEffect const* effect) void Update(AuraEffect const* effect)
{
PreventDefaultAction();
if (Unit* target = GetUnitOwner()->SelectNearbyNoTotemTarget((Unit*)nullptr, 50.0f))
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_charge_rage_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_charge_rage_AuraScript(); PreventDefaultAction();
GetUnitOwner()->CastCustomSpell(SPELL_SHADOW_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, effect->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK);
GetAura()->GetEffect(effect->GetEffIndex())->SetAmount(effect->GetAmount() + 500);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_shadow_inferno_aura::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
} }
}; };
class spell_black_temple_shadow_inferno : public SpellScriptLoader class spell_black_temple_spell_absorption_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_spell_absorption_aura);
spell_black_temple_shadow_inferno() : SpellScriptLoader("spell_black_temple_shadow_inferno") { }
class spell_black_temple_shadow_inferno_AuraScript : public AuraScript void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
PrepareAuraScript(spell_black_temple_shadow_inferno_AuraScript); // Set absorbtion amount to unlimited
amount = -1;
}
void Update(AuraEffect const* effect) void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
PreventDefaultAction();
GetUnitOwner()->CastCustomSpell(SPELL_SHADOW_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, effect->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK);
GetAura()->GetEffect(effect->GetEffIndex())->SetAmount(effect->GetAmount() + 500);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_shadow_inferno_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_shadow_inferno_AuraScript(); absorbAmount = dmgInfo.GetDamage();
}
void Update(AuraEffect const* effect)
{
PreventDefaultAction();
uint32 count = GetUnitOwner()->GetAuraCount(SPELL_CHAOTIC_CHARGE);
if (count == 0)
return;
GetUnitOwner()->CastCustomSpell(GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, SPELLVALUE_BASE_POINT0, effect->GetAmount()*count, GetUnitOwner(), TRIGGERED_FULL_MASK);
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_CHAOTIC_CHARGE);
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_black_temple_spell_absorption_aura::CalculateAmount, EFFECT_2, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_black_temple_spell_absorption_aura::Absorb, EFFECT_2);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_spell_absorption_aura::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE);
} }
}; };
class spell_black_temple_spell_absorption : public SpellScriptLoader class spell_black_temple_bloodbolt : public SpellScript
{ {
public: PrepareSpellScript(spell_black_temple_bloodbolt);
spell_black_temple_spell_absorption() : SpellScriptLoader("spell_black_temple_spell_absorption") { }
class spell_black_temple_spell_absorption_AuraScript : public AuraScript void HandleScriptEffect(SpellEffIndex effIndex)
{ {
PrepareAuraScript(spell_black_temple_spell_absorption_AuraScript); PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, GetEffectValue(), true);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) void Register() override
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = dmgInfo.GetDamage();
}
void Update(AuraEffect const* effect)
{
PreventDefaultAction();
uint32 count = GetUnitOwner()->GetAuraCount(SPELL_CHAOTIC_CHARGE);
if (count == 0)
return;
GetUnitOwner()->CastCustomSpell(GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, SPELLVALUE_BASE_POINT0, effect->GetAmount()*count, GetUnitOwner(), TRIGGERED_FULL_MASK);
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_CHAOTIC_CHARGE);
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_black_temple_spell_absorption_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_black_temple_spell_absorption_AuraScript::Absorb, EFFECT_2);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_spell_absorption_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_spell_absorption_AuraScript(); OnEffectHitTarget += SpellEffectFn(spell_black_temple_bloodbolt::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
class spell_black_temple_bloodbolt : public SpellScriptLoader class spell_black_temple_consuming_strikes_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_consuming_strikes_aura);
spell_black_temple_bloodbolt() : SpellScriptLoader("spell_black_temple_bloodbolt") { }
class spell_black_temple_bloodbolt_SpellScript : public SpellScript void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{ {
PrepareSpellScript(spell_black_temple_bloodbolt_SpellScript); PreventDefaultAction();
GetTarget()->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue(), SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage(), GetTarget(), true);
}
void HandleScriptEffect(SpellEffIndex effIndex) void Register() override
{
PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, GetEffectValue(), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_black_temple_bloodbolt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_black_temple_bloodbolt_SpellScript(); OnEffectProc += AuraEffectProcFn(spell_black_temple_consuming_strikes_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
} }
}; };
class spell_black_temple_consuming_strikes : public SpellScriptLoader class spell_black_temple_curse_of_vitality_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_curse_of_vitality_aura);
spell_black_temple_consuming_strikes() : SpellScriptLoader("spell_black_temple_consuming_strikes") { }
class spell_black_temple_consuming_strikes_AuraScript : public AuraScript void OnPeriodic(AuraEffect const* /*aurEff*/)
{ {
PrepareAuraScript(spell_black_temple_consuming_strikes_AuraScript); if (GetUnitOwner()->HealthBelowPct(50))
SetDuration(0);
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) void Register() override
{
PreventDefaultAction();
GetTarget()->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue(), SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage(), GetTarget(), true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_black_temple_consuming_strikes_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_consuming_strikes_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_vitality_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
} }
}; };
class spell_black_temple_curse_of_vitality : public SpellScriptLoader class spell_black_temple_dementia_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_black_temple_dementia_aura);
spell_black_temple_curse_of_vitality() : SpellScriptLoader("spell_black_temple_curse_of_vitality") { }
class spell_black_temple_curse_of_vitality_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_black_temple_curse_of_vitality_AuraScript); return ValidateSpellInfo({ SPELL_DEMENTIA1, SPELL_DEMENTIA2 });
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
if (GetUnitOwner()->HealthBelowPct(50))
SetDuration(0);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_vitality_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_black_temple_curse_of_vitality_AuraScript();
} }
};
class spell_black_temple_dementia : public SpellScriptLoader void OnPeriodic(AuraEffect const* /*aurEff*/)
{
public:
spell_black_temple_dementia() : SpellScriptLoader("spell_black_temple_dementia") { }
class spell_black_temple_dementia_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_black_temple_dementia_AuraScript); if (roll_chance_i(50))
GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA1, true);
else
GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA2, true);
}
void OnPeriodic(AuraEffect const* /*aurEff*/) void Register() override
{
if (roll_chance_i(50))
GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA1, true);
else
GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA2, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_dementia_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_black_temple_dementia_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_dementia_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
void AddSC_instance_black_temple() void AddSC_instance_black_temple()
{ {
new instance_black_temple(); new instance_black_temple();
new spell_black_template_harpooners_mark(); RegisterSpellScript(spell_black_template_harpooners_mark_aura);
new spell_black_template_free_friend(); RegisterSpellScript(spell_black_template_free_friend);
new spell_black_temple_curse_of_the_bleakheart(); RegisterSpellScript(spell_black_temple_curse_of_the_bleakheart_aura);
new spell_black_temple_skeleton_shot(); RegisterSpellScript(spell_black_temple_skeleton_shot_aura);
new spell_black_temple_wyvern_sting(); RegisterSpellScript(spell_black_temple_wyvern_sting_aura);
new spell_black_temple_charge_rage(); RegisterSpellScript(spell_black_temple_charge_rage_aura);
new spell_black_temple_shadow_inferno(); RegisterSpellScript(spell_black_temple_shadow_inferno_aura);
new spell_black_temple_spell_absorption(); RegisterSpellScript(spell_black_temple_spell_absorption_aura);
new spell_black_temple_bloodbolt(); RegisterSpellScript(spell_black_temple_bloodbolt);
new spell_black_temple_consuming_strikes(); RegisterSpellScript(spell_black_temple_consuming_strikes_aura);
new spell_black_temple_curse_of_vitality(); RegisterSpellScript(spell_black_temple_curse_of_vitality_aura);
new spell_black_temple_dementia(); RegisterSpellScript(spell_black_temple_dementia_aura);
} }