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

* instance_azjol_nerub spell:spell_azjol_nerub_fixate

* instance_azjol_nerub aura:spell_azjol_nerub_web_wrap_aura

* boss_hadronox aura:spell_hadronox_summon_periodic_aura

* boss_hadronox aura:spell_hadronox_leech_poison_aura

* boss_argent_challenge spell:spell_eadric_radiance

* boss_argent_challenge spell:spell_toc5_light_rain

* boss_argent_challenge aura:spell_reflective_shield_aura

* fixup! boss_argent_challenge aura:spell_reflective_shield_aura

* instance_drak_tharon_keep aura:spell_dtk_raise_dead_aura

* instance_drak_tharon_keep spell:spell_dtk_summon_random_drakkari

* boss_trollgore spell:spell_trollgore_consume

* boss_trollgore aura:spell_trollgore_corpse_explode_aura

* boss_trollgore spell:spell_trollgore_invader_taunt

* boss_novos spell:spell_novos_despawn_crystal_handler

* boss_novos aura:spell_novos_crystal_handler_death_aura

* boss_novos spell:spell_novos_summon_minions

* boss_tharon_ja aura:spell_tharon_ja_curse_of_life_aura

* boss_tharon_ja aura:spell_tharon_ja_dummy_aura

* boss_tharon_ja spell:spell_tharon_ja_clear_gift_of_tharon_ja

* boss_dred aura:spell_dred_grievious_bite_aura

* boss_dred spell:spell_dred_raptor_call

* boss_moorabi aura:spell_moorabi_mojo_frenzy_aura

* boss_slad_ran aura:spell_sladran_grip_of_sladran_aura

* boss_drakkari_colossus spell:spell_drakkari_colossus_emerge

* boss_drakkari_colossus spell:spell_drakkari_colossus_surge

* boss_drakkari_colossus spell:spell_drakkari_colossus_face_me

* boss_gal_darah spell:spell_galdarah_impaling_charge

* boss_gal_darah spell:spell_galdarah_transform

* boss_malygos spell:spell_eoe_ph3_surge_of_power

* oculus aura:spell_oculus_stop_time_aura

* oculus aura:spell_oculus_evasive_maneuvers_aura

* oculus spell:spell_oculus_shock_lance

* oculus aura:spell_oculus_temporal_rift_aura

* oculus spell:spell_oculus_touch_the_nightmare

* oculus aura:spell_oculus_dream_funnel_aura

* oculus spell:spell_oculus_call_ruby_emerald_amber_drake

* oculus aura:spell_oculus_ride_ruby_emerald_amber_drake_que_aura

* oculus aura:spell_oculus_evasive_charges_aura

* oculus aura:spell_oculus_soar_aura

* oculus aura:spell_oculus_rider_aura

* oculus aura:spell_oculus_drake_flag_aura

* boss_magus_telestra aura:spell_boss_magus_telestra_summon_telestra_clones_aura

* boss_magus_telestra spell:spell_boss_magus_telestra_gravity_well

* utgarde_keep aura:spell_ticking_time_bomb_aura

* boss_keleseth aura:spell_frost_tomb_aura

* boss_svala pair:spell_svala_ritual_strike

* boss_moragg aura:spell_optic_link_aura

* violet_hold aura:spell_destroy_door_seal_aura

* forge_of_souls aura:spell_shield_of_bones_aura

* boss_devourer_of_souls aura:spell_wailing_souls_periodic_aura

* boss_bronjahm spell:spell_bronjahm_magic_bane

* boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* boss_bronjahm spell:spell_bronjahm_soulstorm_targeting

* boss_krickandick aura:spell_krick_explosive_barrage_aura

* boss_krickandick aura:spell_exploding_orb_auto_grow_aura

* pit_of_saron aura:spell_pos_empowered_blizzard_aura

* pit_of_saron spell:spell_pos_slave_trigger_closest

* pit_of_saron spell:spell_pos_rimefang_frost_nova

* pit_of_saron aura:spell_pos_blight_aura

* pit_of_saron aura:spell_pos_glacial_strike_aura

* boss_forgemaster_garfrost spell:spell_garfrost_permafrost

* halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* boss_marwyn aura:spell_hor_shared_suffering_aura

