Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-11-08 20:58:52 +08:00
122 changed files with 7571 additions and 1746 deletions
@@ -829,41 +829,35 @@ public:
};
};
class spell_pursuing_spikes : public SpellScriptLoader
class spell_pursuing_spikes_aura : public AuraScript
{
public:
spell_pursuing_spikes() : SpellScriptLoader("spell_pursuing_spikes") { }
PrepareAuraScript(spell_pursuing_spikes_aura);
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);
if (target->IsCreature())
target->ToCreature()->AI()->DoAction(-1);
Remove();
return;
}
target->CastSpell((Unit*)nullptr, SPELL_IMPALE, true);
target->UpdatePosition(*c, false);
target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1);
if (target->IsCreature())
target->ToCreature()->AI()->DoAction(-1);
Remove();
return;
}
target->CastSpell((Unit*)nullptr, SPELL_IMPALE, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikesAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void Register() 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,
};
class spell_gen_leeching_swarm : public SpellScriptLoader
class spell_gen_leeching_swarm_aura : public AuraScript
{
public:
spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { }
PrepareAuraScript(spell_gen_leeching_swarm_aura);
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
{
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
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
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:
spell_gen_leeching_swarm_dmg() : SpellScriptLoader("spell_gen_leeching_swarm_dmg") {}
PrepareSpellScript(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()
{
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
void HandleAfterHit()
{
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_nerubian_burrower();
new npc_anubarak_spike();
new spell_pursuing_spikes();
new spell_gen_leeching_swarm();
new spell_gen_leeching_swarm_dmg();
RegisterSpellScript(spell_pursuing_spikes_aura);
RegisterSpellScript(spell_gen_leeching_swarm_aura);
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:
spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { }
PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_aura);
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
{
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
void HandleDispel(DispelInfo* dispelInfo)
{
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_pet_warlock();
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:
spell_toc25_mistress_kiss() : SpellScriptLoader("spell_toc25_mistress_kiss") { }
PrepareAuraScript(spell_toc25_mistress_kiss_aura);
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*/)
{
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
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
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:
spell_mistress_kiss_area() : SpellScriptLoader("spell_mistress_kiss_area") {}
PrepareSpellScript(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)
{
// 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;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
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
void HandleScript(SpellEffIndex /*effIndex*/)
{
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 npc_fel_infernal();
new npc_mistress_of_pain();
new spell_toc25_mistress_kiss();
new spell_mistress_kiss_area();
RegisterSpellScript(spell_toc25_mistress_kiss_aura);
RegisterSpellScript(spell_mistress_kiss_area);
}
@@ -730,190 +730,167 @@ public:
};
};
class spell_valkyr_essence : public SpellScriptLoader
class spell_valkyr_essence_aura : public AuraScript
{
public:
spell_valkyr_essence() : SpellScriptLoader("spell_valkyr_essence") { }
PrepareAuraScript(spell_valkyr_essence_aura);
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)
{
uint16 count = absorbAmount / 1000;
if (!count || !GetOwner())
return;
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
{
uint16 count = absorbAmount / 1000;
if (!count || !GetOwner())
return;
if (SpellInfo const* se = GetAura()->GetSpellInfo())
if (Unit* owner = GetOwner()->ToUnit())
if (SpellInfo const* se = GetAura()->GetSpellInfo())
if (Unit* owner = GetOwner()->ToUnit())
{
uint32 auraId = 0;
uint32 empoweredId = 0;
switch (se->Id)
{
uint32 auraId = 0;
uint32 empoweredId = 0;
switch (se->Id)
case 65686:
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 )
{
case 65686:
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);
aur->ModStackAmount(count);
if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting
owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true);
}
else
{
owner->CastSpell(owner, empoweredId, true);
aur->Remove();
}
if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting
owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true);
}
else
{
owner->CastSpell(owner, empoweredId, true);
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
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_touchAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
void Register() 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:
spell_valkyr_ball_periodic_dummy() : SpellScriptLoader("spell_valkyr_ball_periodic_dummy") { }
PrepareAuraScript(spell_valkyr_touch_aura);
class spell_valkyr_ball_periodic_dummyAuraScript : public AuraScript
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
PrepareAuraScript(spell_valkyr_ball_periodic_dummyAuraScript)
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
if (caster->GetMap()->GetId() == 649 )
{
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);
}
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_ball_periodic_dummyAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_valkyr_ball_periodic_dummyAuraScript();
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 +900,7 @@ void AddSC_boss_twin_valkyr()
new boss_eydis();
new npc_essence_of_twin();
new npc_concentrated_ball();
new spell_valkyr_essence();
new spell_valkyr_touch();
new spell_valkyr_ball_periodic_dummy();
RegisterSpellScript(spell_valkyr_essence_aura);
RegisterSpellScript(spell_valkyr_touch_aura);
RegisterSpellScript(spell_valkyr_ball_periodic_dummy_aura);
}
@@ -22,6 +22,7 @@
#include "SpellAuraEffects.h"
#include "SpellScriptLoader.h"
#include "icecrown_citadel.h"
#include "PassiveAI.h"
enum Texts
{
@@ -22,6 +22,7 @@
#include "SpellAuras.h"
#include "SpellScriptLoader.h"
#include "icecrown_citadel.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
enum ScriptTexts
@@ -28,6 +28,8 @@
#include "TransportMgr.h"
#include "Vehicle.h"
#include "icecrown_citadel.h"
#include "PassiveAI.h"
#include "SpellAuraEffects.h"
enum Texts
{
@@ -25,6 +25,8 @@
#include "ScriptedCreature.h"
#include "SpellScriptLoader.h"
#include "icecrown_citadel.h"
#include "PassiveAI.h"
#include "SpellAuraEffects.h"
enum Texts
{
@@ -32,6 +32,7 @@
#include "Vehicle.h"
#include "Weather.h"
#include "icecrown_citadel.h"
#include "PassiveAI.h"
enum Texts
{
@@ -26,6 +26,7 @@
#include "SpellAuraEffects.h"
#include "SpellScriptLoader.h"
#include "icecrown_citadel.h"
#include "PassiveAI.h"
enum Texts
{
@@ -21,14 +21,9 @@
#include "Chat.h"
#include "Creature.h"
#include "CreatureScript.h"
#include "InstanceScript.h"
#include "Map.h"
#include "PassiveAI.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#define DataHeader "IC"
@@ -254,39 +254,28 @@ public:
};
};
class spell_loken_pulsing_shockwave : public SpellScriptLoader
class spell_loken_pulsing_shockwave : public SpellScript
{
public:
spell_loken_pulsing_shockwave() : SpellScriptLoader("spell_loken_pulsing_shockwave") { }
PrepareSpellScript(spell_loken_pulsing_shockwave);
class spell_loken_pulsing_shockwave_SpellScript : public SpellScript
void CalculateDamage(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript);
if (!GetHitUnit())
return;
void CalculateDamage(SpellEffIndex /*effIndex*/)
{
if (!GetHitUnit())
return;
float distance = GetCaster()->GetDistance2d(GetHitUnit());
if (distance > 1.0f)
SetHitDamage(int32(GetHitDamage() * distance));
}
float distance = GetCaster()->GetDistance2d(GetHitUnit());
if (distance > 1.0f)
SetHitDamage(int32(GetHitDamage() * distance));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_loken_pulsing_shockwave_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
void AddSC_boss_loken()
{
new boss_loken();
new spell_loken_pulsing_shockwave();
RegisterSpellScript(spell_loken_pulsing_shockwave);
}
@@ -180,74 +180,57 @@ public:
};
};
class spell_krystallus_shatter : public SpellScriptLoader
class spell_krystallus_shatter : public SpellScript
{
public:
spell_krystallus_shatter() : SpellScriptLoader("spell_krystallus_shatter") { }
PrepareSpellScript(spell_krystallus_shatter);
class spell_krystallus_shatter_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_krystallus_shatter_SpellScript);
return ValidateSpellInfo({ SPELL_SHATTER_EFFECT });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->RemoveAurasDueToSpell(GROUND_SLAM_STONED_EFFECT);
target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_krystallus_shatter_SpellScript();
if (Unit* target = GetHitUnit())
{
target->RemoveAurasDueToSpell(GROUND_SLAM_STONED_EFFECT);
target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_krystallus_shatter_effect : public SpellScriptLoader
class spell_krystallus_shatter_effect : public SpellScript
{
public:
spell_krystallus_shatter_effect() : SpellScriptLoader("spell_krystallus_shatter_effect") { }
PrepareSpellScript(spell_krystallus_shatter_effect);
class spell_krystallus_shatter_effect_SpellScript : public SpellScript
void CalculateDamage()
{
PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript);
if (!GetHitUnit())
return;
void CalculateDamage()
{
if (!GetHitUnit())
return;
float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
if (!radius)
return;
float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
if (!radius)
return;
float distance = GetCaster()->GetDistance2d(GetHitUnit());
if (distance > 1.0f)
SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
}
float distance = GetCaster()->GetDistance2d(GetHitUnit());
if (distance > 1.0f)
SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
}
void Register() override
{
OnHit += SpellHitFn(spell_krystallus_shatter_effect_SpellScript::CalculateDamage);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_krystallus_shatter_effect_SpellScript();
OnHit += SpellHitFn(spell_krystallus_shatter_effect::CalculateDamage);
}
};
void AddSC_boss_krystallus()
{
new boss_krystallus();
new spell_krystallus_shatter();
new spell_krystallus_shatter_effect();
RegisterSpellScript(spell_krystallus_shatter);
RegisterSpellScript(spell_krystallus_shatter_effect);
}
@@ -864,30 +864,24 @@ public:
};
};
class spell_hos_dark_matter : public SpellScriptLoader
class spell_hos_dark_matter_aura : public AuraScript
{
public:
spell_hos_dark_matter() : SpellScriptLoader("spell_hos_dark_matter") { }
PrepareAuraScript(spell_hos_dark_matter_aura);
class spell_hos_dark_matter_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_hos_dark_matter_AuraScript);
return ValidateSpellInfo({ SPELL_DARK_MATTER_H, SPELL_DARK_MATTER });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_hos_dark_matter_AuraScript();
if (Unit* caster = GetCaster())
caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -897,5 +891,5 @@ void AddSC_brann_bronzebeard()
new dark_rune_protectors();
new dark_rune_stormcaller();
new iron_golem_custodian();
new spell_hos_dark_matter();
RegisterSpellScript(spell_hos_dark_matter_aura);
}
@@ -184,54 +184,48 @@ class boss_archavon : public CreatureScript
};
// 58941 - Rock Shards
class spell_archavon_rock_shards : public SpellScriptLoader
class spell_archavon_rock_shards : public SpellScript
{
public:
spell_archavon_rock_shards() : SpellScriptLoader("spell_archavon_rock_shards") { }
PrepareSpellScript(spell_archavon_rock_shards);
class spell_archavon_rock_shards_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ROCK_SHARDS_LEFT_HAND_VISUAL, SPELL_ROCK_SHARDS_RIGHT_HAND_VISUAL });
}
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_archavon_rock_shards_SpellScript);
PreventHitDefaultEffect(effIndex);
void HandleScript(SpellEffIndex effIndex)
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
{
return;
}
Map* map = caster->GetMap();
if (!map)
{
return;
}
caster->CastSpell(target, SPELL_ROCK_SHARDS_LEFT_HAND_VISUAL, true);
caster->CastSpell(target, SPELL_ROCK_SHARDS_RIGHT_HAND_VISUAL, true);
uint32 spellId = map->Is25ManRaid() ? SPELL_ROCK_SHARDS_DAMAGE_25 : SPELL_ROCK_SHARDS_DAMAGE_10;
caster->CastSpell(target, spellId, true);
return;
}
void Register() override
Map* map = caster->GetMap();
if (!map)
{
OnEffectHitTarget += SpellEffectFn(spell_archavon_rock_shards_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
return;
}
};
SpellScript* GetSpellScript() const override
{
return new spell_archavon_rock_shards_SpellScript();
caster->CastSpell(target, SPELL_ROCK_SHARDS_LEFT_HAND_VISUAL, true);
caster->CastSpell(target, SPELL_ROCK_SHARDS_RIGHT_HAND_VISUAL, true);
uint32 spellId = map->Is25ManRaid() ? SPELL_ROCK_SHARDS_DAMAGE_25 : SPELL_ROCK_SHARDS_DAMAGE_10;
caster->CastSpell(target, spellId, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_archavon_rock_shards::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_boss_archavon()
{
new boss_archavon();
new spell_archavon_rock_shards();
RegisterSpellScript(spell_archavon_rock_shards);
}
@@ -205,69 +205,52 @@ public:
}
};
class spell_voa_overcharge : public SpellScriptLoader
class spell_voa_overcharge_aura : public AuraScript
{
public:
spell_voa_overcharge() : SpellScriptLoader("spell_voa_overcharge") { }
PrepareAuraScript(spell_voa_overcharge_aura);
class spell_voa_overcharge_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_voa_overcharge_AuraScript);
return ValidateSpellInfo({ SPELL_OVERCHARGED_BLAST });
}
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
if (target->IsCreature() && GetAura()->GetStackAmount() >= 10)
{
Unit* target = GetTarget();
if (target->IsCreature() && GetAura()->GetStackAmount() >= 10)
{
target->CastSpell(target, SPELL_OVERCHARGED_BLAST, true);
Unit::Kill(target, target, false);
}
PreventDefaultAction();
target->CastSpell(target, SPELL_OVERCHARGED_BLAST, true);
Unit::Kill(target, target, false);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_voa_overcharge_AuraScript::HandlePeriodicDummy, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
}
};
PreventDefaultAction();
}
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_voa_overcharge_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_voa_overcharge_aura::HandlePeriodicDummy, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_voa_lightning_nova : public SpellScriptLoader
class spell_voa_lightning_nova : public SpellScript
{
public:
spell_voa_lightning_nova() : SpellScriptLoader("spell_voa_lightning_nova") { }
PrepareSpellScript(spell_voa_lightning_nova);
class spell_voa_lightning_nova_SpellScript : public SpellScript
void HandleOnHit()
{
PrepareSpellScript(spell_voa_lightning_nova_SpellScript);
void HandleOnHit()
int32 damage = 0;
if (Unit* target = GetHitUnit())
{
int32 damage = 0;
if (Unit* target = GetHitUnit())
{
float dist = target->GetDistance(GetCaster());
damage = int32(GetHitDamage() * (70.0f - std::min(70.0f, dist)) / 70.0f);
}
SetHitDamage(damage);
float dist = target->GetDistance(GetCaster());
damage = int32(GetHitDamage() * (70.0f - std::min(70.0f, dist)) / 70.0f);
}
void Register() override
{
OnHit += SpellHitFn(spell_voa_lightning_nova_SpellScript::HandleOnHit);
}
};
SetHitDamage(damage);
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_voa_lightning_nova_SpellScript();
OnHit += SpellHitFn(spell_voa_lightning_nova::HandleOnHit);
}
};
@@ -275,6 +258,6 @@ void AddSC_boss_emalon()
{
new boss_emalon();
new spell_voa_overcharge();
new spell_voa_lightning_nova();
RegisterSpellScript(spell_voa_overcharge_aura);
RegisterSpellScript(spell_voa_lightning_nova);
}
@@ -165,101 +165,73 @@ public:
}
};
class spell_voa_flaming_cinder : public SpellScriptLoader
class spell_voa_flaming_cinder : public SpellScript
{
public:
spell_voa_flaming_cinder() : SpellScriptLoader("spell_voa_flaming_cinder") { }
PrepareSpellScript(spell_voa_flaming_cinder);
class spell_voa_flaming_cinder_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_voa_flaming_cinder_SpellScript);
return ValidateSpellInfo({ SPELL_FLAMING_CINDER_MISSILE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FLAMING_CINDER_MISSILE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voa_flaming_cinder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_voa_flaming_cinder_SpellScript();
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FLAMING_CINDER_MISSILE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voa_flaming_cinder::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_koralon_meteor_fists : public SpellScriptLoader
class spell_koralon_meteor_fists_aura : public AuraScript
{
public:
spell_koralon_meteor_fists() : SpellScriptLoader("spell_koralon_meteor_fists") { }
PrepareAuraScript(spell_koralon_meteor_fists_aura);
class spell_koralon_meteor_fists_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_koralon_meteor_fists_AuraScript);
return ValidateSpellInfo({ SPELL_METEOR_FISTS_DAMAGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_koralon_meteor_fists_AuraScript::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
return new spell_koralon_meteor_fists_AuraScript();
PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_koralon_meteor_fists_aura::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY);
}
};
class spell_flame_warder_meteor_fists : public SpellScriptLoader
class spell_flame_warder_meteor_fists_aura : public AuraScript
{
public:
spell_flame_warder_meteor_fists() : SpellScriptLoader("spell_flame_warder_meteor_fists") { }
PrepareAuraScript(spell_flame_warder_meteor_fists_aura);
class spell_flame_warder_meteor_fists_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_flame_warder_meteor_fists_AuraScript);
return ValidateSpellInfo({ SPELL_FW_METEOR_FISTS_DAMAGE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FW_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_flame_warder_meteor_fists_AuraScript::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
return new spell_flame_warder_meteor_fists_AuraScript();
PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_flame_warder_meteor_fists_aura::TriggerFists, EFFECT_0, SPELL_AURA_DUMMY);
}
};
void AddSC_boss_koralon()
{
new boss_koralon();
new spell_voa_flaming_cinder();
new spell_koralon_meteor_fists();
new spell_flame_warder_meteor_fists();
RegisterSpellScript(spell_voa_flaming_cinder);
RegisterSpellScript(spell_koralon_meteor_fists_aura);
RegisterSpellScript(spell_flame_warder_meteor_fists_aura);
}