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

@@ -47,6 +47,7 @@ enum eSpells
SPELL_TELEPORT_VISUAL = 52096,
SPELL_SOULSTORM_VISUAL = 68870,
SPELL_SOULSTORM_VISUAL2 = 68904,
SPELL_SOULSTORM = 68872,
};
@@ -263,136 +264,102 @@ public:
}
};
class spell_bronjahm_magic_bane : public SpellScriptLoader
class spell_bronjahm_magic_bane : public SpellScript
{
public:
spell_bronjahm_magic_bane() : SpellScriptLoader("spell_bronjahm_magic_bane") { }
PrepareSpellScript(spell_bronjahm_magic_bane);
class spell_bronjahm_magic_bane_SpellScript : public SpellScript
void RecalculateDamage()
{
PrepareSpellScript(spell_bronjahm_magic_bane_SpellScript);
if (GetHitUnit()->getPowerType() != POWER_MANA)
return;
void RecalculateDamage()
if (Unit* caster = GetCaster())
{
if (GetHitUnit()->getPowerType() != POWER_MANA)
return;
const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000;
int32 newDamage = GetHitDamage();
newDamage += GetHitUnit()->GetMaxPower(POWER_MANA) / 2;
newDamage = std::min<int32>(maxDamage, newDamage);
if (Unit* caster = GetCaster())
{
const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000;
int32 newDamage = GetHitDamage();
newDamage += GetHitUnit()->GetMaxPower(POWER_MANA) / 2;
newDamage = std::min<int32>(maxDamage, newDamage);
SetHitDamage(newDamage);
}
SetHitDamage(newDamage);
}
}
void Register() override
{
OnHit += SpellHitFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_bronjahm_magic_bane_SpellScript();
OnHit += SpellHitFn(spell_bronjahm_magic_bane::RecalculateDamage);
}
};
class spell_bronjahm_soulstorm_channel_ooc : public SpellScriptLoader
class spell_bronjahm_soulstorm_channel_ooc_aura : public AuraScript
{
public:
spell_bronjahm_soulstorm_channel_ooc() : SpellScriptLoader("spell_bronjahm_soulstorm_channel_ooc") { }
PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_aura);
class spell_bronjahm_soulstorm_channel_ooc_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_AuraScript);
return ValidateSpellInfo({ SPELL_SOULSTORM_VISUAL2, SPELL_SOULSTORM_VISUAL2+1, SPELL_SOULSTORM_VISUAL2+2, SPELL_SOULSTORM_VISUAL2+3 });
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), 68904 + (aurEff->GetTickNumber() % 4), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodicTick(AuraEffect const* aurEff)
{
return new spell_bronjahm_soulstorm_channel_ooc_AuraScript();
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), SPELL_SOULSTORM_VISUAL2 + (aurEff->GetTickNumber() % 4), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_bronjahm_soulstorm_visual : public SpellScriptLoader
class spell_bronjahm_soulstorm_visual_aura : public AuraScript
{
public:
spell_bronjahm_soulstorm_visual() : SpellScriptLoader("spell_bronjahm_soulstorm_visual") { }
PrepareAuraScript(spell_bronjahm_soulstorm_visual_aura);
class spell_bronjahm_soulstorm_visual_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript);
return ValidateSpellInfo({ 68886, 68896, 68897, 68898 });
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
uint32 spellId = 0;
switch (aurEff->GetTickNumber() % 4)
{
case 0:
spellId = 68886;
break;
case 1:
spellId = 68896;
break;
case 2:
spellId = 68897;
break;
case 3:
spellId = 68898;
break;
}
GetTarget()->CastSpell(GetTarget(), spellId, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodicTick(AuraEffect const* aurEff)
{
return new spell_bronjahm_soulstorm_visual_AuraScript();
PreventDefaultAction();
uint32 spellId = 0;
switch (aurEff->GetTickNumber() % 4)
{
case 0:
spellId = 68886;
break;
case 1:
spellId = 68896;
break;
case 2:
spellId = 68897;
break;
case 3:
spellId = 68898;
break;
}
GetTarget()->CastSpell(GetTarget(), spellId, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader
class spell_bronjahm_soulstorm_targeting : public SpellScript
{
public:
spell_bronjahm_soulstorm_targeting() : SpellScriptLoader("spell_bronjahm_soulstorm_targeting") { }
PrepareSpellScript(spell_bronjahm_soulstorm_targeting);
class spell_bronjahm_soulstorm_targeting_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript);
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false));
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_bronjahm_soulstorm_targeting_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -401,9 +368,9 @@ void AddSC_boss_bronjahm()
new boss_bronjahm();
new npc_fos_corrupted_soul_fragment();
new spell_bronjahm_magic_bane();
new spell_bronjahm_soulstorm_channel_ooc();
new spell_bronjahm_soulstorm_visual();
new spell_bronjahm_soulstorm_targeting();
RegisterSpellScript(spell_bronjahm_magic_bane);
RegisterSpellScript(spell_bronjahm_soulstorm_channel_ooc_aura);
RegisterSpellScript(spell_bronjahm_soulstorm_visual_aura);
RegisterSpellScript(spell_bronjahm_soulstorm_targeting);
}