* fixup! forge_of_souls aura:spell_shield_of_bones_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* fixup! pit_of_saron aura:spell_pos_empowered_blizzard_aura

* fixup! halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* fixup! boss_marwyn aura:spell_hor_shared_suffering_aura
This commit is contained in:
Jelle Meeus
2024-06-23 19:17:19 +02:00
committed by GitHub
parent b055faf8ee
commit cd9dff5032
29 changed files with 1282 additions and 1765 deletions

View File

@@ -1488,59 +1488,48 @@ public:
}
};
class spell_eoe_ph3_surge_of_power : public SpellScriptLoader
class spell_eoe_ph3_surge_of_power : public SpellScript
{
public:
spell_eoe_ph3_surge_of_power() : SpellScriptLoader("spell_eoe_ph3_surge_of_power") { }
PrepareSpellScript(spell_eoe_ph3_surge_of_power);
class spell_eoe_ph3_surge_of_power_SpellScript : public SpellScript
ObjectGuid DrakeGUID[3];
bool Load() override
{
PrepareSpellScript(spell_eoe_ph3_surge_of_power_SpellScript);
ObjectGuid DrakeGUID[3];
bool Load() override
{
if (Unit* caster = GetCaster())
if (Creature* c = caster->ToCreature())
{
uint8 i = 0;
std::list<Unit*> drakes;
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
{
DrakeGUID[i++] = (*itr)->GetGUID();
if (Vehicle* v = (*itr)->GetVehicleKit())
if (Unit* p = v->GetPassenger(0))
if (Player* plr = p->ToPlayer())
c->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, plr);
}
}
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (Unit* caster = GetCaster())
if (Unit* caster = GetCaster())
if (Creature* c = caster->ToCreature())
{
targets.clear();
for (uint8 i = 0; i < 3; ++i)
if (DrakeGUID[i])
if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i]))
targets.push_back(u);
uint8 i = 0;
std::list<Unit*> drakes;
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
{
DrakeGUID[i++] = (*itr)->GetGUID();
if (Vehicle* v = (*itr)->GetVehicleKit())
if (Unit* p = v->GetPassenger(0))
if (Player* plr = p->ToPlayer())
c->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, plr);
}
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
return true;
}
SpellScript* GetSpellScript() const override
void FilterTargets(std::list<WorldObject*>& targets)
{
return new spell_eoe_ph3_surge_of_power_SpellScript();
if (Unit* caster = GetCaster())
{
targets.clear();
for (uint8 i = 0; i < 3; ++i)
if (DrakeGUID[i])
if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i]))
targets.push_back(u);
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -1556,5 +1545,5 @@ void AddSC_boss_malygos()
new npc_hover_disk();
new npc_eoe_wyrmrest_skytalon();
new spell_eoe_ph3_surge_of_power();
RegisterSpellScript(spell_eoe_ph3_surge_of_power);
}

View File

