refactor(scripts/CrusadersColiseum): spell scripts use registry macros (#20400)

This commit is contained in:
Jelle Meeus
2024-11-01 20:54:14 +01:00
committed by GitHub
parent aea64597d9
commit bbbcaac77c
5 changed files with 269 additions and 330 deletions
@@ -0,0 +1,8 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_toc25_mistress_kiss_aura' WHERE `spell_id` IN (66334,67905,67906,67907) AND `ScriptName`='spell_toc25_mistress_kiss';
UPDATE `spell_script_names` SET `ScriptName`='spell_faction_champion_warl_unstable_affliction_aura' WHERE `spell_id` IN (65812,68154,68155,68156) AND `ScriptName`='spell_faction_champion_warl_unstable_affliction';
UPDATE `spell_script_names` SET `ScriptName`='spell_pursuing_spikes_aura' WHERE `spell_id` IN (65920,65922,65923) AND `ScriptName`='spell_pursuing_spikes';
UPDATE `spell_script_names` SET `ScriptName`='spell_gen_leeching_swarm_aura' WHERE `spell_id` IN (66118,67630,68646,68647) AND `ScriptName`='spell_gen_leeching_swarm';
UPDATE `spell_script_names` SET `ScriptName`='spell_valkyr_essence_aura' WHERE `spell_id` IN (65684,65686,67176,67177,67178,67222,67223,67224) AND `ScriptName`='spell_valkyr_essence';
UPDATE `spell_script_names` SET `ScriptName`='spell_valkyr_touch_aura' WHERE `spell_id` IN (65950,66001,67281,67282,67283,67296,67297,67298) AND `ScriptName`='spell_valkyr_touch';
UPDATE `spell_script_names` SET `ScriptName`='spell_valkyr_ball_periodic_dummy_aura' WHERE `spell_id`=100101 AND `ScriptName`='spell_valkyr_ball_periodic_dummy';
@@ -829,41 +829,35 @@ public:
}; };
}; };
class spell_pursuing_spikes : public SpellScriptLoader class spell_pursuing_spikes_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_pursuing_spikes_aura);
spell_pursuing_spikes() : SpellScriptLoader("spell_pursuing_spikes") { }
class spell_pursuing_spikesAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_pursuing_spikesAuraScript) return ValidateSpellInfo({ SPELL_SPIKE_FAIL, SPELL_IMPALE });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* target = GetTarget())
{ {
if (Unit* target = GetTarget()) if (Creature* c = target->FindNearestCreature(NPC_FROST_SPHERE, 8.0f, true))
{ {
if (Creature* c = target->FindNearestCreature(NPC_FROST_SPHERE, 8.0f, true)) target->UpdatePosition(*c, false);
{ target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1);
target->UpdatePosition(*c, false); if (target->IsCreature())
target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1); target->ToCreature()->AI()->DoAction(-1);
if (target->IsCreature()) Remove();
target->ToCreature()->AI()->DoAction(-1); return;
Remove();
return;
}
target->CastSpell((Unit*)nullptr, SPELL_IMPALE, true);
} }
target->CastSpell((Unit*)nullptr, SPELL_IMPALE, true);
} }
}
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikesAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_pursuing_spikesAuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikes_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -874,73 +868,56 @@ enum eLeechingSwarmSpells
SPELL_LEECHING_SWARM_HEAL = 66125, SPELL_LEECHING_SWARM_HEAL = 66125,
}; };
class spell_gen_leeching_swarm : public SpellScriptLoader class spell_gen_leeching_swarm_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_gen_leeching_swarm_aura);
spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { }
class spell_gen_leeching_swarm_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_gen_leeching_swarm_AuraScript); return ValidateSpellInfo({ SPELL_LEECHING_SWARM_DMG, SPELL_LEECHING_SWARM_HEAL });
}
bool Validate(SpellInfo const* /*spellInfo*/) override void HandleEffectPeriodic(AuraEffect const* aurEff)
{
return ValidateSpellInfo({ SPELL_LEECHING_SWARM_DMG, SPELL_LEECHING_SWARM_HEAL });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* caster = GetCaster())
{
int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount());
if (lifeLeeched < 250)
lifeLeeched = 250;
// Damage
caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true);
// Heal is handled in damage spell. It has to heal the same amount, but some of the dmg can be resisted.
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_gen_leeching_swarm_AuraScript(); if (Unit* caster = GetCaster())
{
int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount());
if (lifeLeeched < 250)
lifeLeeched = 250;
// Damage
caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true);
// Heal is handled in damage spell. It has to heal the same amount, but some of the dmg can be resisted.
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_gen_leeching_swarm_dmg : public SpellScriptLoader class spell_gen_leeching_swarm_dmg : public SpellScript
{ {
public: PrepareSpellScript(spell_gen_leeching_swarm_dmg);
spell_gen_leeching_swarm_dmg() : SpellScriptLoader("spell_gen_leeching_swarm_dmg") {}
class spell_gen_leeching_swarm_dmg_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_gen_leeching_swarm_dmg_SpellScript); return ValidateSpellInfo({ SPELL_LEECHING_SWARM_HEAL });
}
void HandleAfterHit() void HandleAfterHit()
{
if (Unit* caster = GetCaster())
if (GetHitDamage() > 0)
{
int32 damage = GetHitDamage();
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &damage, 0, 0, true);
}
}
void Register() override
{
AfterHit += SpellHitFn(spell_gen_leeching_swarm_dmg_SpellScript::HandleAfterHit);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_gen_leeching_swarm_dmg_SpellScript(); if (Unit* caster = GetCaster())
if (GetHitDamage() > 0)
{
int32 damage = GetHitDamage();
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &damage, 0, 0, true);
}
}
void Register() override
{
AfterHit += SpellHitFn(spell_gen_leeching_swarm_dmg::HandleAfterHit);
} }
}; };
@@ -951,7 +928,7 @@ void AddSC_boss_anubarak_trial()
new npc_frost_sphere(); new npc_frost_sphere();
new npc_nerubian_burrower(); new npc_nerubian_burrower();
new npc_anubarak_spike(); new npc_anubarak_spike();
new spell_pursuing_spikes(); RegisterSpellScript(spell_pursuing_spikes_aura);
new spell_gen_leeching_swarm(); RegisterSpellScript(spell_gen_leeching_swarm_aura);
new spell_gen_leeching_swarm_dmg(); RegisterSpellScript(spell_gen_leeching_swarm_dmg);
} }
@@ -2444,35 +2444,24 @@ public:
}; };
}; };
class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader class spell_faction_champion_warl_unstable_affliction_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_aura);
spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { }
class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spell*/) override
{ {
PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript); return ValidateSpellInfo({ SPELL_UNSTABLE_AFFLICTION_DISPEL });
}
bool Validate(SpellInfo const* /*spell*/) override void HandleDispel(DispelInfo* dispelInfo)
{
return ValidateSpellInfo({ SPELL_UNSTABLE_AFFLICTION_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void Register() override
{
AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_faction_champion_warl_unstable_affliction_AuraScript(); if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void Register() override
{
AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_aura::HandleDispel);
} }
}; };
@@ -2494,5 +2483,5 @@ void AddSC_boss_faction_champions()
new npc_toc_retro_paladin(); new npc_toc_retro_paladin();
new npc_toc_pet_warlock(); new npc_toc_pet_warlock();
new npc_toc_pet_hunter(); new npc_toc_pet_hunter();
new spell_faction_champion_warl_unstable_affliction(); RegisterSpellScript(spell_faction_champion_warl_unstable_affliction_aura);
} }
@@ -444,75 +444,58 @@ public:
}; };
}; };
class spell_toc25_mistress_kiss : public SpellScriptLoader class spell_toc25_mistress_kiss_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_toc25_mistress_kiss_aura);
spell_toc25_mistress_kiss() : SpellScriptLoader("spell_toc25_mistress_kiss") { }
class spell_toc25_mistress_kiss_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_toc25_mistress_kiss_AuraScript) return ValidateSpellInfo({ 66359 });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
if (target->HasUnitState(UNIT_STATE_CASTING))
{
caster->CastSpell(target, 66359, true);
SetDuration(0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_toc25_mistress_kiss_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_toc25_mistress_kiss_AuraScript(); if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
if (target->HasUnitState(UNIT_STATE_CASTING))
{
caster->CastSpell(target, 66359, true);
SetDuration(0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_toc25_mistress_kiss_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_mistress_kiss_area : public SpellScriptLoader class spell_mistress_kiss_area : public SpellScript
{ {
public: PrepareSpellScript(spell_mistress_kiss_area);
spell_mistress_kiss_area() : SpellScriptLoader("spell_mistress_kiss_area") {}
class spell_mistress_kiss_area_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_mistress_kiss_area_SpellScript) // get a list of players with mana
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(Acore::PowerCheck(POWER_MANA, false));
if (targets.empty())
return;
void FilterTargets(std::list<WorldObject*>& targets) WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
{ targets.clear();
// get a list of players with mana targets.push_back(target);
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false)); }
targets.remove_if(Acore::PowerCheck(POWER_MANA, false));
if (targets.empty())
return;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets); void HandleScript(SpellEffIndex /*effIndex*/)
targets.clear();
targets.push_back(target);
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mistress_kiss_area_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_mistress_kiss_area_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_mistress_kiss_area_SpellScript(); GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mistress_kiss_area::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_mistress_kiss_area::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
@@ -521,6 +504,6 @@ void AddSC_boss_jaraxxus()
new boss_jaraxxus(); new boss_jaraxxus();
new npc_fel_infernal(); new npc_fel_infernal();
new npc_mistress_of_pain(); new npc_mistress_of_pain();
new spell_toc25_mistress_kiss(); RegisterSpellScript(spell_toc25_mistress_kiss_aura);
new spell_mistress_kiss_area(); RegisterSpellScript(spell_mistress_kiss_area);
} }
@@ -730,190 +730,172 @@ public:
}; };
}; };
class spell_valkyr_essence : public SpellScriptLoader class spell_valkyr_essence_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_valkyr_essence_aura);
spell_valkyr_essence() : SpellScriptLoader("spell_valkyr_essence") { }
class spell_valkyr_essence_auraAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_valkyr_essence_auraAuraScript) return ValidateSpellInfo({ SPELL_POWERING_UP, SPELL_SURGE_OF_SPEED });
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount) void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{ {
uint16 count = absorbAmount / 1000; uint16 count = absorbAmount / 1000;
if (!count || !GetOwner()) if (!count || !GetOwner())
return; return;
if (SpellInfo const* se = GetAura()->GetSpellInfo()) if (SpellInfo const* se = GetAura()->GetSpellInfo())
if (Unit* owner = GetOwner()->ToUnit()) if (Unit* owner = GetOwner()->ToUnit())
{
uint32 auraId = 0;
uint32 empoweredId = 0;
switch (se->Id)
{ {
uint32 auraId = 0; case 65686:
uint32 empoweredId = 0; auraId = 67590;
switch (se->Id) empoweredId = 65748;
break;
case 65684:
auraId = 67590;
empoweredId = 65724;
break;
case 67222:
auraId = 67602;
empoweredId = 65748;
break;
case 67176:
auraId = 67602;
empoweredId = 65724;
break;
case 67223:
auraId = 67603;
empoweredId = 65748;
break;
case 67177:
auraId = 67603;
empoweredId = 65724;
break;
case 67224:
auraId = 67604;
empoweredId = 65748;
break;
case 67178:
auraId = 67604;
empoweredId = 65724;
break;
}
if (!owner->HasAura(auraId))
{
owner->CastSpell(owner, SPELL_POWERING_UP, true);
if (--count == 0)
return;
}
if (Aura* aur = owner->GetAura(auraId))
{
if (aur->GetStackAmount() + count < 100 )
{ {
case 65686: aur->ModStackAmount(count);
auraId = 67590;
empoweredId = 65748;
break;
case 65684:
auraId = 67590;
empoweredId = 65724;
break;
case 67222:
auraId = 67602;
empoweredId = 65748;
break;
case 67176:
auraId = 67602;
empoweredId = 65724;
break;
case 67223:
auraId = 67603;
empoweredId = 65748;
break;
case 67177:
auraId = 67603;
empoweredId = 65724;
break;
case 67224:
auraId = 67604;
empoweredId = 65748;
break;
case 67178:
auraId = 67604;
empoweredId = 65724;
break;
}
if (!owner->HasAura(auraId))
{
owner->CastSpell(owner, SPELL_POWERING_UP, true);
if (--count == 0)
return;
}
if (Aura* aur = owner->GetAura(auraId))
{
if (aur->GetStackAmount() + count < 100 )
{
aur->ModStackAmount(count);
if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting
owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true); owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true);
} }
else else
{ {
owner->CastSpell(owner, empoweredId, true); owner->CastSpell(owner, empoweredId, true);
aur->Remove(); aur->Remove();
}
} }
} }
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_valkyr_essence_auraAuraScript::HandleAfterEffectAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_valkyr_essence_auraAuraScript();
}
};
class spell_valkyr_touch : public SpellScriptLoader
{
public:
spell_valkyr_touch() : SpellScriptLoader("spell_valkyr_touch") { }
class spell_valkyr_touchAuraScript : public AuraScript
{
PrepareAuraScript(spell_valkyr_touchAuraScript)
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
if (caster->GetMap()->GetId() == 649 )
{
uint32 excludedID = GetSpellInfo()->ExcludeTargetAuraSpell;
Map::PlayerList const& pl = caster->GetMap()->GetPlayers();
for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
if (Player* plr = itr->GetSource())
if (plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
uint32 absorb = 0;
uint32 resist = 0;
CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
int32 dmg = urand(2925, 3075) * (caster->GetMap()->GetDifficulty() - 1);
uint32 damage = dmg;
int32 resilienceReduction = damage;
if (caster->CanApplyResilience())
Unit::ApplyResilience(plr, nullptr, &dmg, false, CR_CRIT_TAKEN_SPELL);
resilienceReduction = damage - resilienceReduction;
damage -= resilienceReduction;
uint32 mitigated_damage = resilienceReduction;
DamageInfo dmgInfo(caster, plr, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, mitigated_damage);
Unit::CalcAbsorbResist(dmgInfo);
Unit::DealDamageMods(plr, damage, &absorb);
int32 overkill = damage - plr->GetHealth();
if (overkill < 0)
overkill = 0;
SpellPeriodicAuraLogInfo pInfo(aurEff, damage, overkill, absorb, resist, 0.0f, false);
plr->SendPeriodicAuraLog(&pInfo);
Unit::DealDamage(caster, plr, damage, 0, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
} }
} }
void Register() override void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_touchAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_valkyr_touchAuraScript(); AfterEffectAbsorb += AuraEffectAbsorbFn(spell_valkyr_essence_aura::HandleAfterEffectAbsorb, EFFECT_0);
} }
}; };
class spell_valkyr_ball_periodic_dummy : public SpellScriptLoader class spell_valkyr_touch_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_valkyr_touch_aura);
spell_valkyr_ball_periodic_dummy() : SpellScriptLoader("spell_valkyr_ball_periodic_dummy") { }
class spell_valkyr_ball_periodic_dummyAuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_valkyr_ball_periodic_dummyAuraScript) return ValidateSpellInfo({ SPELL_AURA_SPIRIT_OF_REDEMPTION });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (Unit* target = GetTarget())
if (target->GetDisplayId() != 11686)
if (Creature* creature = target->ToCreature())
if (Player* player = creature->SelectNearestPlayer(2.75f))
if (creature->GetExactDist2d(player) <= 2.75f)
{
creature->AI()->DoAction(1); // despawning = true;
creature->GetMotionMaster()->MoveIdle();
creature->CastSpell((Unit*)nullptr, creature->GetEntry() == NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false);
creature->SetDisplayId(11686);
creature->DespawnOrUnsummon(1500);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_ball_periodic_dummyAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_valkyr_ball_periodic_dummyAuraScript(); PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
if (caster->GetMap()->GetId() == 649 )
{
uint32 excludedID = GetSpellInfo()->ExcludeTargetAuraSpell;
Map::PlayerList const& pl = caster->GetMap()->GetPlayers();
for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
if (Player* plr = itr->GetSource())
if (plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
uint32 absorb = 0;
uint32 resist = 0;
CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
int32 dmg = urand(2925, 3075) * (caster->GetMap()->GetDifficulty() - 1);
uint32 damage = dmg;
int32 resilienceReduction = damage;
if (caster->CanApplyResilience())
Unit::ApplyResilience(plr, nullptr, &dmg, false, CR_CRIT_TAKEN_SPELL);
resilienceReduction = damage - resilienceReduction;
damage -= resilienceReduction;
uint32 mitigated_damage = resilienceReduction;
DamageInfo dmgInfo(caster, plr, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, mitigated_damage);
Unit::CalcAbsorbResist(dmgInfo);
Unit::DealDamageMods(plr, damage, &absorb);
int32 overkill = damage - plr->GetHealth();
if (overkill < 0)
overkill = 0;
SpellPeriodicAuraLogInfo pInfo(aurEff, damage, overkill, absorb, resist, 0.0f, false);
plr->SendPeriodicAuraLog(&pInfo);
Unit::DealDamage(caster, plr, damage, 0, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_touch_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
class spell_valkyr_ball_periodic_dummy_aura : public AuraScript
{
PrepareAuraScript(spell_valkyr_ball_periodic_dummy_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_UNLEASHED_LIGHT, SPELL_UNLEASHED_DARK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* target = GetTarget())
if (target->GetDisplayId() != 11686)
if (Creature* creature = target->ToCreature())
if (Player* player = creature->SelectNearestPlayer(2.75f))
if (creature->GetExactDist2d(player) <= 2.75f)
{
creature->AI()->DoAction(1); // despawning = true;
creature->GetMotionMaster()->MoveIdle();
creature->CastSpell((Unit*)nullptr, creature->GetEntry() == NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false);
creature->SetDisplayId(11686);
creature->DespawnOrUnsummon(1500);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_ball_periodic_dummy_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
@@ -923,7 +905,7 @@ void AddSC_boss_twin_valkyr()
new boss_eydis(); new boss_eydis();
new npc_essence_of_twin(); new npc_essence_of_twin();
new npc_concentrated_ball(); new npc_concentrated_ball();
new spell_valkyr_essence(); RegisterSpellScript(spell_valkyr_essence_aura);
new spell_valkyr_touch(); RegisterSpellScript(spell_valkyr_touch_aura);
new spell_valkyr_ball_periodic_dummy(); RegisterSpellScript(spell_valkyr_ball_periodic_dummy_aura);
} }