View File

@@ -308,73 +308,67 @@ public:
}
};
class spell_wailing_souls_periodic : public SpellScriptLoader
class spell_wailing_souls_periodic_aura : public AuraScript
{
public:
spell_wailing_souls_periodic() : SpellScriptLoader("spell_wailing_souls_periodic") { }
PrepareAuraScript(spell_wailing_souls_periodic_aura);
class spell_wailing_souls_periodic_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_wailing_souls_periodic_AuraScript);
return ValidateSpellInfo({ SPELL_WAILING_SOULS_DMG_N });
}
int8 dir;
int8 dir;
bool Load() override
bool Load() override
{
dir = urand(0, 1) ? 1 : -1;
return true;
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* t = GetTarget())
{
dir = urand(0, 1) ? 1 : -1;
return true;
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* t = GetTarget())
if (aurEff->GetTickNumber() < 30)
{
if (aurEff->GetTickNumber() < 30)
{
// spinning, casting, etc.
float diff = (2 * M_PI) / (4 * 30);
float new_o = t->GetOrientation() + diff * dir;
if (new_o >= 2 * M_PI)
new_o -= 2 * M_PI;
else if (new_o < 0)
new_o += 2 * M_PI;
t->UpdateOrientation(new_o);
t->SetFacingTo(new_o);
t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true);
}
else if (aurEff->GetTickNumber() == 33)
{
t->SetControlled(false, UNIT_STATE_ROOT);
t->DisableRotate(false);
if (t->GetTypeId() == TYPEID_UNIT)
t->ToCreature()->SetReactState(REACT_AGGRESSIVE);
if (t->GetVictim())
{
t->SetGuidValue(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID());
t->GetMotionMaster()->MoveChase(t->GetVictim());
}
}
else if (aurEff->GetTickNumber() >= 34)
Remove(AURA_REMOVE_BY_EXPIRE);
// spinning, casting, etc.
float diff = (2 * M_PI) / (4 * 30);
float new_o = t->GetOrientation() + diff * dir;
if (new_o >= 2 * M_PI)
new_o -= 2 * M_PI;
else if (new_o < 0)
new_o += 2 * M_PI;
t->UpdateOrientation(new_o);
t->SetFacingTo(new_o);
t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true);
}
else if (aurEff->GetTickNumber() == 33)
{
t->SetControlled(false, UNIT_STATE_ROOT);
t->DisableRotate(false);
if (t->GetTypeId() == TYPEID_UNIT)
t->ToCreature()->SetReactState(REACT_AGGRESSIVE);
if (t->GetVictim())
{
t->SetGuidValue(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID());
t->GetMotionMaster()->MoveChase(t->GetVictim());
}
}
else if (aurEff->GetTickNumber() >= 34)
Remove(AURA_REMOVE_BY_EXPIRE);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_wailing_souls_periodic_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
void AddSC_boss_devourer_of_souls()
{
new boss_devourer_of_souls();
new spell_wailing_souls_periodic();
RegisterSpellScript(spell_wailing_souls_periodic_aura);
}