@@ -230,99 +230,82 @@ public:
};
};
class spell_boss_magus_telestra_summon_telestra_clones : public SpellScriptLoader
class spell_boss_magus_telestra_summon_telestra_clones_aura : public AuraScript
{
public:
spell_boss_magus_telestra_summon_telestra_clones() : SpellScriptLoader("spell_boss_magus_telestra_summon_telestra_clones") { }
PrepareAuraScript(spell_boss_magus_telestra_summon_telestra_clones_aura);
class spell_boss_magus_telestra_summon_telestra_clones_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_boss_magus_telestra_summon_telestra_clones_AuraScript);
return ValidateSpellInfo({ SPELL_FIRE_MAGUS_SUMMON, SPELL_FROST_MAGUS_SUMMON, SPELL_ARCANE_MAGUS_SUMMON });
}
bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true);
GetUnitOwner()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
bool Load() override
{
return new spell_boss_magus_telestra_summon_telestra_clones_AuraScript();
return GetUnitOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true);
GetUnitOwner()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(0, true);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED);
GetUnitOwner()->ToCreature()->LoadEquipment(1, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove, EFFECT_1, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_boss_magus_telestra_gravity_well : public SpellScriptLoader
class spell_boss_magus_telestra_gravity_well : public SpellScript
{
public:
spell_boss_magus_telestra_gravity_well() : SpellScriptLoader("spell_boss_magus_telestra_gravity_well") { }
PrepareSpellScript(spell_boss_magus_telestra_gravity_well);
class spell_boss_magus_telestra_gravity_well_SpellScript : public SpellScript
void SelectTarget(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_boss_magus_telestra_gravity_well_SpellScript);
targets.remove_if(Acore::RandomCheck(50));
}
void SelectTarget(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::RandomCheck(50));
}
void HandlePull(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
Position pos;
if (target->GetDistance(GetCaster()) < 5.0f)
{
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float o = frand(0, 2 * M_PI);
target->MovePositionToFirstCollision(pos, 20.0f, o);
pos.m_positionZ += frand(5.0f, 15.0f);
}
else
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f;
float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity;
target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_boss_magus_telestra_gravity_well_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST);
}
};
SpellScript* GetSpellScript() const override
void HandlePull(SpellEffIndex effIndex)
{
return new spell_boss_magus_telestra_gravity_well_SpellScript();
PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
Position pos;
if (target->GetDistance(GetCaster()) < 5.0f)
{
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float o = frand(0, 2 * M_PI);
target->MovePositionToFirstCollision(pos, 20.0f, o);
pos.m_positionZ += frand(5.0f, 15.0f);
}
else
pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ() + 1.0f);
float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f;
float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity;
target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_boss_magus_telestra_gravity_well::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST);
}
};
@@ -345,7 +328,7 @@ public:
void AddSC_boss_magus_telestra()
{
new boss_magus_telestra();
new spell_boss_magus_telestra_summon_telestra_clones();
new spell_boss_magus_telestra_gravity_well();
RegisterSpellScript(spell_boss_magus_telestra_summon_telestra_clones_aura);
RegisterSpellScript(spell_boss_magus_telestra_gravity_well);
new achievement_split_personality();
}

View File