View File

@@ -256,45 +256,44 @@ public:
}
};
class spell_shield_of_bones : public SpellScriptLoader
enum ShieldOfBones
{
public:
spell_shield_of_bones() : SpellScriptLoader("spell_shield_of_bones") { }
SPELL_SHIELD_OF_BONES_DAMAGE = 69642
};
class spell_shield_of_bones_AuraScript : public AuraScript
class spell_shield_of_bones_aura : public AuraScript
{
PrepareAuraScript(spell_shield_of_bones_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_shield_of_bones_AuraScript);
return ValidateSpellInfo({ SPELL_SHIELD_OF_BONES_DAMAGE });
}
int32 amount;
bool fired;
int32 amount;
bool fired;
bool Load() override
{
fired = false;
amount = 0;
return true;
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{
amount += absorbAmount;
if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints + 1)
if (Unit* caster = GetCaster())
{
fired = true;
caster->CastSpell(caster, 69642, true);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_AuraScript::HandleAfterEffectAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
bool Load() override
{
return new spell_shield_of_bones_AuraScript();
fired = false;
amount = 0;
return true;
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{
amount += absorbAmount;
if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints + 1)
if (Unit* caster = GetCaster())
{
fired = true;
caster->CastSpell(caster, SPELL_SHIELD_OF_BONES_DAMAGE, true);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_aura::HandleAfterEffectAbsorb, EFFECT_0);
}
};
@@ -302,6 +301,6 @@ void AddSC_forge_of_souls()
{
new npc_fos_leader();
new npc_fos_leader_second();
new spell_shield_of_bones();
RegisterSpellScript(spell_shield_of_bones_aura);
}

View File

@@ -169,50 +169,49 @@ public:
}
};
class spell_hor_shared_suffering : public SpellScriptLoader
enum SharedSufferingAura
{
public:
spell_hor_shared_suffering() : SpellScriptLoader("spell_hor_shared_suffering") { }
SPELL_SHARED_SUFFERING_DAMAGE = 72373
};
class spell_hor_shared_sufferingAuraScript : public AuraScript
class spell_hor_shared_suffering_aura : public AuraScript
{
PrepareAuraScript(spell_hor_shared_suffering_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_hor_shared_sufferingAuraScript);
return ValidateSpellInfo({ SPELL_SHARED_SUFFERING_DAMAGE });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled
if (Unit* caster = GetCaster())
if (Map* map = caster->FindMap())
if (Aura* a = aurEff->GetBase())
{
uint32 count = 0;
uint32 ticks = 0;
uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints;
Map::PlayerList const& pl = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource())
if (p->IsAlive())
++count;
ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1;
int32 dmg = (ticks * dmgPerTick) / count;
caster->CastCustomSpell(GetTarget(), 72373, nullptr, &dmg, nullptr, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_sufferingAuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
return new spell_hor_shared_sufferingAuraScript();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled
if (Unit* caster = GetCaster())
if (Map* map = caster->FindMap())
if (Aura* a = aurEff->GetBase())
{
uint32 count = 0;
uint32 ticks = 0;
uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints;
Map::PlayerList const& pl = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource())
if (p->IsAlive())
++count;
ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1;
int32 dmg = (ticks * dmgPerTick) / count;
caster->CastCustomSpell(GetTarget(), SPELL_SHARED_SUFFERING_DAMAGE, nullptr, &dmg, nullptr, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_suffering_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_boss_marwyn()
{
new boss_marwyn();
new spell_hor_shared_suffering();
RegisterSpellScript(spell_hor_shared_suffering_aura);
}

View File

@@ -2315,34 +2315,33 @@ public:
}
};
class spell_hor_gunship_cannon_fire : public SpellScriptLoader
enum GunshipCannonFire
{
public:
spell_hor_gunship_cannon_fire() : SpellScriptLoader("spell_hor_gunship_cannon_fire") { }
SPELL_GUNSHIP_CANNON_FIRE = 70021
};
class spell_hor_gunship_cannon_fireAuraScript : public AuraScript
class spell_hor_gunship_cannon_fire_aura : public AuraScript
{
PrepareAuraScript(spell_hor_gunship_cannon_fire_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_hor_gunship_cannon_fireAuraScript)
return ValidateSpellInfo({ SPELL_GUNSHIP_CANNON_FIRE });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (Creature* c = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN, 1))
{
c->CastSpell((Unit*)nullptr, 70021, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fireAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_hor_gunship_cannon_fireAuraScript();
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (Creature* creature = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN, 1))
{
creature->CastSpell((Unit*)nullptr, SPELL_GUNSHIP_CANNON_FIRE, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fire_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -2403,7 +2402,7 @@ void AddSC_halls_of_reflection()
new npc_hor_raging_ghoul();
new npc_hor_risen_witch_doctor();
new npc_hor_lumbering_abomination();
new spell_hor_gunship_cannon_fire();
RegisterSpellScript(spell_hor_gunship_cannon_fire_aura);
new at_hor_battered_hilt_start();
new at_hor_battered_hilt_throw();

View File

@@ -299,78 +299,67 @@ public:
}
};
class spell_garfrost_permafrost : public SpellScriptLoader
class spell_garfrost_permafrost : public SpellScript
{
public:
spell_garfrost_permafrost() : SpellScriptLoader("spell_garfrost_permafrost") { }
PrepareSpellScript(spell_garfrost_permafrost);
class spell_garfrost_permafrost_SpellScript : public SpellScript
std::list<WorldObject*> targetList;
void Unload() override
{
PrepareSpellScript(spell_garfrost_permafrost_SpellScript);
targetList.clear();
}
std::list<WorldObject*> targetList;
void Unload() override
void FilterTargets(std::list<WorldObject*>& targets)
{
if (Unit* caster = GetCaster())
{
targetList.clear();
}
std::list<GameObject*> blockList;
caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f);
void FilterTargets(std::list<WorldObject*>& targets)
{
if (Unit* caster = GetCaster())
if (!blockList.empty())
{
std::list<GameObject*> blockList;
caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f);
if (!blockList.empty())
{
for (std::list<WorldObject*>::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU)
if (WorldObject* target = (*itrU))
for (std::list<WorldObject*>::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU)
if (WorldObject* target = (*itrU))
{
bool valid = true;
if (!caster->IsWithinMeleeRange(target->ToUnit()))
for (std::list<GameObject*>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
if (!(*itr)->IsInvisibleDueToDespawn())
if ((*itr)->IsInBetween(caster, target, 4.0f))
{
valid = false;
break;
}
if (valid)
{
bool valid = true;
if (!caster->IsWithinMeleeRange(target->ToUnit()))
for (std::list<GameObject*>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
if (!(*itr)->IsInvisibleDueToDespawn())
if ((*itr)->IsInBetween(caster, target, 4.0f))
{
valid = false;
break;
}
if (valid)
{
if (Aura* aur = target->ToUnit()->GetAura(70336))
if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT)
caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount());
targetList.push_back(*itrU);
}
if (Aura* aur = target->ToUnit()->GetAura(70336))
if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT)
caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount());
targetList.push_back(*itrU);
}
}
else
{
targetList = targets;
return;
}
}
}
else
{
targetList = targets;
return;
}
targets = targetList;
}
void FilterTargetsNext(std::list<WorldObject*>& targets)
{
targets = targetList;
}
targets = targetList;
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void FilterTargetsNext(std::list<WorldObject*>& targets)
{
return new spell_garfrost_permafrost_SpellScript();
targets = targetList;
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -378,6 +367,6 @@ void AddSC_boss_garfrost()
{
new boss_garfrost();
new spell_garfrost_permafrost();
RegisterSpellScript(spell_garfrost_permafrost);
}

View File

@@ -458,74 +458,62 @@ public:
}
};
class spell_krick_explosive_barrage : public SpellScriptLoader
class spell_krick_explosive_barrage_aura : public AuraScript
{
public:
spell_krick_explosive_barrage() : SpellScriptLoader("spell_krick_explosive_barrage") { }
PrepareAuraScript(spell_krick_explosive_barrage_aura);
class spell_krick_explosive_barrage_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_krick_explosive_barrage_AuraScript);
return ValidateSpellInfo({ SPELL_EXPLOSIVE_BARRAGE_SUMMON });
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_UNIT)
{
Map::PlayerList const& players = caster->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->IsWithinDist(caster, 100.0f))
caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
return new spell_krick_explosive_barrage_AuraScript();
PreventDefaultAction();
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_UNIT)
{
Map::PlayerList const& players = caster->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->IsWithinDist(caster, 100.0f))
caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_exploding_orb_auto_grow : public SpellScriptLoader
class spell_exploding_orb_auto_grow_aura : public AuraScript
{
public:
spell_exploding_orb_auto_grow() : SpellScriptLoader("spell_exploding_orb_auto_grow") { }
PrepareAuraScript(spell_exploding_orb_auto_grow_aura);
class spell_exploding_orb_auto_grow_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_exploding_orb_auto_grow_AuraScript);
return ValidateSpellInfo({ SPELL_EXPLOSIVE_BARRAGE_DAMAGE, SPELL_HASTY_GROW, SPELL_AUTO_GROW, SPELL_EXPLODING_ORB_VISUAL });
}
void HandlePeriodicTick(AuraEffect const* aurEff)
{
if (aurEff->GetTickNumber() >= 16)
if (Unit* target = GetTarget())
{
PreventDefaultAction();
target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false);
target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(2000);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodicTick(AuraEffect const* aurEff)
{
return new spell_exploding_orb_auto_grow_AuraScript();
if (aurEff->GetTickNumber() >= 16)
if (Unit* target = GetTarget())
{
PreventDefaultAction();
target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false);
target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(2000);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -534,7 +522,7 @@ void AddSC_boss_ick()
new boss_ick();
new boss_krick();
new spell_krick_explosive_barrage();
new spell_exploding_orb_auto_grow();
RegisterSpellScript(spell_krick_explosive_barrage_aura);
RegisterSpellScript(spell_exploding_orb_auto_grow_aura);
}

View File

@@ -1301,31 +1301,30 @@ public:
}
};
class spell_pos_empowered_blizzard : public SpellScriptLoader
enum EmpoweredBlizzard
{
public:
spell_pos_empowered_blizzard() : SpellScriptLoader("spell_pos_empowered_blizzard") { }
SPELL_EMPOWERED_BLIZZARD = 70131
};
class spell_pos_empowered_blizzardAuraScript : public AuraScript
class spell_pos_empowered_blizzard_aura : public AuraScript
{
PrepareAuraScript(spell_pos_empowered_blizzard_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_pos_empowered_blizzardAuraScript)
return ValidateSpellInfo({ SPELL_EMPOWERED_BLIZZARD });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell((float)urand(447, 480), (float)urand(200, 235), 528.71f, 70131, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzardAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_pos_empowered_blizzardAuraScript();
PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell((float)urand(447, 480), (float)urand(200, 235), 528.71f, SPELL_EMPOWERED_BLIZZARD, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzard_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -1364,138 +1363,99 @@ private:
Creature& _owner;
};
class spell_pos_slave_trigger_closest : public SpellScriptLoader
class spell_pos_slave_trigger_closest : public SpellScript
{
public:
spell_pos_slave_trigger_closest() : SpellScriptLoader("spell_pos_slave_trigger_closest") { }
PrepareSpellScript(spell_pos_slave_trigger_closest);
class spell_pos_slave_trigger_closestSpellScript : public SpellScript
void HandleDummy(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_pos_slave_trigger_closestSpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times
{
if (Unit* caster = GetCaster())
if (Player* p = caster->ToPlayer())
{
p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance
p->RewardPlayerAndGroupAtEvent(36770, caster); // horde
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
if (Creature* c = target->ToCreature())
{
c->DespawnOrUnsummon(7000);
c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
}
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closestSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pos_slave_trigger_closestSpellScript();
}
};
class spell_pos_rimefang_frost_nova : public SpellScriptLoader
{
public:
spell_pos_rimefang_frost_nova() : SpellScriptLoader("spell_pos_rimefang_frost_nova") { }
class spell_pos_rimefang_frost_novaSpellScript : public SpellScript
{
PrepareSpellScript(spell_pos_rimefang_frost_novaSpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (Unit* target = GetHitUnit())
if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times
{
if (Unit* caster = GetCaster())
{
Unit::Kill(caster, target);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(30000);
}
}
if (Player* p = caster->ToPlayer())
{
p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance
p->RewardPlayerAndGroupAtEvent(36770, caster); // horde
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_novaSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
if (Creature* c = target->ToCreature())
{
c->DespawnOrUnsummon(7000);
c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
}
}
}
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_pos_rimefang_frost_novaSpellScript();
OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_pos_blight : public SpellScriptLoader
class spell_pos_rimefang_frost_nova : public SpellScript
{
public:
spell_pos_blight() : SpellScriptLoader("spell_pos_blight") { }
PrepareSpellScript(spell_pos_rimefang_frost_nova);
class spell_pos_blightAuraScript : public AuraScript
void HandleDummy(SpellEffIndex /*effIndex*/)
{
PrepareAuraScript(spell_pos_blightAuraScript)
if (Unit* target = GetHitUnit())
if (Unit* caster = GetCaster())
{
Unit::Kill(caster, target);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->DespawnOrUnsummon(30000);
}
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* target = GetTarget())
target->CastSpell(target, 69604, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blightAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_pos_blightAuraScript();
OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_nova::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_pos_glacial_strike : public SpellScriptLoader
class spell_pos_blight_aura : public AuraScript
{
public:
spell_pos_glacial_strike() : SpellScriptLoader("spell_pos_glacial_strike") { }
PrepareAuraScript(spell_pos_blight_aura);
class spell_pos_glacial_strikeAuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_pos_glacial_strikeAuraScript)
return ValidateSpellInfo({ 69604 });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth())
{
PreventDefaultAction();
aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE);
return;
}
}
target->CastSpell(target, 69604, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strikeAuraScript::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_pos_glacial_strikeAuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blight_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
class spell_pos_glacial_strike_aura : public AuraScript
{
PrepareAuraScript(spell_pos_glacial_strike_aura);
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* target = GetTarget())
if (target->GetHealth() == target->GetMaxHealth())
{
PreventDefaultAction();
aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE);
return;
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strike_aura::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
}
};
@@ -1537,11 +1497,11 @@ void AddSC_pit_of_saron()
new npc_pos_freed_slave();
new npc_pos_leader_second();
new spell_pos_empowered_blizzard();
new spell_pos_slave_trigger_closest();
new spell_pos_rimefang_frost_nova();
new spell_pos_blight();
new spell_pos_glacial_strike();
RegisterSpellScript(spell_pos_empowered_blizzard_aura);
RegisterSpellScript(spell_pos_slave_trigger_closest);
RegisterSpellScript(spell_pos_rimefang_frost_nova);
RegisterSpellScript(spell_pos_blight_aura);
RegisterSpellScript(spell_pos_glacial_strike_aura);
new at_tyrannus_event_starter();
}