@@ -532,486 +532,374 @@ public:
};
// 49838 - Stop Time
class spell_oculus_stop_time : public SpellScriptLoader
class spell_oculus_stop_time_aura : public AuraScript
{
public:
spell_oculus_stop_time() : SpellScriptLoader("spell_oculus_stop_time") { }
PrepareAuraScript(spell_oculus_stop_time_aura);
class spell_oculus_stop_time_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_oculus_stop_time_AuraScript);
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Unit* target = GetTarget();
for (uint32 i = 0; i < 5; ++i)
caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_oculus_stop_time_AuraScript();
Unit* caster = GetCaster();
if (!caster)
return;
Unit* target = GetTarget();
for (uint32 i = 0; i < 5; ++i)
caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_aura::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
// 50240 - Evasive Maneuvers
class spell_oculus_evasive_maneuvers : public SpellScriptLoader
class spell_oculus_evasive_maneuvers_aura : public AuraScript
{
public:
spell_oculus_evasive_maneuvers() : SpellScriptLoader("spell_oculus_evasive_maneuvers") { }
PrepareAuraScript(spell_oculus_evasive_maneuvers_aura);
class spell_oculus_evasive_maneuvers_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_oculus_evasive_maneuvers_AuraScript);
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES);
if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES))
SetDuration(0);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
return new spell_oculus_evasive_maneuvers_AuraScript();
PreventDefaultAction();
GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES);
if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES))
SetDuration(0);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_aura::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
// 49840 - Shock Lance
class spell_oculus_shock_lance : public SpellScriptLoader
class spell_oculus_shock_lance : public SpellScript
{
public:
spell_oculus_shock_lance() : SpellScriptLoader("spell_oculus_shock_lance") { }
PrepareSpellScript(spell_oculus_shock_lance);
class spell_oculus_shock_lance_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_oculus_shock_lance_SpellScript);
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void CalcDamage()
{
int32 damage = GetHitDamage();
if (Unit* target = GetHitUnit())
if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster
{
damage += aura->GetStackAmount() * 6525;
aura->Remove();
}
SetHitDamage(damage);
}
void Register() override
{
OnHit += SpellHitFn(spell_oculus_shock_lance_SpellScript::CalcDamage);
}
};
SpellScript* GetSpellScript() const override
void CalcDamage()
{
return new spell_oculus_shock_lance_SpellScript();
int32 damage = GetHitDamage();
if (Unit* target = GetHitUnit())
if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster
{
damage += aura->GetStackAmount() * 6525;
aura->Remove();
}
SetHitDamage(damage);
}
void Register() override
{
OnHit += SpellHitFn(spell_oculus_shock_lance::CalcDamage);
}
};
// 49592 - Temporal Rift
class spell_oculus_temporal_rift : public SpellScriptLoader
class spell_oculus_temporal_rift_aura : public AuraScript
{
public:
spell_oculus_temporal_rift() : SpellScriptLoader("spell_oculus_temporal_rift") { }
PrepareAuraScript(spell_oculus_temporal_rift_aura);
class spell_oculus_temporal_rift_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_oculus_temporal_rift_AuraScript);
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 amount = aurEff->GetAmount() + damageInfo->GetDamage();
uint8 num = amount / 15000;
if (amount >= 15000)
{
if (Unit* caster = GetCaster())
for (uint8 i = 0; i < num; ++i )
caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true);
}
const_cast<AuraEffect*>(aurEff)->SetAmount(amount - 15000 * num);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
return new spell_oculus_temporal_rift_AuraScript();
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return;
}
int32 amount = aurEff->GetAmount() + damageInfo->GetDamage();
uint8 num = amount / 15000;
if (amount >= 15000)
{
if (Unit* caster = GetCaster())
for (uint8 i = 0; i < num; ++i )
caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true);
}
const_cast<AuraEffect*>(aurEff)->SetAmount(amount - 15000 * num);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_aura::HandleProc, EFFECT_2, SPELL_AURA_DUMMY);
}
};
// 50341 - Touch the Nightmare
class spell_oculus_touch_the_nightmare : public SpellScriptLoader
class spell_oculus_touch_the_nightmare : public SpellScript
{
public:
spell_oculus_touch_the_nightmare() : SpellScriptLoader("spell_oculus_touch_the_nightmare") { }
PrepareSpellScript(spell_oculus_touch_the_nightmare);
class spell_oculus_touch_the_nightmare_SpellScript : public SpellScript
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_oculus_touch_the_nightmare_SpellScript);
SetHitDamage(int32(GetCaster()->CountPctFromMaxHealth(30)));
}
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
{
SetHitDamage(int32(GetCaster()->CountPctFromMaxHealth(30)));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oculus_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_oculus_touch_the_nightmare_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_oculus_touch_the_nightmare::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
// 50344 - Dream Funnel
class spell_oculus_dream_funnel : public SpellScriptLoader
class spell_oculus_dream_funnel_aura : public AuraScript
{
public:
spell_oculus_dream_funnel() : SpellScriptLoader("spell_oculus_dream_funnel") { }
PrepareAuraScript(spell_oculus_dream_funnel_aura);
class spell_oculus_dream_funnel_AuraScript : public AuraScript
void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
{
PrepareAuraScript(spell_oculus_dream_funnel_AuraScript);
if (Unit* caster = GetCaster())
amount = int32(caster->CountPctFromMaxHealth(5));
void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
{
if (Unit* caster = GetCaster())
amount = int32(caster->CountPctFromMaxHealth(5));
canBeRecalculated = false;
}
canBeRecalculated = false;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_oculus_dream_funnel_AuraScript();
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_aura::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_aura::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
}
};
class spell_oculus_call_ruby_emerald_amber_drake : public SpellScriptLoader
class spell_oculus_call_ruby_emerald_amber_drake : public SpellScript
{
public:
spell_oculus_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_oculus_call_ruby_emerald_amber_drake") { }
PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake);
class spell_oculus_call_ruby_emerald_amber_drake_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake_SpellScript);
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 12.0f, 0.0f };
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 12.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_oculus_call_ruby_emerald_amber_drake_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_oculus_call_ruby_emerald_amber_drake::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
}
};
class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader
class spell_oculus_ride_ruby_emerald_amber_drake_que_aura : public AuraScript
{
public:
spell_oculus_ride_ruby_emerald_amber_drake_que() : SpellScriptLoader("spell_oculus_ride_ruby_emerald_amber_drake_que") { }
PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_aura);
class spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript : public AuraScript
void HandlePeriodic(AuraEffect const* aurEff)
{
PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript);
// caster of the triggered spell is wrong for an unknown reason, handle it here correctly
PreventDefaultAction();
if (Unit* caster = GetCaster())
GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void HandlePeriodic(AuraEffect const* aurEff)
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_oculus_evasive_charges_aura : public AuraScript
{
PrepareAuraScript(spell_oculus_evasive_charges_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_MANEUVERS });
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
// caster of the triggered spell is wrong for an unknown reason, handle it here correctly
caster->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_MANEUVERS);
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, false);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_evasive_charges_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_evasive_charges_aura::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_oculus_soar_aura : public AuraScript
{
PrepareAuraScript(spell_oculus_soar_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SOAR_BUFF });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->getAttackers().empty())
{
if (caster->HasAura(SPELL_SOAR_BUFF))
caster->RemoveAurasDueToSpell(SPELL_SOAR_BUFF);
PreventDefaultAction();
if (Unit* caster = GetCaster())
GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
return;
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
AuraScript* GetAuraScript() const override
// We handle the health regen here, normal heal regen isn't working....
if (caster->GetHealth() < caster->GetMaxHealth())
caster->SetHealth(caster->GetHealth() + (uint32)((double)caster->GetMaxHealth() * 0.2));
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript();
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_soar_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_oculus_soar_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_oculus_evasive_charges : public SpellScriptLoader
class spell_oculus_rider_aura : public AuraScript
{
public:
spell_oculus_evasive_charges() : SpellScriptLoader("spell_oculus_evasive_charges") { }
PrepareAuraScript(spell_oculus_rider_aura);
class spell_oculus_evasive_chargesAuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_oculus_evasive_chargesAuraScript);
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
caster->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_MANEUVERS);
caster->ModifyAuraState(AURA_STATE_UNKNOWN22, false);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_evasive_chargesAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_evasive_chargesAuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_evasive_chargesAuraScript();
return ValidateSpellInfo({ SPELL_SOAR_TRIGGER, SPELL_RUBY_EVASIVE_AURA, SPELL_DRAKE_FLAG_VISUAL });
}
};
class spell_oculus_soar : public SpellScriptLoader
{
public:
spell_oculus_soar() : SpellScriptLoader("spell_oculus_soar") { }
ObjectGuid _drakeGUID;
class spell_oculus_soarAuraScript : public AuraScript
void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_oculus_soarAuraScript);
Unit* caster = GetCaster();
if (!caster)
return;
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
return;
switch (aurEff->GetEffIndex())
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->getAttackers().empty())
{
if (caster->HasAura(SPELL_SOAR_BUFF))
caster->RemoveAurasDueToSpell(SPELL_SOAR_BUFF);
case EFFECT_1:
_drakeGUID = drake->GetGUID();
caster->AddAura(SPELL_DRAKE_FLAG_VISUAL, caster);
caster->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
drake->CastSpell(drake, SPELL_SOAR_TRIGGER);
if (drake->GetEntry() == NPC_RUBY_DRAKE)
drake->CastSpell(drake, SPELL_RUBY_EVASIVE_AURA);
break;
case EFFECT_2:
caster->AddAura(SPELL_SCALE_STATS, drake);
PreventDefaultAction();
return;
}
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
// We handle the health regen here, normal heal regen isn't working....
if (caster->GetHealth() < caster->GetMaxHealth())
caster->SetHealth(caster->GetHealth() + (uint32)((double)caster->GetMaxHealth() * 0.2));
break;
}
}
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!caster->HasAura(SPELL_SOAR_BUFF))
caster->CastSpell(caster, SPELL_SOAR_BUFF, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_soarAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_oculus_soarAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_oculus_soarAuraScript();
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = ObjectAccessor::GetCreature(*caster, _drakeGUID);
if (drake)
{
drake->RemoveUnitFlag(UNIT_FLAG_POSSESSED);
drake->RemoveAurasDueToSpell(GetId());
drake->RemoveAurasDueToSpell(SPELL_SOAR_TRIGGER);
drake->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_AURA);
}
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_aura::HandleOnEffectApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_aura::HandleOnEffectApply, EFFECT_2, SPELL_AURA_LINKED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_rider_aura::HandleOnEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
class spell_oculus_rider_aura : public SpellScriptLoader
class spell_oculus_drake_flag_aura : public AuraScript
{
public:
spell_oculus_rider_aura() : SpellScriptLoader("spell_oculus_rider_aura") { }
PrepareAuraScript(spell_oculus_drake_flag_aura);
class spell_oculus_rider_auraAuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_oculus_rider_auraAuraScript);
return ValidateSpellInfo({ SPELL_DRAKE_FLAG_VISUAL });
}
ObjectGuid _drakeGUID;
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
void HandleOnEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
{
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
return;
switch (aurEff->GetEffIndex())
{
case EFFECT_1:
_drakeGUID = drake->GetGUID();
caster->AddAura(SPELL_DRAKE_FLAG_VISUAL, caster);
caster->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
drake->CastSpell(drake, SPELL_SOAR_TRIGGER);
if (drake->GetEntry() == NPC_RUBY_DRAKE)
drake->CastSpell(drake, SPELL_RUBY_EVASIVE_AURA);
break;
case EFFECT_2:
caster->AddAura(SPELL_SCALE_STATS, drake);
PreventDefaultAction();
break;
}
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = ObjectAccessor::GetCreature(*caster, _drakeGUID);
if (drake)
{
drake->RemoveUnitFlag(UNIT_FLAG_POSSESSED);
drake->RemoveAurasDueToSpell(GetId());
drake->RemoveAurasDueToSpell(SPELL_SOAR_TRIGGER);
drake->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_AURA);
}
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_auraAuraScript::HandleOnEffectApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectApply += AuraEffectApplyFn(spell_oculus_rider_auraAuraScript::HandleOnEffectApply, EFFECT_2, SPELL_AURA_LINKED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_oculus_rider_auraAuraScript::HandleOnEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_rider_auraAuraScript();
}
};
class spell_oculus_drake_flag : public SpellScriptLoader
{
public:
spell_oculus_drake_flag() : SpellScriptLoader("spell_oculus_drake_flag") { }
class spell_oculus_drake_flagAuraScript : public AuraScript
void Register() override
{
PrepareAuraScript(spell_oculus_drake_flagAuraScript);
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
Creature* drake = caster->GetVehicleCreatureBase();
if (!drake)
{
caster->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
caster->RemoveAurasDueToSpell(SPELL_DRAKE_FLAG_VISUAL);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_oculus_drake_flagAuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_oculus_drake_flagAuraScript();
OnEffectApply += AuraEffectApplyFn(spell_oculus_drake_flag_aura::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
@@ -1021,17 +909,17 @@ void AddSC_oculus()
new npc_oculus_drake();
new npc_centrifuge_construct();
new spell_oculus_stop_time();
new spell_oculus_evasive_maneuvers();
new spell_oculus_shock_lance();
new spell_oculus_temporal_rift();
new spell_oculus_touch_the_nightmare();
new spell_oculus_dream_funnel();
new spell_oculus_call_ruby_emerald_amber_drake();
new spell_oculus_ride_ruby_emerald_amber_drake_que();
new spell_oculus_evasive_charges();
new spell_oculus_soar();
new spell_oculus_rider_aura();
new spell_oculus_drake_flag();
RegisterSpellScript(spell_oculus_stop_time_aura);
RegisterSpellScript(spell_oculus_evasive_maneuvers_aura);
RegisterSpellScript(spell_oculus_shock_lance);
RegisterSpellScript(spell_oculus_temporal_rift_aura);
RegisterSpellScript(spell_oculus_touch_the_nightmare);
RegisterSpellScript(spell_oculus_dream_funnel_aura);
RegisterSpellScript(spell_oculus_call_ruby_emerald_amber_drake);
RegisterSpellScript(spell_oculus_ride_ruby_emerald_amber_drake_que_aura);
RegisterSpellScript(spell_oculus_evasive_charges_aura);
RegisterSpellScript(spell_oculus_soar_aura);
RegisterSpellScript(spell_oculus_rider_aura);
RegisterSpellScript(spell_oculus_drake_flag_aura);
}