refactor(Scripts/IcecrownCitadel): Spell Scripts use registry macros (#19508)

* boss_blood_queen_lana_thel aura:spell_blood_queen_pact_of_the_darkfallen_dmg_aura

* boss_blood_queen_lana_thel spell:spell_blood_queen_pact_of_the_darkfallen

* boss_blood_queen_lana_thel spell:spell_blood_queen_pact_of_the_darkfallen_dmg_target

* boss_blood_queen_lana_thel spell:spell_blood_queen_bloodbolt

* boss_blood_queen_lana_thel aura:spell_blood_queen_frenzied_bloodthirst_aura

* boss_blood_queen_lana_thel aura:spell_blood_queen_essence_of_the_blood_queen_aura

* boss_blood_queen_lana_thel spell:spell_blood_queen_vampiric_bite

* boss_blood_queen_lana_thel spell:spell_blood_queen_swarming_shadows_floor_dmg

* boss_blood_queen_lana_thel spell:spell_blood_queen_presence_of_the_darkfallen

* icecrown_citadel aura:spell_icc_stoneform_aura

* icecrown_citadel spell:spell_icc_sprit_alarm

* icecrown_citadel spell:spell_icc_geist_alarm

* icecrown_citadel spell:spell_frost_giant_death_plague

* icecrown_citadel spell:spell_icc_harvest_blight_specimen

* icecrown_citadel spell:spell_svalna_revive_champion

* icecrown_citadel spell:spell_svalna_remove_spear

* icecrown_citadel spell:spell_icc_soul_missile

* icecrown_citadel aura:spell_icc_web_wrap_aura

* icecrown_citadel aura:spell_icc_dark_reckoning_aura

* icecrown_citadel spell:spell_stinky_precious_decimate

* icecrown_citadel aura:spell_icc_yf_frozen_orb_aura

* icecrown_citadel aura:spell_icc_yh_volley_aura

* icecrown_citadel spell:spell_icc_yd_summon_undead

* icecrown_citadel spell:spell_icc_shattered_bones

* boss_deathbringer_saurfang aura:spell_deathbringer_blood_link_aura

* boss_deathbringer_saurfang aura:spell_deathbringer_blood_link_blood_beast_aura

* boss_deathbringer_saurfang spell:spell_deathbringer_blood_link

* boss_deathbringer_saurfang pair:spell_deathbringer_blood_power

* boss_deathbringer_saurfang spell:spell_deathbringer_blood_nova_targeting

* boss_deathbringer_saurfang spell:spell_deathbringer_boiling_blood

* boss_festergut spell:spell_festergut_pungent_blight

* boss_festergut aura:spell_festergut_blighted_spores_aura

* boss_festergut spell:spell_festergut_gastric_bloat

* boss_valithria_dreamwalker spell:spell_dreamwalker_summon_portal

* boss_valithria_dreamwalker spell:spell_dreamwalker_twisted_nightmares

* boss_valithria_dreamwalker aura:spell_dreamwalker_nightmare_cloud_aura

* boss_valithria_dreamwalker aura:spell_dreamwalker_mana_void_aura

* boss_valithria_dreamwalker aura:spell_dreamwalker_decay_periodic_timer_aura

* boss_valithria_dreamwalker spell:spell_dreamwalker_summoner

* boss_valithria_dreamwalker aura:spell_dreamwalker_summon_suppresser_aura

* boss_valithria_dreamwalker spell:spell_dreamwalker_summon_suppresser_effect

* boss_valithria_dreamwalker aura:spell_valithria_suppression_aura

* boss_lady_deathwhisper aura:spell_deathwhisper_mana_barrier_aura

* boss_professor_putricide spell:spell_putricide_slime_puddle

* boss_professor_putricide spell:spell_putricide_slime_puddle_spawn

* boss_professor_putricide aura:spell_putricide_grow_stacker_aura

* boss_professor_putricide spell:spell_putricide_unstable_experiment

* boss_professor_putricide spell:spell_putricide_tear_gas_effect

* boss_professor_putricide aura:spell_putricide_gaseous_bloat_aura

* boss_professor_putricide spell:spell_putricide_ooze_channel

* boss_professor_putricide spell:spell_putricide_ooze_eruption_searcher

* boss_professor_putricide aura:spell_putricide_mutated_plague_aura

* boss_professor_putricide spell:spell_putricide_unbound_plague

* boss_professor_putricide aura:spell_putricide_unbound_plague_dmg_aura

* boss_professor_putricide spell:spell_putricide_choking_gas_bomb

* boss_professor_putricide spell:spell_putricide_clear_aura_effect_value

* boss_professor_putricide pair:spell_putricide_mutation_init

* boss_professor_putricide spell:spell_putricide_mutated_transformation

* boss_professor_putricide aura:spell_putricide_mutated_transformation_dismiss_aura

* boss_professor_putricide spell:spell_putricide_mutated_transformation_dmg

* boss_professor_putricide spell:spell_putricide_eat_ooze

* boss_professor_putricide spell:spell_putricide_regurgitated_ooze

* boss_sindragosa spell:spell_sindragosa_s_fury

* boss_sindragosa aura:spell_sindragosa_permeating_chill_aura

* boss_sindragosa aura:spell_sindragosa_instability_aura

* boss_sindragosa spell:spell_sindragosa_icy_grip

* boss_sindragosa spell:spell_sindragosa_icy_grip_jump

* boss_sindragosa aura:spell_sindragosa_frost_beacon_aura

* boss_sindragosa spell:spell_sindragosa_ice_tomb_filter

* boss_sindragosa pair:spell_sindragosa_ice_tomb

* boss_sindragosa spell:spell_sindragosa_mystic_buffet

* boss_sindragosa aura:spell_sindragosa_soul_preservation_aura

* boss_sindragosa spell:spell_rimefang_icy_blast

* boss_sindragosa spell:spell_frostwarden_handler_order_whelp

* boss_sindragosa pair:spell_frostwarden_handler_focus_fire

* boss_sindragosa spell:spell_sindragosa_frost_breath

* boss_lord_marrowgar spell:spell_marrowgar_coldflame

* boss_lord_marrowgar spell:spell_marrowgar_bone_spike_graveyard

* boss_lord_marrowgar spell:spell_marrowgar_coldflame_bonestorm

* boss_lord_marrowgar spell:spell_marrowgar_bone_storm

* boss_lord_marrowgar spell:spell_marrowgar_bone_slice

* boss_the_lich_king spell:spell_the_lich_king_quake

* boss_the_lich_king spell:spell_the_lich_king_jump

* boss_the_lich_king spell:spell_the_lich_king_jump_remove_aura

* boss_the_lich_king spell:spell_the_lich_king_play_movie

* boss_the_lich_king aura:spell_the_lich_king_infest_aura

* boss_the_lich_king aura:spell_the_lich_king_necrotic_plague_aura

* boss_the_lich_king pair:spell_the_lich_king_necrotic_plague_jump

* boss_the_lich_king aura:spell_the_lich_king_shadow_trap_visual_aura

* boss_the_lich_king spell:spell_the_lich_king_shadow_trap_periodic

* boss_the_lich_king spell:spell_the_lich_king_ice_burst_target_search

* boss_the_lich_king spell:spell_the_lich_king_raging_spirit

* boss_the_lich_king spell:spell_the_lich_king_defile

* boss_the_lich_king aura:spell_the_lich_king_soul_reaper_aura

* boss_the_lich_king spell:spell_the_lich_king_summon_into_air

* boss_the_lich_king spell:spell_the_lich_king_teleport_to_frostmourne_hc

* boss_the_lich_king spell:spell_the_lich_king_valkyr_target_search

* boss_the_lich_king spell:spell_the_lich_king_cast_back_to_caster

* boss_the_lich_king spell:spell_the_lich_king_life_siphon

* boss_the_lich_king aura:spell_the_lich_king_vile_spirits_aura

* boss_the_lich_king spell:spell_the_lich_king_vile_spirits_visual

* boss_the_lich_king spell:spell_the_lich_king_vile_spirit_move_target_search

* boss_the_lich_king spell:spell_the_lich_king_vile_spirit_damage_target_search

* boss_the_lich_king aura:spell_the_lich_king_harvest_soul_aura

* boss_the_lich_king aura:spell_the_lich_king_lights_favor_aura

* boss_the_lich_king spell:spell_the_lich_king_restore_soul

* boss_the_lich_king aura:spell_the_lich_king_dark_hunger_aura

* boss_the_lich_king aura:spell_the_lich_king_soul_rip_aura

* boss_the_lich_king spell:spell_the_lich_king_summon_spirit_bomb

* boss_the_lich_king spell:spell_the_lich_king_trigger_vile_spirit

* boss_icecrown_gunship_battle aura:spell_igb_rocket_pack_aura

* boss_icecrown_gunship_battle aura:spell_igb_rocket_pack_useable_aura

* boss_icecrown_gunship_battle spell:spell_igb_teleport_to_enemy_ship

* boss_icecrown_gunship_battle spell:spell_igb_check_for_players

* boss_icecrown_gunship_battle spell:spell_igb_gunship_fall_teleport

* boss_icecrown_gunship_battle aura:spell_igb_explosion_main_aura

* boss_icecrown_gunship_battle spell:spell_igb_explosion

* boss_icecrown_gunship_battle spell:spell_igb_teleport_players_on_victory

* boss_icecrown_gunship_battle aura:spell_igb_periodic_trigger_with_power_cost_aura

* boss_icecrown_gunship_battle aura:spell_igb_overheat_aura

* boss_icecrown_gunship_battle spell:spell_igb_cannon_blast

* boss_icecrown_gunship_battle spell:spell_igb_incinerating_blast

* boss_icecrown_gunship_battle spell:spell_igb_burning_pitch_selector

* boss_icecrown_gunship_battle spell:spell_igb_burning_pitch

* boss_icecrown_gunship_battle spell:spell_igb_rocket_artillery

* boss_icecrown_gunship_battle spell:spell_igb_rocket_artillery_explosion

* boss_icecrown_gunship_battle spell:spell_igb_below_zero

* boss_icecrown_gunship_battle aura:spell_igb_on_gunship_deck_aura

* boss_blood_prince_council aura:spell_blood_council_shadow_prison_aura

* boss_blood_prince_council spell:spell_blood_council_shadow_prison_damage

* boss_blood_prince_council spell:spell_taldaram_glittering_sparks

* boss_blood_prince_council spell:spell_taldaram_summon_flame_ball

* boss_blood_prince_council spell:spell_taldaram_ball_of_inferno_flame

* boss_blood_prince_council pair:spell_valanar_kinetic_bomb

* boss_blood_prince_council aura:spell_valanar_kinetic_bomb_absorb_aura

* boss_blood_prince_council spell:spell_valanar_kinetic_bomb_knockback

* boss_blood_prince_council spell:spell_valanar_kinetic_bomb_summon

* boss_blood_prince_council spell:spell_blood_council_summon_shadow_resonance

* boss_rotface pair:spell_rotface_mutated_infection

* boss_rotface spell:spell_rotface_little_ooze_combine

* boss_rotface spell:spell_rotface_large_ooze_combine

* boss_rotface spell:spell_rotface_large_ooze_buff_combine

* boss_rotface spell:spell_rotface_unstable_ooze_explosion_init

* boss_rotface spell:spell_rotface_unstable_ooze_explosion

* boss_rotface aura:spell_rotface_unstable_ooze_explosion_suicide_aura

* icecrown_citadel.h spell:spell_trigger_spell_from_caster
This commit is contained in:
Jelle Meeus
2024-07-29 14:57:25 +02:00
committed by GitHub
parent 1c5ee47151
commit a3be4c25db
15 changed files with 3812 additions and 5186 deletions

View File

@@ -1440,358 +1440,253 @@ public:
}
};
class spell_blood_council_shadow_prison : public SpellScriptLoader
class spell_blood_council_shadow_prison_aura : public AuraScript
{
public:
spell_blood_council_shadow_prison() : SpellScriptLoader("spell_blood_council_shadow_prison") { }
PrepareAuraScript(spell_blood_council_shadow_prison_aura);
class spell_blood_council_shadow_prison_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_blood_council_shadow_prison_AuraScript);
return ValidateSpellInfo({ SPELL_SHADOW_PRISON_DAMAGE });
}
void HandleDummyTick(AuraEffect const* aurEff)
{
if (GetTarget()->GetTypeId() == TYPEID_PLAYER && GetTarget()->isMoving())
{
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_council_shadow_prison_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void HandleDummyTick(AuraEffect const* aurEff)
{
return new spell_blood_council_shadow_prison_AuraScript();
if (GetTarget()->GetTypeId() == TYPEID_PLAYER && GetTarget()->isMoving())
{
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_council_shadow_prison_aura::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_blood_council_shadow_prison_damage : public SpellScriptLoader
class spell_blood_council_shadow_prison_damage : public SpellScript
{
public:
spell_blood_council_shadow_prison_damage() : SpellScriptLoader("spell_blood_council_shadow_prison_damage") { }
PrepareSpellScript(spell_blood_council_shadow_prison_damage);
class spell_blood_council_shadow_prison_SpellScript : public SpellScript
void AddExtraDamage()
{
PrepareSpellScript(spell_blood_council_shadow_prison_SpellScript);
void AddExtraDamage()
if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id))
{
if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id))
if (AuraEffect const* eff = aur->GetEffect(EFFECT_1))
{
if (AuraEffect const* eff = aur->GetEffect(EFFECT_1))
SetHitDamage(GetHitDamage() + eff->GetAmount());
}
}
}
void Register() override
{
OnHit += SpellHitFn(spell_blood_council_shadow_prison_damage::AddExtraDamage);
}
};
class spell_taldaram_glittering_sparks : public SpellScript
{
PrepareSpellScript(spell_taldaram_glittering_sparks);
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_taldaram_glittering_sparks::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_taldaram_summon_flame_ball : public SpellScript
{
PrepareSpellScript(spell_taldaram_summon_flame_ball);
bool Load() override
{
if (GetCaster()->GetTypeId() != TYPEID_UNIT)
{
return false;
}
GetCaster()->CastSpell(GetCaster(), uint32(GetSpellInfo()->Effects[0].CalcValue()), true);
return true;
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->ToCreature()->AI()->DoAction(ACTION_FLAME_BALL_CHASE);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_taldaram_summon_flame_ball::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_taldaram_ball_of_inferno_flame : public SpellScript
{
PrepareSpellScript(spell_taldaram_ball_of_inferno_flame);
void ModAuraStack()
{
if (Aura* aur = GetHitAura())
aur->SetStackAmount(uint8(GetSpellInfo()->StackAmount));
}
void Register() override
{
AfterHit += SpellHitFn(spell_taldaram_ball_of_inferno_flame::ModAuraStack);
}
};
class spell_valanar_kinetic_bomb : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb);
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
WorldLocation summonPos = *GetExplTargetDest();
Position offset = {0.0f, 0.0f, 20.0f, 0.0f};
summonPos.RelocateOffset(offset);
SetExplTargetDest(summonPos);
GetHitDest()->RelocateOffset(offset);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_valanar_kinetic_bomb::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
class spell_valanar_kinetic_bomb_aura : public AuraScript
{
PrepareAuraScript(spell_valanar_kinetic_bomb_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_KINETIC_BOMB_EXPLOSION, SPELL_KINETIC_BOMB_VISUAL });
}
void HandleDummyTick(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
if (Creature* bomb = target->FindNearestCreature(NPC_KINETIC_BOMB, 1.0f, true))
{
bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true);
bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL);
target->RemoveAura(GetAura());
bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valanar_kinetic_bomb_aura::HandleDummyTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_valanar_kinetic_bomb_absorb_aura : public AuraScript
{
PrepareAuraScript(spell_valanar_kinetic_bomb_absorb_aura);
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
dmgInfo.AbsorbDamage(absorbAmount);
}
void Register() override
{
OnEffectAbsorb += AuraEffectAbsorbFn(spell_valanar_kinetic_bomb_absorb_aura::OnAbsorb, EFFECT_0);
}
};
class spell_valanar_kinetic_bomb_knockback : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb_knockback);
void KnockIntoAir(SpellMissInfo missInfo)
{
if (missInfo != SPELL_MISS_NONE)
{
return;
}
if (Creature* target = GetHitCreature())
target->AI()->DoAction(ACTION_KINETIC_BOMB_JUMP);
}
void Register() override
{
BeforeHit += BeforeSpellHitFn(spell_valanar_kinetic_bomb_knockback::KnockIntoAir);
}
};
class spell_valanar_kinetic_bomb_summon : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb_summon);
void SelectDest()
{
if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
{
float angle = dest->GetAngle(GetCaster());
Position offset = {6.0f * cos(angle), 6.0f * std::sin(angle), 10.0f, 0.0f};
dest->RelocateOffset(offset);
GetCaster()->UpdateAllowedPositionZ(dest->GetPositionX(), dest->GetPositionY(), dest->m_positionZ);
}
}
void Register() override
{
BeforeCast += SpellCastFn(spell_valanar_kinetic_bomb_summon::SelectDest);
}
};
class spell_blood_council_summon_shadow_resonance : public SpellScript
{
PrepareSpellScript(spell_blood_council_summon_shadow_resonance);
void SetDest(SpellDestination& dest)
{
Unit* summoner = GetCaster();
float x = dest._position.GetPositionX();
float y = dest._position.GetPositionY();
float angle = summoner->GetAngle(x, y);
if (dest._position.GetExactDist2d(summoner) > 35.0f && x > 4585.0f && y > 2716.0f && y < 2822.0f)
return;
for (uint8 a = 0; a < 2; ++a)
for (uint8 i = 6; i > 0; --i)
{
float destX = summoner->GetPositionX() + cos(angle + a * M_PI) * i * 10.0f;
float destY = summoner->GetPositionY() + std::sin(angle + a * M_PI) * i * 10.0f;
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY,
summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing) &&
destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
{
SetHitDamage(GetHitDamage() + eff->GetAmount());
}
}
}
void Register() override
{
OnHit += SpellHitFn(spell_blood_council_shadow_prison_SpellScript::AddExtraDamage);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_blood_council_shadow_prison_SpellScript();
}
};
class spell_taldaram_glittering_sparks : public SpellScriptLoader
{
public:
spell_taldaram_glittering_sparks() : SpellScriptLoader("spell_taldaram_glittering_sparks") { }
class spell_taldaram_glittering_sparks_SpellScript : public SpellScript
{
PrepareSpellScript(spell_taldaram_glittering_sparks_SpellScript);
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_taldaram_glittering_sparks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_taldaram_glittering_sparks_SpellScript();
}
};
class spell_taldaram_summon_flame_ball : public SpellScriptLoader
{
public:
spell_taldaram_summon_flame_ball() : SpellScriptLoader("spell_taldaram_summon_flame_ball") { }
class spell_taldaram_summon_flame_ball_SpellScript : public SpellScript
{
PrepareSpellScript(spell_taldaram_summon_flame_ball_SpellScript);
bool Load() override
{
if (GetCaster()->GetTypeId() != TYPEID_UNIT)
{
return false;
}
GetCaster()->CastSpell(GetCaster(), uint32(GetSpellInfo()->Effects[0].CalcValue()), true);
return true;
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->ToCreature()->AI()->DoAction(ACTION_FLAME_BALL_CHASE);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_taldaram_summon_flame_ball_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_taldaram_summon_flame_ball_SpellScript();
}
};
class spell_taldaram_ball_of_inferno_flame : public SpellScriptLoader
{
public:
spell_taldaram_ball_of_inferno_flame() : SpellScriptLoader("spell_taldaram_ball_of_inferno_flame") { }
class spell_taldaram_ball_of_inferno_flame_SpellScript : public SpellScript
{
PrepareSpellScript(spell_taldaram_ball_of_inferno_flame_SpellScript);
void ModAuraStack()
{
if (Aura* aur = GetHitAura())
aur->SetStackAmount(uint8(GetSpellInfo()->StackAmount));
}
void Register() override
{
AfterHit += SpellHitFn(spell_taldaram_ball_of_inferno_flame_SpellScript::ModAuraStack);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_taldaram_ball_of_inferno_flame_SpellScript();
}
};
class spell_valanar_kinetic_bomb : public SpellScriptLoader
{
public:
spell_valanar_kinetic_bomb() : SpellScriptLoader("spell_valanar_kinetic_bomb") { }
class spell_valanar_kinetic_bomb_SpellScript : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb_SpellScript);
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
WorldLocation summonPos = *GetExplTargetDest();
Position offset = {0.0f, 0.0f, 20.0f, 0.0f};
summonPos.RelocateOffset(offset);
SetExplTargetDest(summonPos);
GetHitDest()->RelocateOffset(offset);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_valanar_kinetic_bomb_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
class spell_valanar_kinetic_bomb_AuraScript : public AuraScript
{
PrepareAuraScript(spell_valanar_kinetic_bomb_AuraScript);
void HandleDummyTick(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
if (Creature* bomb = target->FindNearestCreature(NPC_KINETIC_BOMB, 1.0f, true))
{
bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true);
bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL);
target->RemoveAura(GetAura());
bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_valanar_kinetic_bomb_AuraScript::HandleDummyTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_valanar_kinetic_bomb_SpellScript();
}
AuraScript* GetAuraScript() const override
{
return new spell_valanar_kinetic_bomb_AuraScript();
}
};
class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader
{
public:
spell_valanar_kinetic_bomb_absorb() : SpellScriptLoader("spell_valanar_kinetic_bomb_absorb") { }
class spell_valanar_kinetic_bomb_absorb_AuraScript : public AuraScript
{
PrepareAuraScript(spell_valanar_kinetic_bomb_absorb_AuraScript);
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
dmgInfo.AbsorbDamage(absorbAmount);
}
void Register() override
{
OnEffectAbsorb += AuraEffectAbsorbFn(spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_valanar_kinetic_bomb_absorb_AuraScript();
}
};
class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader
{
public:
spell_valanar_kinetic_bomb_knockback() : SpellScriptLoader("spell_valanar_kinetic_bomb_knockback") { }
class spell_valanar_kinetic_bomb_knockback_SpellScript : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb_knockback_SpellScript);
void KnockIntoAir(SpellMissInfo missInfo)
{
if (missInfo != SPELL_MISS_NONE)
{
return;
}
if (Creature* target = GetHitCreature())
target->AI()->DoAction(ACTION_KINETIC_BOMB_JUMP);
}
void Register() override
{
BeforeHit += BeforeSpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_valanar_kinetic_bomb_knockback_SpellScript();
}
};
class spell_valanar_kinetic_bomb_summon : public SpellScriptLoader
{
public:
spell_valanar_kinetic_bomb_summon() : SpellScriptLoader("spell_valanar_kinetic_bomb_summon") { }
class spell_valanar_kinetic_bomb_summon_SpellScript : public SpellScript
{
PrepareSpellScript(spell_valanar_kinetic_bomb_summon_SpellScript);
void SelectDest()
{
if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
{
float angle = dest->GetAngle(GetCaster());
Position offset = {6.0f * cos(angle), 6.0f * std::sin(angle), 10.0f, 0.0f};
dest->RelocateOffset(offset);
GetCaster()->UpdateAllowedPositionZ(dest->GetPositionX(), dest->GetPositionY(), dest->m_positionZ);
}
}
void Register() override
{
BeforeCast += SpellCastFn(spell_valanar_kinetic_bomb_summon_SpellScript::SelectDest);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_valanar_kinetic_bomb_summon_SpellScript();
}
};
class spell_blood_council_summon_shadow_resonance : public SpellScriptLoader
{
public:
spell_blood_council_summon_shadow_resonance() : SpellScriptLoader("spell_blood_council_summon_shadow_resonance") { }
class spell_blood_council_summon_shadow_resonance_SpellScript : public SpellScript
{
PrepareSpellScript(spell_blood_council_summon_shadow_resonance_SpellScript);
void SetDest(SpellDestination& dest)
{
Unit* summoner = GetCaster();
float x = dest._position.GetPositionX();
float y = dest._position.GetPositionY();
float angle = summoner->GetAngle(x, y);
if (dest._position.GetExactDist2d(summoner) > 35.0f && x > 4585.0f && y > 2716.0f && y < 2822.0f)
return;
for (uint8 a = 0; a < 2; ++a)
for (uint8 i = 6; i > 0; --i)
{
float destX = summoner->GetPositionX() + cos(angle + a * M_PI) * i * 10.0f;
float destY = summoner->GetPositionY() + std::sin(angle + a * M_PI) * i * 10.0f;
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY,
summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing) &&
destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
float destZ = summoner->GetMapHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ());
if (std::fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
{
float destZ = summoner->GetMapHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ());
if (std::fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
{
dest._position.Relocate(destX, destY, destZ);
return;
}
dest._position.Relocate(destX, destY, destZ);
return;
}
}
}
dest._position.Relocate(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ());
}
dest._position.Relocate(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ());
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_blood_council_summon_shadow_resonance_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_blood_council_summon_shadow_resonance_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_blood_council_summon_shadow_resonance::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
@@ -1804,15 +1699,15 @@ void AddSC_boss_blood_prince_council()
new npc_dark_nucleus();
new npc_ball_of_flame();
new npc_kinetic_bomb();
new spell_blood_council_shadow_prison();
new spell_blood_council_shadow_prison_damage();
new spell_taldaram_glittering_sparks();
new spell_taldaram_summon_flame_ball();
new spell_taldaram_ball_of_inferno_flame();
new spell_valanar_kinetic_bomb();
new spell_valanar_kinetic_bomb_absorb();
new spell_valanar_kinetic_bomb_knockback();
new spell_valanar_kinetic_bomb_summon();
new spell_blood_council_summon_shadow_resonance();
RegisterSpellScript(spell_blood_council_shadow_prison_aura);
RegisterSpellScript(spell_blood_council_shadow_prison_damage);
RegisterSpellScript(spell_taldaram_glittering_sparks);
RegisterSpellScript(spell_taldaram_summon_flame_ball);
RegisterSpellScript(spell_taldaram_ball_of_inferno_flame);
RegisterSpellAndAuraScriptPair(spell_valanar_kinetic_bomb, spell_valanar_kinetic_bomb_aura);
RegisterSpellScript(spell_valanar_kinetic_bomb_absorb_aura);
RegisterSpellScript(spell_valanar_kinetic_bomb_knockback);
RegisterSpellScript(spell_valanar_kinetic_bomb_summon);
RegisterSpellScript(spell_blood_council_summon_shadow_resonance);
}

View File

@@ -587,114 +587,81 @@ public:
// shortened version for clear code
typedef boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI LanaThelAI;
class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
class spell_blood_queen_pact_of_the_darkfallen_dmg_aura : public AuraScript
{
public:
spell_blood_queen_pact_of_the_darkfallen_dmg() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg") { }
PrepareAuraScript(spell_blood_queen_pact_of_the_darkfallen_dmg_aura);
class spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript);
return ValidateSpellInfo({ SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE });
}
// this is an additional effect to be executed
void PeriodicTick(AuraEffect const* aurEff)
{
if ((aurEff->GetTickNumber() % 2) == 0)
return;
SpellInfo const* damageSpell = sSpellMgr->AssertSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE);
int32 damage = damageSpell->Effects[EFFECT_0].CalcValue();
float herobonus = ((GetTarget()->FindMap() && GetTarget()->FindMap()->IsHeroic()) ? 0.2f : 0.0f);
float multiplier = 0.5f + herobonus + 0.1f * uint32(aurEff->GetTickNumber() / 10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
damage = int32(damage * multiplier);
GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
// this is an additional effect to be executed
void PeriodicTick(AuraEffect const* aurEff)
{
return new spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript();
if ((aurEff->GetTickNumber() % 2) == 0)
return;
SpellInfo const* damageSpell = sSpellMgr->AssertSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE);
int32 damage = damageSpell->Effects[EFFECT_0].CalcValue();
float herobonus = ((GetTarget()->FindMap() && GetTarget()->FindMap()->IsHeroic()) ? 0.2f : 0.0f);
float multiplier = 0.5f + herobonus + 0.1f * uint32(aurEff->GetTickNumber() / 10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
damage = int32(damage * multiplier);
GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader
class spell_blood_queen_pact_of_the_darkfallen : public SpellScript
{
public:
spell_blood_queen_pact_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen") { }
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen);
class spell_blood_queen_pact_of_the_darkfallen_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript);
targets.remove_if(Acore::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
void FilterTargets(std::list<WorldObject*>& targets)
bool remove = true;
std::list<WorldObject*>::const_iterator itr, itr2, itrEnd = targets.end();
for (itr = targets.begin(); itr != itrEnd && remove; ++itr)
{
targets.remove_if(Acore::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
if (GetCaster()->GetExactDist2d(*itr) > 5.0f)
remove = false;
bool remove = true;
std::list<WorldObject*>::const_iterator itr, itr2, itrEnd = targets.end();
for (itr = targets.begin(); itr != itrEnd && remove; ++itr)
{
if (GetCaster()->GetExactDist2d(*itr) > 5.0f)
for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2)
if (itr != itr2 && (*itr2)->GetExactDist2d(*itr) > 5.0f)
remove = false;
}
for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2)
if (itr != itr2 && (*itr2)->GetExactDist2d(*itr) > 5.0f)
remove = false;
if (remove)
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
targets.clear();
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
}
}
if (remove)
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
targets.clear();
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_blood_queen_pact_of_the_darkfallen_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLoader
class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScript
{
public:
spell_blood_queen_pact_of_the_darkfallen_dmg_target() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg_target") { }
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_target);
class spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& unitList)
{
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript);
unitList.remove_if(Acore::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
unitList.push_back(GetCaster());
}
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(Acore::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
unitList.push_back(GetCaster());
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_target::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -712,283 +679,222 @@ private:
LanaThelAI* _ai;
};
class spell_blood_queen_bloodbolt : public SpellScriptLoader
class spell_blood_queen_bloodbolt : public SpellScript
{
public:
spell_blood_queen_bloodbolt() : SpellScriptLoader("spell_blood_queen_bloodbolt") { }
PrepareSpellScript(spell_blood_queen_bloodbolt);
class spell_blood_queen_bloodbolt_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_blood_queen_bloodbolt_SpellScript);
return ValidateSpellInfo({ SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL });
}
bool Load() override
{
return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
uint32 targetCount = (targets.size() + 2) / 3;
targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
Acore::Containers::RandomResize(targets, targetCount);
// mark targets now, effect hook has missile travel time delay (might cast next in that time)
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT);
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetHitUnit(), SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
bool Load() override
{
return new spell_blood_queen_bloodbolt_SpellScript();
return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
uint32 targetCount = (targets.size() + 2) / 3;
targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
Acore::Containers::RandomResize(targets, targetCount);
// mark targets now, effect hook has missile travel time delay (might cast next in that time)
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT);
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetHitUnit(), SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader
class spell_blood_queen_frenzied_bloodthirst_aura : public AuraScript
{
public:
spell_blood_queen_frenzied_bloodthirst() : SpellScriptLoader("spell_blood_queen_frenzied_bloodthirst") { }
PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_aura);
class spell_blood_queen_frenzied_bloodthirst_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_AuraScript);
return ValidateSpellInfo({ SPELL_UNCONTROLLABLE_FRENZY });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget());
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
if (InstanceScript* instance = target->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
if (bloodQueen->IsAlive() && bloodQueen->IsInCombat())
{
// this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy
if (target->GetVehicleKit())
target->RemoveVehicleKit();
bloodQueen->AI()->Talk(SAY_MIND_CONTROL);
bloodQueen->CastSpell(target, SPELL_UNCONTROLLABLE_FRENZY, true);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnApply, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_blood_queen_frenzied_bloodthirst_AuraScript();
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget());
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
if (InstanceScript* instance = target->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
if (bloodQueen->IsAlive() && bloodQueen->IsInCombat())
{
// this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy
if (target->GetVehicleKit())
target->RemoveVehicleKit();
bloodQueen->AI()->Talk(SAY_MIND_CONTROL);
bloodQueen->CastSpell(target, SPELL_UNCONTROLLABLE_FRENZY, true);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_blood_queen_frenzied_bloodthirst_aura::OnApply, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_blood_queen_frenzied_bloodthirst_aura::OnRemove, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_blood_queen_essence_of_the_blood_queen : public SpellScriptLoader
class spell_blood_queen_essence_of_the_blood_queen_aura : public AuraScript
{
public:
spell_blood_queen_essence_of_the_blood_queen() : SpellScriptLoader("spell_blood_queen_essence_of_the_blood_queen") { }
PrepareAuraScript(spell_blood_queen_essence_of_the_blood_queen_aura);
class spell_blood_queen_essence_of_the_blood_queen_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_blood_queen_essence_of_the_blood_queen_AuraScript);
return ValidateSpellInfo({ SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
{
return ValidateSpellInfo({ SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL });
return;
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, nullptr, aurEff);
}
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_blood_queen_essence_of_the_blood_queen_aura::OnProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
if (!damageInfo || !damageInfo->GetDamage())
class spell_blood_queen_vampiric_bite : public SpellScript
{
PrepareSpellScript(spell_blood_queen_vampiric_bite);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
return;
}
int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_blood_queen_essence_of_the_blood_queen_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_blood_queen_essence_of_the_blood_queen_AuraScript();
SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR,
SPELL_FRENZIED_BLOODTHIRST,
SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY
});
}
};
class spell_blood_queen_vampiric_bite : public SpellScriptLoader
{
public:
spell_blood_queen_vampiric_bite() : SpellScriptLoader("spell_blood_queen_vampiric_bite") { }
class spell_blood_queen_vampiric_bite_SpellScript : public SpellScript
SpellCastResult CheckTarget()
{
PrepareSpellScript(spell_blood_queen_vampiric_bite_SpellScript);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR,
SPELL_FRENZIED_BLOODTHIRST,
SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY
});
}
SpellCastResult CheckTarget()
{
if (GetExplTargetUnit()->GetMapId() != 631)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
if (IsVampire(GetExplTargetUnit()))
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
return SPELL_FAILED_CUSTOM_ERROR;
}
if (InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript())
if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS)
return SPELL_CAST_OK;
if (GetExplTargetUnit()->GetMapId() != 631)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
}
void OnCast(SpellMissInfo missInfo)
if (IsVampire(GetExplTargetUnit()))
{
if (missInfo != SPELL_MISS_NONE)
{
return;
}
if (GetCaster()->GetTypeId() != TYPEID_PLAYER || GetCaster()->GetMapId() != 631)
return;
InstanceScript* instance = GetCaster()->GetInstanceScript();
if (!instance || instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != IN_PROGRESS)
return;
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster());
GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK);
if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND))
{
if (aura->GetStackAmount() == 3)
{
GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, TRIGGERED_FULL_MASK);
GetCaster()->RemoveAura(aura);
}
else
GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK);
}
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE);
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
return SPELL_FAILED_CUSTOM_ERROR;
}
if (InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript())
if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS)
return SPELL_CAST_OK;
void HandlePresence(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK);
}
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_blood_queen_vampiric_bite_SpellScript::CheckTarget);
BeforeHit += BeforeSpellHitFn(spell_blood_queen_vampiric_bite_SpellScript::OnCast);
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_vampiric_bite_SpellScript::HandlePresence, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
}
};
SpellScript* GetSpellScript() const override
void OnCast(SpellMissInfo missInfo)
{
return new spell_blood_queen_vampiric_bite_SpellScript();
if (missInfo != SPELL_MISS_NONE)
{
return;
}
if (GetCaster()->GetTypeId() != TYPEID_PLAYER || GetCaster()->GetMapId() != 631)
return;
InstanceScript* instance = GetCaster()->GetInstanceScript();
if (!instance || instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != IN_PROGRESS)
return;
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster());
GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK);
if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND))
{
if (aura->GetStackAmount() == 3)
{
GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, TRIGGERED_FULL_MASK);
GetCaster()->RemoveAura(aura);
}
else
GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK);
}
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE);
}
void HandlePresence(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK);
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_blood_queen_vampiric_bite::CheckTarget);
BeforeHit += BeforeSpellHitFn(spell_blood_queen_vampiric_bite::OnCast);
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_vampiric_bite::HandlePresence, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
}
};
class spell_blood_queen_swarming_shadows_floor_dmg : public SpellScriptLoader
class spell_blood_queen_swarming_shadows_floor_dmg : public SpellScript
{
public:
spell_blood_queen_swarming_shadows_floor_dmg() : SpellScriptLoader("spell_blood_queen_swarming_shadows_floor_dmg") { }
PrepareSpellScript(spell_blood_queen_swarming_shadows_floor_dmg);
class spell_blood_queen_swarming_shadows_floor_dmg_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript);
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), GetSpellInfo()->Effects[0].CalcRadius(), true));
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), GetSpellInfo()->Effects[0].CalcRadius(), true));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_blood_queen_swarming_shadows_floor_dmg_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_swarming_shadows_floor_dmg::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
class spell_blood_queen_presence_of_the_darkfallen : public SpellScriptLoader
class spell_blood_queen_presence_of_the_darkfallen : public SpellScript
{
public:
spell_blood_queen_presence_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_presence_of_the_darkfallen") { }
PrepareSpellScript(spell_blood_queen_presence_of_the_darkfallen);
class spell_blood_queen_presence_of_the_darkfallen_SpellScript : public SpellScript
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_blood_queen_presence_of_the_darkfallen_SpellScript);
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
GetHitUnit()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL));
}
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
GetHitUnit()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_presence_of_the_darkfallen_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_blood_queen_presence_of_the_darkfallen_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_presence_of_the_darkfallen::HandleScript, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
@@ -1014,15 +920,15 @@ public:
void AddSC_boss_blood_queen_lana_thel()
{
new boss_blood_queen_lana_thel();
new spell_blood_queen_pact_of_the_darkfallen_dmg();
new spell_blood_queen_pact_of_the_darkfallen();
new spell_blood_queen_pact_of_the_darkfallen_dmg_target();
new spell_blood_queen_bloodbolt();
new spell_blood_queen_frenzied_bloodthirst();
new spell_blood_queen_essence_of_the_blood_queen();
new spell_blood_queen_vampiric_bite();
new spell_blood_queen_swarming_shadows_floor_dmg();
new spell_blood_queen_presence_of_the_darkfallen();
RegisterSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_aura);
RegisterSpellScript(spell_blood_queen_pact_of_the_darkfallen);
RegisterSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_target);
RegisterSpellScript(spell_blood_queen_bloodbolt);
RegisterSpellScript(spell_blood_queen_frenzied_bloodthirst_aura);
RegisterSpellScript(spell_blood_queen_essence_of_the_blood_queen_aura);
RegisterSpellScript(spell_blood_queen_vampiric_bite);
RegisterSpellScript(spell_blood_queen_swarming_shadows_floor_dmg);
RegisterSpellScript(spell_blood_queen_presence_of_the_darkfallen);
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_10", 0, false);
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_10", 0, true);
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_25", 1, false);

View File

@@ -1042,307 +1042,245 @@ public:
}
};
class spell_deathbringer_blood_link_aura : public SpellScriptLoader
class spell_deathbringer_blood_link_aura : public AuraScript
{
public:
spell_deathbringer_blood_link_aura() : SpellScriptLoader("spell_deathbringer_blood_link_aura") { }
PrepareAuraScript(spell_deathbringer_blood_link_aura);
class spell_deathbringer_blood_link_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_deathbringer_blood_link_AuraScript);
return ValidateSpellInfo({ SPELL_BLOOD_LINK_DUMMY });
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY))
if (Creature* saurfang = GetUnitOwner()->ToCreature())
saurfang->AI()->DoAction(ACTION_MARK_OF_THE_FALLEN_CHAMPION);
}
bool CheckProc(ProcEventInfo& eventInfo)
{
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* victim = eventInfo.GetActionTarget();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
//uint32 markCount = 0;
//if (Creature* saurfang = eventInfo.GetActor()->ToCreature())
//markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0;
int32 basepoints = int32(1.0f /*+ 0.5f + 0.5f*markCount*/);
switch (procSpell->Id) // some spells give more Blood Power
{
PreventDefaultAction();
if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY))
if (Creature* saurfang = GetUnitOwner()->ToCreature())
saurfang->AI()->DoAction(ACTION_MARK_OF_THE_FALLEN_CHAMPION);
case 72380:
case 72438:
case 72439:
case 72440: // Blood Nova
basepoints = int32(2.0f /*+ 0.5f + 0.75f*markCount*/);
break;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion
}
victim->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true);
return;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* victim = eventInfo.GetActionTarget();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_deathbringer_blood_link_aura::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_deathbringer_blood_link_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathbringer_blood_link_aura::HandlePeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
//uint32 markCount = 0;
//if (Creature* saurfang = eventInfo.GetActor()->ToCreature())
//markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0;
int32 basepoints = int32(1.0f /*+ 0.5f + 0.5f*markCount*/);
switch (procSpell->Id) // some spells give more Blood Power
{
case 72380:
case 72438:
case 72439:
case 72440: // Blood Nova
basepoints = int32(2.0f /*+ 0.5f + 0.75f*markCount*/);
break;
}
class spell_deathbringer_blood_link_blood_beast_aura : public AuraScript
{
PrepareAuraScript(spell_deathbringer_blood_link_blood_beast_aura);
victim->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_BLOOD_LINK_DUMMY });
}
bool CheckProc(ProcEventInfo& eventInfo)
{
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
/*
uint32 markCount = 0;
if (Map* map = eventInfo.GetActor()->FindMap())
if (InstanceMap* imap = map->ToInstanceMap())
if (InstanceScript* isc = imap->GetInstanceScript())
if (ObjectGuid sguid = isc->GetGuidData(3) //DATA_DEATHBRINGER_SAURFANG
if (Creature* saurfang = ObjectAccessor::GetCreature(*eventInfo.GetActor(), sguid))
markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456) : 0; //FALLEN_CHAMPION_CAST_COUNT
*/
int32 basepoints = int32(3.0f /*+ 0.5f + 0.5f*markCount*/);
eventInfo.GetActor()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true);
return;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_deathbringer_blood_link_blood_beast_aura::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_deathbringer_blood_link_blood_beast_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
class spell_deathbringer_blood_link : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_link);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_BLOOD_LINK_POWER });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_POWER, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetHitUnit(), true);
if (Aura* bloodPower = GetHitUnit()->GetAura(SPELL_BLOOD_POWER))
bloodPower->RecalculateAmountOfEffects();
PreventHitDefaultEffect(EFFECT_0);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_link::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_deathbringer_blood_power : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_power);
void ModAuraValue()
{
if (Aura* aura = GetHitAura())
aura->RecalculateAmountOfEffects();
}
void Register() override
{
AfterHit += SpellHitFn(spell_deathbringer_blood_power::ModAuraValue);
}
};
class spell_deathbringer_blood_power_aura : public AuraScript
{
PrepareAuraScript(spell_deathbringer_blood_power_aura);
void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated)
{
amount = int32(GetUnitOwner()->GetPower(POWER_ENERGY));
canBeRecalculated = true;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_aura::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_aura::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
}
};
class spell_deathbringer_blood_nova_targeting : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_nova_targeting);
bool Load() override
{
// initialize variable
_target = nullptr;
return true;
}
void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
// select one random target, with preference of ranged targets
uint32 targetsAtRange = 0;
uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4);
targets.sort(Acore::ObjectDistanceOrderPred(GetCaster(), false));
// get target count at range
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr, ++targetsAtRange)
if ((*itr)->GetDistance(GetCaster()) < 12.0f)
break;
// set the upper cap
if (targetsAtRange < minTargets)
targetsAtRange = std::min<uint32>(targets.size(), minTargets);
if (!targetsAtRange)
return;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_deathbringer_blood_link_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_deathbringer_blood_link_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathbringer_blood_link_AuraScript::HandlePeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_deathbringer_blood_link_AuraScript();
std::list<WorldObject*>::iterator itrTarget = targets.begin();
std::advance(itrTarget, urand(0, targetsAtRange - 1));
_target = *itrTarget;
targets.clear();
targets.push_back(_target);
}
};
class spell_deathbringer_blood_link_blood_beast_aura : public SpellScriptLoader
{
public:
spell_deathbringer_blood_link_blood_beast_aura() : SpellScriptLoader("spell_deathbringer_blood_link_blood_beast_aura") { }
class spell_deathbringer_blood_link_blood_beast_aura_AuraScript : public AuraScript
// use the same target for first and second effect
void FilterTargetsSubsequent(std::list<WorldObject*>& targets)
{
PrepareAuraScript(spell_deathbringer_blood_link_blood_beast_aura_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
return eventInfo.GetActor() && eventInfo.GetActionTarget() && ((damageInfo && damageInfo->GetDamage()) || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
/*
uint32 markCount = 0;
if (Map* map = eventInfo.GetActor()->FindMap())
if (InstanceMap* imap = map->ToInstanceMap())
if (InstanceScript* isc = imap->GetInstanceScript())
if (ObjectGuid sguid = isc->GetGuidData(3) //DATA_DEATHBRINGER_SAURFANG
if (Creature* saurfang = ObjectAccessor::GetCreature(*eventInfo.GetActor(), sguid))
markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456) : 0; //FALLEN_CHAMPION_CAST_COUNT
*/
int32 basepoints = int32(3.0f /*+ 0.5f + 0.5f*markCount*/);
eventInfo.GetActor()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true);
if (!_target)
return;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_deathbringer_blood_link_blood_beast_aura_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_deathbringer_blood_link_blood_beast_aura_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_deathbringer_blood_link_blood_beast_aura_AuraScript();
targets.clear();
targets.push_back(_target);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
private:
WorldObject* _target;
};
class spell_deathbringer_blood_link : public SpellScriptLoader
class spell_deathbringer_boiling_blood : public SpellScript
{
public:
spell_deathbringer_blood_link() : SpellScriptLoader("spell_deathbringer_blood_link") { }
PrepareSpellScript(spell_deathbringer_boiling_blood);
class spell_deathbringer_blood_link_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_deathbringer_blood_link_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_POWER, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetHitUnit(), true);
if (Aura* bloodPower = GetHitUnit()->GetAura(SPELL_BLOOD_POWER))
bloodPower->RecalculateAmountOfEffects();
PreventHitDefaultEffect(EFFECT_0);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_link_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_deathbringer_blood_link_SpellScript();
}
};
class spell_deathbringer_blood_power : public SpellScriptLoader
{
public:
spell_deathbringer_blood_power() : SpellScriptLoader("spell_deathbringer_blood_power") { }
class spell_deathbringer_blood_power_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_power_SpellScript);
void ModAuraValue()
{
if (Aura* aura = GetHitAura())
aura->RecalculateAmountOfEffects();
}
void Register() override
{
AfterHit += SpellHitFn(spell_deathbringer_blood_power_SpellScript::ModAuraValue);
}
};
class spell_deathbringer_blood_power_AuraScript : public AuraScript
{
PrepareAuraScript(spell_deathbringer_blood_power_AuraScript);
void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated)
{
amount = int32(GetUnitOwner()->GetPower(POWER_ENERGY));
canBeRecalculated = true;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
}
bool Load() override
{
if (GetUnitOwner()->getPowerType() != POWER_ENERGY)
return false;
return true;
}
};
SpellScript* GetSpellScript() const override
{
return new spell_deathbringer_blood_power_SpellScript();
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
AuraScript* GetAuraScript() const override
void FilterTargets(std::list<WorldObject*>& targets)
{
return new spell_deathbringer_blood_power_AuraScript();
}
};
targets.remove(GetCaster()->GetVictim());
if (targets.empty())
return;
class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
{
public:
spell_deathbringer_blood_nova_targeting() : SpellScriptLoader("spell_deathbringer_blood_nova_targeting") { }
class spell_deathbringer_blood_nova_targeting_SpellScript : public SpellScript
{
PrepareSpellScript(spell_deathbringer_blood_nova_targeting_SpellScript);
bool Load() override
if (GetSpellInfo()->Id == 72385 || GetSpellInfo()->Id == 72442) // 10n, 10h
{
// initialize variable
target = nullptr;
return true;
}
void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
// select one random target, with preference of ranged targets
uint32 targetsAtRange = 0;
uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4);
targets.sort(Acore::ObjectDistanceOrderPred(GetCaster(), false));
// get target count at range
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr, ++targetsAtRange)
if ((*itr)->GetDistance(GetCaster()) < 12.0f)
break;
// set the upper cap
if (targetsAtRange < minTargets)
targetsAtRange = std::min<uint32>(targets.size(), minTargets);
if (!targetsAtRange)
return;
std::list<WorldObject*>::iterator itrTarget = targets.begin();
std::advance(itrTarget, urand(0, targetsAtRange - 1));
target = *itrTarget;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
// use the same target for first and second effect
void FilterTargetsSubsequent(std::list<WorldObject*>& targets)
{
if (!target)
return;
targets.clear();
targets.push_back(target);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
WorldObject* target;
};
SpellScript* GetSpellScript() const override
{
return new spell_deathbringer_blood_nova_targeting_SpellScript();
else
Acore::Containers::RandomResize(targets, 3);
}
};
class spell_deathbringer_boiling_blood : public SpellScriptLoader
{
public:
spell_deathbringer_boiling_blood() : SpellScriptLoader("spell_deathbringer_boiling_blood") { }
class spell_deathbringer_boiling_blood_SpellScript : public SpellScript
void Register() override
{
PrepareSpellScript(spell_deathbringer_boiling_blood_SpellScript);
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove(GetCaster()->GetVictim());
if (targets.empty())
return;
if (GetSpellInfo()->Id == 72385 || GetSpellInfo()->Id == 72442) // 10n, 10h
{
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
else
Acore::Containers::RandomResize(targets, 3);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_deathbringer_boiling_blood_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_boiling_blood::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -1412,12 +1350,12 @@ void AddSC_boss_deathbringer_saurfang()
new npc_high_overlord_saurfang_icc();
new npc_muradin_bronzebeard_icc();
new npc_saurfang_event();
new spell_deathbringer_blood_link_aura();
new spell_deathbringer_blood_link_blood_beast_aura();
new spell_deathbringer_blood_link();
new spell_deathbringer_blood_power();
new spell_deathbringer_blood_nova_targeting();
new spell_deathbringer_boiling_blood();
RegisterSpellScript(spell_deathbringer_blood_link_aura);
RegisterSpellScript(spell_deathbringer_blood_link_blood_beast_aura);
RegisterSpellScript(spell_deathbringer_blood_link);
RegisterSpellAndAuraScriptPair(spell_deathbringer_blood_power, spell_deathbringer_blood_power_aura);
RegisterSpellScript(spell_deathbringer_blood_nova_targeting);
RegisterSpellScript(spell_deathbringer_boiling_blood);
new achievement_ive_gone_and_made_a_mess();
new npc_icc_blood_beast();
}

View File

@@ -284,128 +284,95 @@ public:
}
};
class spell_festergut_pungent_blight : public SpellScriptLoader
class spell_festergut_pungent_blight : public SpellScript
{
public:
spell_festergut_pungent_blight() : SpellScriptLoader("spell_festergut_pungent_blight") { }
PrepareSpellScript(spell_festergut_pungent_blight);
class spell_festergut_pungent_blight_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_festergut_pungent_blight_SpellScript);
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (caster->GetTypeId() != TYPEID_UNIT)
return;
// Get Inhaled Blight id for our difficulty
uint32 blightId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), caster);
// ...and remove it
caster->RemoveAurasDueToSpell(blightId);
caster->ToCreature()->AI()->Talk(EMOTE_PUNGENT_BLIGHT);
if (InstanceScript* inst = caster->GetInstanceScript())
if (Creature* professor = ObjectAccessor::GetCreature(*caster, inst->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_GAS);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_festergut_pungent_blight_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_festergut_pungent_blight_SpellScript();
Unit* caster = GetCaster();
if (caster->GetTypeId() != TYPEID_UNIT)
return;
// Get Inhaled Blight id for our difficulty
uint32 blightId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), caster);
// ...and remove it
caster->RemoveAurasDueToSpell(blightId);
caster->ToCreature()->AI()->Talk(EMOTE_PUNGENT_BLIGHT);
if (InstanceScript* inst = caster->GetInstanceScript())
if (Creature* professor = ObjectAccessor::GetCreature(*caster, inst->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_GAS);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_festergut_pungent_blight::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_festergut_blighted_spores : public SpellScriptLoader
class spell_festergut_blighted_spores_aura : public AuraScript
{
public:
spell_festergut_blighted_spores() : SpellScriptLoader("spell_festergut_blighted_spores") { }
PrepareAuraScript(spell_festergut_blighted_spores_aura);
class spell_festergut_blighted_spores_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_festergut_blighted_spores_AuraScript);
return ValidateSpellInfo({ SPELL_INOCULATED });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_INOCULATED });
}
void ExtraEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Aura* a = aurEff->GetBase())
if (a->GetDuration() > a->GetMaxDuration() - 1000) // this does not stack for different casters and previous is removed by new DoT, prevent it from giving inoculation in such case
return;
uint32 inoculatedId = sSpellMgr->GetSpellIdForDifficulty(SPELL_INOCULATED, GetTarget());
uint8 inoculatedStack = 1;
if (Aura* a = GetTarget()->GetAura(inoculatedId))
{
inoculatedStack += a->GetStackAmount();
if (a->GetDuration() > a->GetMaxDuration() - 10000) // player may gain only one stack at a time, no matter how many spores explode near him
return;
}
GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true);
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_FESTERGUT)))
festergut->AI()->SetData(DATA_INOCULATED_STACK, inoculatedStack);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_festergut_blighted_spores_AuraScript::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void ExtraEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
return new spell_festergut_blighted_spores_AuraScript();
if (Aura* a = aurEff->GetBase())
if (a->GetDuration() > a->GetMaxDuration() - 1000) // this does not stack for different casters and previous is removed by new DoT, prevent it from giving inoculation in such case
return;
uint32 inoculatedId = sSpellMgr->GetSpellIdForDifficulty(SPELL_INOCULATED, GetTarget());
uint8 inoculatedStack = 1;
if (Aura* a = GetTarget()->GetAura(inoculatedId))
{
inoculatedStack += a->GetStackAmount();
if (a->GetDuration() > a->GetMaxDuration() - 10000) // player may gain only one stack at a time, no matter how many spores explode near him
return;
}
GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true);
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_FESTERGUT)))
festergut->AI()->SetData(DATA_INOCULATED_STACK, inoculatedStack);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_festergut_blighted_spores_aura::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_festergut_gastric_bloat : public SpellScriptLoader
class spell_festergut_gastric_bloat : public SpellScript
{
public:
spell_festergut_gastric_bloat() : SpellScriptLoader("spell_festergut_gastric_bloat") { }
PrepareSpellScript(spell_festergut_gastric_bloat);
class spell_festergut_gastric_bloat_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript);
return ValidateSpellInfo({ SPELL_GASTRIC_EXPLOSION });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_GASTRIC_EXPLOSION });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id);
if (!(aura && aura->GetStackAmount() == 10))
return;
GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Id);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GASTRIC_EXPLOSION, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_festergut_gastric_bloat_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_festergut_gastric_bloat_SpellScript();
Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id);
if (!(aura && aura->GetStackAmount() == 10))
return;
GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Id);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GASTRIC_EXPLOSION, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_festergut_gastric_bloat::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -496,9 +463,9 @@ public:
void AddSC_boss_festergut()
{
new boss_festergut();
new spell_festergut_pungent_blight();
new spell_festergut_blighted_spores();
new spell_festergut_gastric_bloat();
RegisterSpellScript(spell_festergut_pungent_blight);
RegisterSpellScript(spell_festergut_blighted_spores_aura);
RegisterSpellScript(spell_festergut_gastric_bloat);
new achievement_flu_shot_shortage();
new npc_stinky_icc();

View File

@@ -1113,35 +1113,24 @@ public:
}
};
class spell_deathwhisper_mana_barrier : public SpellScriptLoader
class spell_deathwhisper_mana_barrier_aura : public AuraScript
{
public:
spell_deathwhisper_mana_barrier() : SpellScriptLoader("spell_deathwhisper_mana_barrier") { }
PrepareAuraScript(spell_deathwhisper_mana_barrier_aura);
class spell_deathwhisper_mana_barrier_AuraScript : public AuraScript
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript);
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
int32 missingHealth = int32(caster->GetMaxHealth() - caster->GetHealth());
caster->ModifyHealth(missingHealth);
caster->ModifyPower(POWER_MANA, -missingHealth);
}
int32 missingHealth = int32(caster->GetMaxHealth() - caster->GetHealth());
caster->ModifyHealth(missingHealth);
caster->ModifyPower(POWER_MANA, -missingHealth);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathwhisper_mana_barrier_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_deathwhisper_mana_barrier_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathwhisper_mana_barrier_aura::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -1197,7 +1186,7 @@ void AddSC_boss_lady_deathwhisper()
new npc_darnavan();
// Spells
new spell_deathwhisper_mana_barrier();
RegisterSpellScript(spell_deathwhisper_mana_barrier_aura);
RegisterSpellScript(spell_deathwhisper_dark_reckoning);
// AreaTriggers

View File

@@ -475,229 +475,180 @@ public:
}
};
class spell_marrowgar_coldflame : public SpellScriptLoader
class spell_marrowgar_coldflame : public SpellScript
{
public:
spell_marrowgar_coldflame() : SpellScriptLoader("spell_marrowgar_coldflame") { }
PrepareSpellScript(spell_marrowgar_coldflame);
class spell_marrowgar_coldflame_SpellScript : public SpellScript
void SelectTarget(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
targets.clear();
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 1, -1.0f, true,true, -SPELL_IMPALED); // -1.0f as it takes into account object size
if (!target)
target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true); // if only tank or noone outside of boss' model
if (!target)
return;
void SelectTarget(std::list<WorldObject*>& targets)
targets.push_back(target);
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
float angle = caster->GetAngle(GetHitUnit());
float dist = caster->GetObjectSize() / 2.0f;
float z = caster->GetPositionZ() + 2.5f;
float nx = caster->GetPositionX() + dist * cos(angle);
float ny = caster->GetPositionY() + dist * std::sin(angle);
if (!caster->IsWithinLOS(nx, ny, z))
{
targets.clear();
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 1, -1.0f, true,true, -SPELL_IMPALED); // -1.0f as it takes into account object size
if (!target)
target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true); // if only tank or noone outside of boss' model
if (!target)
return;
targets.push_back(target);
nx = caster->GetPositionX() + 0.5f * cos(angle);
ny = caster->GetPositionY() + 0.5f * std::sin(angle);
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
if (caster->IsWithinLOS(nx, ny, z))
{
Unit* caster = GetCaster();
float angle = caster->GetAngle(GetHitUnit());
float dist = caster->GetObjectSize() / 2.0f;
float z = caster->GetPositionZ() + 2.5f;
float nx = caster->GetPositionX() + dist * cos(angle);
float ny = caster->GetPositionY() + dist * std::sin(angle);
caster->SetOrientation(angle);
caster->CastSpell(nx, ny, z, uint32(GetEffectValue()), true);
}
}
if (!caster->IsWithinLOS(nx, ny, z))
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_marrowgar_bone_spike_graveyard : public SpellScript
{
PrepareSpellScript(spell_marrowgar_bone_spike_graveyard);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_IMPALED });
}
void HandleSpikes(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Creature* marrowgar = GetCaster()->ToCreature())
{
bool didHit = false;
CreatureAI* marrowgarAI = marrowgar->AI();
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
std::vector<Player*> validPlayers;
Map::PlayerList const& pList = marrowgar->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
if (Player* plr = itr->GetSource())
if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED))
if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID())
if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target
validPlayers.push_back(plr);
std::vector<Player*>::iterator begin = validPlayers.begin(), end = validPlayers.end();
std::random_device rd;
std::shuffle(begin, end, std::default_random_engine{rd()});
for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i)
{
nx = caster->GetPositionX() + 0.5f * cos(angle);
ny = caster->GetPositionY() + 0.5f * std::sin(angle);
Unit* target = validPlayers[i];
didHit = true;
//target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
target->CastSpell(target, boneSpikeSummonId[i], true);
}
if (didHit)
marrowgarAI->Talk(SAY_BONESPIKE);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_bone_spike_graveyard::HandleSpikes, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
class spell_marrowgar_coldflame_bonestorm : public SpellScript
{
PrepareSpellScript(spell_marrowgar_coldflame_bonestorm);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
float x = caster->GetPositionX();
float y = caster->GetPositionY();
float z = caster->GetPositionZ() + 2.5f;
for (uint8 i = 0; i < 4; ++i)
{
float nx = x + 2.5f * cos((M_PI / 4) + (i * (M_PI / 2)));
float ny = y + 2.5f * std::sin((M_PI / 4) + (i * (M_PI / 2)));
if (caster->IsWithinLOS(nx, ny, z))
{
caster->SetOrientation(angle);
caster->CastSpell(nx, ny, z, uint32(GetEffectValue()), true);
caster->SetOrientation((M_PI / 4) + (i * (M_PI / 2)));
caster->CastSpell(nx, ny, z, uint32(GetEffectValue() + i), true);
}
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_marrowgar_coldflame_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_bonestorm::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
class spell_marrowgar_bone_storm : public SpellScript
{
public:
spell_marrowgar_bone_spike_graveyard() : SpellScriptLoader("spell_marrowgar_bone_spike_graveyard") { }
PrepareSpellScript(spell_marrowgar_bone_storm);
class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript
void RecalculateDamage()
{
PrepareSpellScript(spell_marrowgar_bone_spike_graveyard_SpellScript);
float dist = GetHitUnit()->GetExactDist2d(GetCaster());
if (dist >= 9.0f) dist -= 9.0f;
else dist = 0.0f;
SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(dist), 1.0f)));
}
void HandleSpikes(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Creature* marrowgar = GetCaster()->ToCreature())
{
bool didHit = false;
CreatureAI* marrowgarAI = marrowgar->AI();
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
std::vector<Player*> validPlayers;
Map::PlayerList const& pList = marrowgar->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
if (Player* plr = itr->GetSource())
if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED))
if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID())
if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target
validPlayers.push_back(plr);
std::vector<Player*>::iterator begin = validPlayers.begin(), end = validPlayers.end();
std::random_device rd;
std::shuffle(begin, end, std::default_random_engine{rd()});
for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i)
{
Unit* target = validPlayers[i];
didHit = true;
//target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
target->CastSpell(target, boneSpikeSummonId[i], true);
}
if (didHit)
marrowgarAI->Talk(SAY_BONESPIKE);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_bone_spike_graveyard_SpellScript::HandleSpikes, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_marrowgar_bone_spike_graveyard_SpellScript();
OnHit += SpellHitFn(spell_marrowgar_bone_storm::RecalculateDamage);
}
};
class spell_marrowgar_coldflame_bonestorm : public SpellScriptLoader
class spell_marrowgar_bone_slice : public SpellScript
{
public:
spell_marrowgar_coldflame_bonestorm() : SpellScriptLoader("spell_marrowgar_coldflame_bonestorm") { }
PrepareSpellScript(spell_marrowgar_bone_slice);
class spell_marrowgar_coldflame_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
float x = caster->GetPositionX();
float y = caster->GetPositionY();
float z = caster->GetPositionZ() + 2.5f;
for (uint8 i = 0; i < 4; ++i)
{
float nx = x + 2.5f * cos((M_PI / 4) + (i * (M_PI / 2)));
float ny = y + 2.5f * std::sin((M_PI / 4) + (i * (M_PI / 2)));
if (caster->IsWithinLOS(nx, ny, z))
{
caster->SetOrientation((M_PI / 4) + (i * (M_PI / 2)));
caster->CastSpell(nx, ny, z, uint32(GetEffectValue() + i), true);
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_marrowgar_coldflame_SpellScript();
_targetCount = 0;
return true;
}
};
class spell_marrowgar_bone_storm : public SpellScriptLoader
{
public:
spell_marrowgar_bone_storm() : SpellScriptLoader("spell_marrowgar_bone_storm") { }
class spell_marrowgar_bone_storm_SpellScript : public SpellScript
void CountTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript);
void RecalculateDamage()
{
float dist = GetHitUnit()->GetExactDist2d(GetCaster());
if (dist >= 9.0f) dist -= 9.0f;
else dist = 0.0f;
SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(dist), 1.0f)));
}
void Register() override
{
OnHit += SpellHitFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_marrowgar_bone_storm_SpellScript();
_targetCount = std::min<uint32>(targets.size(), GetSpellInfo()->MaxAffectedTargets);
}
};
class spell_marrowgar_bone_slice : public SpellScriptLoader
{
public:
spell_marrowgar_bone_slice() : SpellScriptLoader("spell_marrowgar_bone_slice") { }
class spell_marrowgar_bone_slice_SpellScript : public SpellScript
void SplitDamage()
{
PrepareSpellScript(spell_marrowgar_bone_slice_SpellScript);
if (!_targetCount)
return; // This spell can miss all targets
bool Load() override
{
_targetCount = 0;
return true;
}
void CountTargets(std::list<WorldObject*>& targets)
{
_targetCount = std::min<uint32>(targets.size(), GetSpellInfo()->MaxAffectedTargets);
}
void SplitDamage()
{
if (!_targetCount)
return; // This spell can miss all targets
SetHitDamage(GetHitDamage() / _targetCount);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_bone_slice_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnHit += SpellHitFn(spell_marrowgar_bone_slice_SpellScript::SplitDamage);
}
uint32 _targetCount;
};
SpellScript* GetSpellScript() const override
{
return new spell_marrowgar_bone_slice_SpellScript();
SetHitDamage(GetHitDamage() / _targetCount);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_bone_slice::CountTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnHit += SpellHitFn(spell_marrowgar_bone_slice::SplitDamage);
}
private:
uint32 _targetCount;
};
void AddSC_boss_lord_marrowgar()
@@ -705,10 +656,10 @@ void AddSC_boss_lord_marrowgar()
RegisterIcecrownCitadelCreatureAI(boss_lord_marrowgar);
new npc_coldflame();
new npc_bone_spike();
new spell_marrowgar_coldflame();
new spell_marrowgar_coldflame_bonestorm();
new spell_marrowgar_bone_spike_graveyard();
new spell_marrowgar_bone_storm();
new spell_marrowgar_bone_slice();
RegisterSpellScript(spell_marrowgar_coldflame);
RegisterSpellScript(spell_marrowgar_coldflame_bonestorm);
RegisterSpellScript(spell_marrowgar_bone_spike_graveyard);
RegisterSpellScript(spell_marrowgar_bone_storm);
RegisterSpellScript(spell_marrowgar_bone_slice);
}

View File

@@ -506,158 +506,194 @@ public:
}
};
class spell_rotface_mutated_infection : public SpellScriptLoader
class spell_rotface_mutated_infection : public SpellScript
{
public:
spell_rotface_mutated_infection() : SpellScriptLoader("spell_rotface_mutated_infection") { }
PrepareSpellScript(spell_rotface_mutated_infection);
class spell_rotface_mutated_infection_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_rotface_mutated_infection_SpellScript);
bool Load() override
{
_target = nullptr;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
// remove targets with this aura already
// tank is not on this list
targets.remove_if(Acore::UnitAuraCheck(true, GetSpellInfo()->Id));
targets.remove(GetCaster()->GetVictim());
if (targets.empty())
return;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
_target = target;
}
void ReplaceTargets(std::list<WorldObject*>& targets)
{
targets.clear();
if (_target)
targets.push_back(_target);
}
void NotifyTargets()
{
if (Creature* caster = GetCaster()->ToCreature())
if (Unit* target = GetHitUnit())
caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets);
}
WorldObject* _target;
};
class spell_rotface_mutated_infection_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rotface_mutated_infection_AuraScript);
void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[2].CalcValue(), true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_rotface_mutated_infection_AuraScript::ExtraRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_rotface_mutated_infection_SpellScript();
_target = nullptr;
return true;
}
AuraScript* GetAuraScript() const override
void FilterTargets(std::list<WorldObject*>& targets)
{
return new spell_rotface_mutated_infection_AuraScript();
// remove targets with this aura already
// tank is not on this list
targets.remove_if(Acore::UnitAuraCheck(true, GetSpellInfo()->Id));
targets.remove(GetCaster()->GetVictim());
if (targets.empty())
return;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
_target = target;
}
void ReplaceTargets(std::list<WorldObject*>& targets)
{
targets.clear();
if (_target)
targets.push_back(_target);
}
void NotifyTargets()
{
if (Creature* caster = GetCaster()->ToCreature())
if (Unit* target = GetHitUnit())
caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_rotface_mutated_infection::NotifyTargets);
}
private:
WorldObject* _target;
};
class spell_rotface_mutated_infection_aura : public AuraScript
{
PrepareAuraScript(spell_rotface_mutated_infection_aura);
void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[2].CalcValue(), true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_rotface_mutated_infection_aura::ExtraRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_rotface_little_ooze_combine : public SpellScriptLoader
class spell_rotface_little_ooze_combine : public SpellScript
{
public:
spell_rotface_little_ooze_combine() : SpellScriptLoader("spell_rotface_little_ooze_combine") { }
PrepareSpellScript(spell_rotface_little_ooze_combine);
class spell_rotface_little_ooze_combine_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_rotface_little_ooze_combine_SpellScript);
return ValidateSpellInfo({ SPELL_LITTLE_OOZE_COMBINE, SPELL_OOZE_MERGE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
// little targetting little
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
GetCaster()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->CastSpell(GetCaster(), SPELL_OOZE_MERGE, true);
GetHitCreature()->DespawnOrUnsummon();
if (GetCaster()->ToCreature())
GetCaster()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_little_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_rotface_little_ooze_combine_SpellScript();
// little targetting little
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
GetCaster()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->CastSpell(GetCaster(), SPELL_OOZE_MERGE, true);
GetHitCreature()->DespawnOrUnsummon();
if (GetCaster()->ToCreature())
GetCaster()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_little_ooze_combine::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_rotface_large_ooze_combine : public SpellScriptLoader
class spell_rotface_large_ooze_combine : public SpellScript
{
public:
spell_rotface_large_ooze_combine() : SpellScriptLoader("spell_rotface_large_ooze_combine") { }
PrepareSpellScript(spell_rotface_large_ooze_combine);
class spell_rotface_large_ooze_combine_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_rotface_large_ooze_combine_SpellScript);
return ValidateSpellInfo({ SPELL_UNSTABLE_OOZE, 69844, SPELL_LARGE_OOZE_BUFF_COMBINE, SPELL_LARGE_OOZE_COMBINE, SPELL_UNSTABLE_OOZE_EXPLOSION });
}
void HandleScript(SpellEffIndex /*effIndex*/)
void HandleScript(SpellEffIndex /*effIndex*/)
{
// large targetting large
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
uint8 casterStack = 1;
uint8 targetStack = 1;
Aura* casterAura = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE);
if (casterAura)
casterStack = casterAura->GetStackAmount();
Aura* targetAura = GetHitCreature()->GetAura(SPELL_UNSTABLE_OOZE);
if (targetAura)
targetStack = targetAura->GetStackAmount();
uint8 newStack = casterStack + targetStack;
if (newStack > 5)
newStack = 5;
if (casterAura)
casterAura->SetStackAmount(newStack);
else
{
// large targetting large
GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE, true);
if (Aura* aur = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE))
aur->SetStackAmount(newStack);
}
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
// red color!
if (newStack >= 4)
GetCaster()->CastSpell(GetCaster(), 69844, true);
uint8 casterStack = 1;
uint8 targetStack = 1;
Aura* casterAura = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE);
if (casterAura)
casterStack = casterAura->GetStackAmount();
Aura* targetAura = GetHitCreature()->GetAura(SPELL_UNSTABLE_OOZE);
if (targetAura)
targetStack = targetAura->GetStackAmount();
uint8 newStack = casterStack + targetStack;
if (newStack > 5)
newStack = 5;
if (casterAura)
casterAura->SetStackAmount(newStack);
else
{
GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE, true);
if (Aura* aur = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE))
aur->SetStackAmount(newStack);
}
// explode!
if (newStack >= 5)
{
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_ROTFACE)))
if (rotface->IsAlive())
{
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION);
rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION);
}
if (Creature* cre = GetCaster()->ToCreature())
cre->AI()->DoAction(EVENT_STICKY_OOZE);
GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID());
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false));
}
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
GetHitCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_combine::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_rotface_large_ooze_buff_combine : public SpellScript
{
PrepareSpellScript(spell_rotface_large_ooze_buff_combine);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ 69844, SPELL_LARGE_OOZE_BUFF_COMBINE, SPELL_LARGE_OOZE_COMBINE, SPELL_UNSTABLE_OOZE_EXPLOSION, SPELL_LITTLE_OOZE_COMBINE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
// large targetting little
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
if (Aura* unstable = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE))
{
uint8 newStack = uint8(unstable->GetStackAmount() + 1);
unstable->SetStackAmount(newStack);
// red color!
if (newStack >= 4)
@@ -683,193 +719,91 @@ public:
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false));
}
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
GetHitCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->DespawnOrUnsummon();
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_rotface_large_ooze_combine_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_buff_combine::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader
class spell_rotface_unstable_ooze_explosion_init : public SpellScript
{
public:
spell_rotface_large_ooze_buff_combine() : SpellScriptLoader("spell_rotface_large_ooze_buff_combine") { }
PrepareSpellScript(spell_rotface_unstable_ooze_explosion_init);
class spell_rotface_large_ooze_buff_combine_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_rotface_large_ooze_buff_combine_SpellScript);
return ValidateSpellInfo({ SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
// large targetting little
if (!GetHitCreature() || !GetHitCreature()->IsAlive())
return;
if (Aura* unstable = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE))
{
uint8 newStack = uint8(unstable->GetStackAmount() + 1);
unstable->SetStackAmount(newStack);
// red color!
if (newStack >= 4)
GetCaster()->CastSpell(GetCaster(), 69844, true);
// explode!
if (newStack >= 5)
{
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_ROTFACE)))
if (rotface->IsAlive())
{
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION);
rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION);
}
if (Creature* cre = GetCaster()->ToCreature())
cre->AI()->DoAction(EVENT_STICKY_OOZE);
GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID());
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false));
}
}
GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE);
GetHitCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleCast(SpellEffIndex effIndex)
{
return new spell_rotface_large_ooze_buff_combine_SpellScript();
PreventHitEffect(effIndex);
if (!GetHitUnit())
return;
float x, y, z;
GetHitUnit()->GetPosition(x, y, z);
Creature* dummy = GetCaster()->SummonCreature(NPC_UNSTABLE_EXPLOSION_STALKER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000);
GetCaster()->CastSpell(dummy, SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_unstable_ooze_explosion_init::HandleCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
class spell_rotface_unstable_ooze_explosion_init : public SpellScriptLoader
class spell_rotface_unstable_ooze_explosion : public SpellScript
{
public:
spell_rotface_unstable_ooze_explosion_init() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_init") { }
PrepareSpellScript(spell_rotface_unstable_ooze_explosion);
class spell_rotface_unstable_ooze_explosion_init_SpellScript : public SpellScript
void CheckTarget(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_rotface_unstable_ooze_explosion_init_SpellScript);
PreventHitDefaultEffect(EFFECT_0);
if (!GetExplTargetDest())
return;
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER });
}
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
void HandleCast(SpellEffIndex effIndex)
{
PreventHitEffect(effIndex);
if (!GetHitUnit())
return;
float x, y, z;
GetExplTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
rotface->CastSpell(x, y, z, triggered_spell_id, true/*, nullptr, nullptr, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case
}
float x, y, z;
GetHitUnit()->GetPosition(x, y, z);
Creature* dummy = GetCaster()->SummonCreature(NPC_UNSTABLE_EXPLOSION_STALKER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000);
GetCaster()->CastSpell(dummy, SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_unstable_ooze_explosion_init_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_rotface_unstable_ooze_explosion_init_SpellScript();
OnEffectHit += SpellEffectFn(spell_rotface_unstable_ooze_explosion::CheckTarget, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE);
}
};
class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
class spell_rotface_unstable_ooze_explosion_suicide_aura : public AuraScript
{
public:
spell_rotface_unstable_ooze_explosion() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion") { }
PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_aura);
class spell_rotface_unstable_ooze_explosion_SpellScript : public SpellScript
void DespawnSelf(AuraEffect const* /*aurEff*/)
{
PrepareSpellScript(spell_rotface_unstable_ooze_explosion_SpellScript);
PreventDefaultAction();
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
void CheckTarget(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(EFFECT_0);
if (!GetExplTargetDest())
return;
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
float x, y, z;
GetExplTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
rotface->CastSpell(x, y, z, triggered_spell_id, true/*, nullptr, nullptr, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_rotface_unstable_ooze_explosion_SpellScript::CheckTarget, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_rotface_unstable_ooze_explosion_SpellScript();
target->SetVisible(false);
target->RemoveAllAuras();
//target->ToCreature()->DespawnOrUnsummon();
target->ToCreature()->DespawnOrUnsummon(60000);
}
};
class spell_rotface_unstable_ooze_explosion_suicide : public SpellScriptLoader
{
public:
spell_rotface_unstable_ooze_explosion_suicide() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_suicide") { }
class spell_rotface_unstable_ooze_explosion_suicide_AuraScript : public AuraScript
void Register() override
{
PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_AuraScript);
void DespawnSelf(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
target->SetVisible(false);
target->RemoveAllAuras();
//target->ToCreature()->DespawnOrUnsummon();
target->ToCreature()->DespawnOrUnsummon(60000);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_rotface_unstable_ooze_explosion_suicide_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -969,13 +903,13 @@ void AddSC_boss_rotface()
new boss_rotface();
new npc_little_ooze();
new npc_big_ooze();
new spell_rotface_mutated_infection();
new spell_rotface_little_ooze_combine();
new spell_rotface_large_ooze_combine();
new spell_rotface_large_ooze_buff_combine();
new spell_rotface_unstable_ooze_explosion_init();
new spell_rotface_unstable_ooze_explosion();
new spell_rotface_unstable_ooze_explosion_suicide();
RegisterSpellAndAuraScriptPair(spell_rotface_mutated_infection, spell_rotface_mutated_infection_aura);
RegisterSpellScript(spell_rotface_little_ooze_combine);
RegisterSpellScript(spell_rotface_large_ooze_combine);
RegisterSpellScript(spell_rotface_large_ooze_buff_combine);
RegisterSpellScript(spell_rotface_unstable_ooze_explosion_init);
RegisterSpellScript(spell_rotface_unstable_ooze_explosion);
RegisterSpellScript(spell_rotface_unstable_ooze_explosion_suicide_aura);
new npc_precious_icc();
}

View File

@@ -767,79 +767,69 @@ public:
}
};
class spell_sindragosa_s_fury : public SpellScriptLoader
class spell_sindragosa_s_fury : public SpellScript
{
public:
spell_sindragosa_s_fury() : SpellScriptLoader("spell_sindragosa_s_fury") { }
PrepareSpellScript(spell_sindragosa_s_fury);
class spell_sindragosa_s_fury_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_sindragosa_s_fury_SpellScript);
_targetCount = 0;
bool Load() override
{
_targetCount = 0;
// This script should execute only in Icecrown Citadel
if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
if (instance->GetInstanceScript())
if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
return true;
// This script should execute only in Icecrown Citadel
if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
if (instance->GetInstanceScript())
if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
return true;
return false;
}
void SelectDest()
{
if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
{
float destX = float(rand_norm()) * 75.0f + 4350.0f;
float destY = float(rand_norm()) * 75.0f + 2450.0f;
float destZ = 205.0f; // random number close to ground, get exact in next call
GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
dest->Relocate(destX, destY, destZ);
}
}
void CountTargets(std::list<WorldObject*>& targets)
{
_targetCount = targets.size();
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
return;
float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
if (ResistFactor > 0.9f)
ResistFactor = 0.9f;
uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor) );
SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
damageInfo.damage = damage;
GetCaster()->SendSpellNonMeleeDamageLog(&damageInfo);
GetCaster()->DealSpellDamage(&damageInfo, false);
}
void Register() override
{
BeforeCast += SpellCastFn(spell_sindragosa_s_fury_SpellScript::SelectDest);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
}
uint32 _targetCount;
};
SpellScript* GetSpellScript() const override
{
return new spell_sindragosa_s_fury_SpellScript();
return false;
}
void SelectDest()
{
if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
{
float destX = float(rand_norm()) * 75.0f + 4350.0f;
float destY = float(rand_norm()) * 75.0f + 2450.0f;
float destZ = 205.0f; // random number close to ground, get exact in next call
GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
dest->Relocate(destX, destY, destZ);
}
}
void CountTargets(std::list<WorldObject*>& targets)
{
_targetCount = targets.size();
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
return;
float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
if (ResistFactor > 0.9f)
ResistFactor = 0.9f;
uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor) );
SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
damageInfo.damage = damage;
GetCaster()->SendSpellNonMeleeDamageLog(&damageInfo);
GetCaster()->DealSpellDamage(&damageInfo, false);
}
void Register() override
{
BeforeCast += SpellCastFn(spell_sindragosa_s_fury::SelectDest);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
}
private:
uint32 _targetCount;
};
class UnchainedMagicTargetSelector
@@ -895,170 +885,115 @@ class spell_sindragosa_unchained_magic : public SpellScript
}
};
class spell_sindragosa_permeating_chill : public SpellScriptLoader
class spell_sindragosa_permeating_chill_aura : public AuraScript
{
public:
spell_sindragosa_permeating_chill() : SpellScriptLoader("spell_sindragosa_permeating_chill") { }
PrepareAuraScript(spell_sindragosa_permeating_chill_aura);
class spell_sindragosa_permeating_chill_AuraScript : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
PrepareAuraScript(spell_sindragosa_permeating_chill_AuraScript);
return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->GetEntry() == NPC_SINDRAGOSA;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->GetEntry() == NPC_SINDRAGOSA;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_sindragosa_permeating_chill_AuraScript::CheckProc);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_sindragosa_permeating_chill_AuraScript();
DoCheckProc += AuraCheckProcFn(spell_sindragosa_permeating_chill_aura::CheckProc);
}
};
class spell_sindragosa_instability : public SpellScriptLoader
class spell_sindragosa_instability_aura : public AuraScript
{
public:
spell_sindragosa_instability() : SpellScriptLoader("spell_sindragosa_instability") { }
PrepareAuraScript(spell_sindragosa_instability_aura);
class spell_sindragosa_instability_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_sindragosa_instability_AuraScript);
return ValidateSpellInfo({ SPELL_BACKLASH });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_BACKLASH });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_instability_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
return new spell_sindragosa_instability_AuraScript();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_instability_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_sindragosa_icy_grip : public SpellScriptLoader
class spell_sindragosa_icy_grip : public SpellScript
{
public:
spell_sindragosa_icy_grip() : SpellScriptLoader("spell_sindragosa_icy_grip") { }
PrepareSpellScript(spell_sindragosa_icy_grip);
class spell_sindragosa_icy_grip_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript);
return ValidateSpellInfo({ SPELL_ICY_GRIP_JUMP });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_ICY_GRIP_JUMP });
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit()->IsWithinLOSInMap(GetCaster()) || GetHitUnit()->HasAura(SPELL_TANK_MARKER_AURA))
return;
GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_sindragosa_icy_grip_SpellScript();
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit()->IsWithinLOSInMap(GetCaster()) || GetHitUnit()->HasAura(SPELL_TANK_MARKER_AURA))
return;
GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_sindragosa_icy_grip_jump : public SpellScriptLoader
class spell_sindragosa_icy_grip_jump : public SpellScript
{
public:
spell_sindragosa_icy_grip_jump() : SpellScriptLoader("spell_sindragosa_icy_grip_jump") { }
PrepareSpellScript(spell_sindragosa_icy_grip_jump);
class spell_sindragosa_icy_grip_jump_SpellScript : public SpellScript
void HandleSpecial(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_sindragosa_icy_grip_jump_SpellScript);
PreventHitDefaultEffect(effIndex);
void HandleSpecial(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
float x = GetHitUnit()->GetPositionX();
float y = GetHitUnit()->GetPositionY();
float z = GetHitUnit()->GetPositionZ() + 0.1f;
float speedXY, speedZ;
float x = GetHitUnit()->GetPositionX();
float y = GetHitUnit()->GetPositionY();
float z = GetHitUnit()->GetPositionZ() + 0.1f;
float speedXY, speedZ;
if (GetSpellInfo()->Effects[effIndex].MiscValue)
speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValue) / 10;
else if (GetSpellInfo()->Effects[effIndex].MiscValueB)
speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValueB) / 10;
else
speedZ = 10.0f;
speedXY = GetCaster()->GetExactDist2d(x, y) * 10.0f / speedZ;
if (GetSpellInfo()->Effects[effIndex].MiscValue)
speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValue) / 10;
else if (GetSpellInfo()->Effects[effIndex].MiscValueB)
speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValueB) / 10;
else
speedZ = 10.0f;
speedXY = GetCaster()->GetExactDist2d(x, y) * 10.0f / speedZ;
GetCaster()->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
GetCaster()->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
void Register() override
{
OnEffectLaunchTarget += SpellEffectFn(spell_sindragosa_icy_grip_jump_SpellScript::HandleSpecial, EFFECT_0, SPELL_EFFECT_JUMP);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_sindragosa_icy_grip_jump_SpellScript();
OnEffectLaunchTarget += SpellEffectFn(spell_sindragosa_icy_grip_jump::HandleSpecial, EFFECT_0, SPELL_EFFECT_JUMP);
}
};
class spell_sindragosa_frost_beacon : public SpellScriptLoader
class spell_sindragosa_frost_beacon_aura : public AuraScript
{
public:
spell_sindragosa_frost_beacon() : SpellScriptLoader("spell_sindragosa_frost_beacon") { }
PrepareAuraScript(spell_sindragosa_frost_beacon_aura);
class spell_sindragosa_frost_beacon_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_sindragosa_frost_beacon_AuraScript);
return ValidateSpellInfo({ SPELL_ICE_TOMB_DAMAGE });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_ICE_TOMB_DAMAGE });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_ICE_TOMB_DAMAGE, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_frost_beacon_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
return new spell_sindragosa_frost_beacon_AuraScript();
PreventDefaultAction();
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_ICE_TOMB_DAMAGE, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_frost_beacon_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
@@ -1076,109 +1011,88 @@ public:
}
};
class spell_sindragosa_ice_tomb_filter : public SpellScriptLoader
class spell_sindragosa_ice_tomb_filter : public SpellScript
{
public:
spell_sindragosa_ice_tomb_filter() : SpellScriptLoader("spell_sindragosa_ice_tomb_filter") { }
PrepareSpellScript(spell_sindragosa_ice_tomb_filter);
class spell_sindragosa_ice_tomb_filter_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& unitList)
{
PrepareSpellScript(spell_sindragosa_ice_tomb_filter_SpellScript);
unitList.remove_if(SindragosaIceTombCheck());
}
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(SindragosaIceTombCheck());
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_filter_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_sindragosa_ice_tomb_filter_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_filter::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
class spell_sindragosa_ice_tomb : public SpellScriptLoader
class spell_sindragosa_ice_tomb_trap : public SpellScript
{
public:
spell_sindragosa_ice_tomb() : SpellScriptLoader("spell_sindragosa_ice_tomb_trap") { }
PrepareSpellScript(spell_sindragosa_ice_tomb_trap);
class spell_sindragosa_ice_tomb_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_sindragosa_ice_tomb_SpellScript);
std::list<WorldObject*> targetList;
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB))
return false;
if (!sObjectMgr->GetGameObjectTemplate(GO_ICE_BLOCK))
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(Acore::UnitAuraCheck(true, GetSpellInfo()->Id));
targetList.clear();
targetList = unitList;
}
void FilterTargetsSubseq(std::list<WorldObject*>& unitList)
{
unitList.clear();
unitList = targetList;
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargetsSubseq, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
class spell_sindragosa_ice_tomb_AuraScript : public AuraScript
{
PrepareAuraScript(spell_sindragosa_ice_tomb_AuraScript);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* c = GetCaster())
GetTarget()->m_Events.AddEvent(new IceTombSummonEvent(GetTarget(), c->GetGUID()), GetTarget()->m_Events.CalculateTime(500));
}
void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAurasDueToSpell(SPELL_ASPHYXIATION);
GetTarget()->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_ice_tomb_AuraScript::PeriodicTick, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_ice_tomb_AuraScript::ExtraRemoveEffect, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
AfterEffectApply += AuraEffectApplyFn(spell_sindragosa_ice_tomb_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_sindragosa_ice_tomb_SpellScript();
if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB))
return false;
if (!sObjectMgr->GetGameObjectTemplate(GO_ICE_BLOCK))
return false;
return true;
}
AuraScript* GetAuraScript() const override
void FilterTargets(std::list<WorldObject*>& unitList)
{
return new spell_sindragosa_ice_tomb_AuraScript();
unitList.remove_if(Acore::UnitAuraCheck(true, GetSpellInfo()->Id));
_targetList.clear();
_targetList = unitList;
}
void FilterTargetsSubseq(std::list<WorldObject*>& unitList)
{
unitList.clear();
unitList = _targetList;
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_trap::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_trap::FilterTargetsSubseq, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
private:
std::list<WorldObject*> _targetList;
};
class spell_sindragosa_ice_tomb_trap_aura : public AuraScript
{
PrepareAuraScript(spell_sindragosa_ice_tomb_trap_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ASPHYXIATION, SPELL_ICE_TOMB_UNTARGETABLE });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* c = GetCaster())
GetTarget()->m_Events.AddEvent(new IceTombSummonEvent(GetTarget(), c->GetGUID()), GetTarget()->m_Events.CalculateTime(500));
}
void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAurasDueToSpell(SPELL_ASPHYXIATION);
GetTarget()->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_ice_tomb_trap_aura::PeriodicTick, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_ice_tomb_trap_aura::ExtraRemoveEffect, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
AfterEffectApply += AuraEffectApplyFn(spell_sindragosa_ice_tomb_trap_aura::AfterApply, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1208,63 +1122,46 @@ private:
Unit* _caster;
};
class spell_sindragosa_mystic_buffet : public SpellScriptLoader
class spell_sindragosa_mystic_buffet : public SpellScript
{
public:
spell_sindragosa_mystic_buffet() : SpellScriptLoader("spell_sindragosa_mystic_buffet") { }
PrepareSpellScript(spell_sindragosa_mystic_buffet);
class spell_sindragosa_mystic_buffet_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript);
targets.remove_if(MysticBuffetTargetFilter(GetCaster()));
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(MysticBuffetTargetFilter(GetCaster()));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_sindragosa_mystic_buffet_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
class spell_sindragosa_soul_preservation : public SpellScriptLoader
class spell_sindragosa_soul_preservation_aura : public AuraScript
{
public:
spell_sindragosa_soul_preservation() : SpellScriptLoader("spell_sindragosa_soul_preservation") { }
PrepareAuraScript(spell_sindragosa_soul_preservation_aura);
class spell_sindragosa_soul_preservation_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_sindragosa_soul_preservation_AuraScript);
return ValidateSpellInfo({ 72466, 72424 });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* s = GetTarget())
if (GetStackAmount() >= (s->GetMap()->Is25ManRaid() ? 75 : 30))
{
s->CastSpell(s, 72466, true);
s->RemoveAurasDueToSpell(72424);
if (s->GetTypeId() == TYPEID_UNIT) s->ToCreature()->SetLootMode(3);
SetDuration(1);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_soul_preservation_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
return new spell_sindragosa_soul_preservation_AuraScript();
PreventDefaultAction();
if (Unit* s = GetTarget())
if (GetStackAmount() >= (s->GetMap()->Is25ManRaid() ? 75 : 30))
{
s->CastSpell(s, 72466, true);
s->RemoveAurasDueToSpell(72424);
if (s->GetTypeId() == TYPEID_UNIT) s->ToCreature()->SetLootMode(3);
SetDuration(1);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_soul_preservation_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
@@ -1597,37 +1494,26 @@ public:
}
};
class spell_rimefang_icy_blast : public SpellScriptLoader
class spell_rimefang_icy_blast : public SpellScript
{
public:
spell_rimefang_icy_blast() : SpellScriptLoader("spell_rimefang_icy_blast") { }
PrepareSpellScript(spell_rimefang_icy_blast);
class spell_rimefang_icy_blast_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_rimefang_icy_blast_SpellScript);
return ValidateSpellInfo({ SPELL_ICY_BLAST_AREA });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_ICY_BLAST_AREA });
}
void HandleTriggerMissile(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Position const* pos = GetExplTargetDest())
if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000))
summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_rimefang_icy_blast_SpellScript::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE);
}
};
SpellScript* GetSpellScript() const override
void HandleTriggerMissile(SpellEffIndex effIndex)
{
return new spell_rimefang_icy_blast_SpellScript();
PreventHitDefaultEffect(effIndex);
if (Position const* pos = GetExplTargetDest())
if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000))
summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_rimefang_icy_blast::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE);
}
};
@@ -1800,154 +1686,121 @@ private:
Creature* _owner;
};
class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
class spell_frostwarden_handler_order_whelp : public SpellScript
{
public:
spell_frostwarden_handler_order_whelp() : SpellScriptLoader("spell_frostwarden_handler_order_whelp") { }
PrepareSpellScript(spell_frostwarden_handler_order_whelp);
class spell_frostwarden_handler_order_whelp_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_frostwarden_handler_order_whelp_SpellScript);
return ValidateSpellInfo({ SPELL_FOCUS_FIRE });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_FOCUS_FIRE });
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
if (targets.empty())
return;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
void HandleForcedCast(SpellEffIndex effIndex)
{
// caster is Frostwarden Handler, target is player, caster of triggered is whelp
PreventHitDefaultEffect(effIndex);
std::list<Creature*> unitList;
GetCreatureListWithEntryInGrid(unitList, GetCaster(), NPC_FROSTWING_WHELP, 150.0f);
if (Creature* creature = GetCaster()->ToCreature())
unitList.remove_if(OrderWhelpTargetSelector(creature));
if (unitList.empty())
return;
Acore::Containers::SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
void FilterTargets(std::list<WorldObject*>& targets)
{
return new spell_frostwarden_handler_order_whelp_SpellScript();
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
if (targets.empty())
return;
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
void HandleForcedCast(SpellEffIndex effIndex)
{
// caster is Frostwarden Handler, target is player, caster of triggered is whelp
PreventHitDefaultEffect(effIndex);
std::list<Creature*> unitList;
GetCreatureListWithEntryInGrid(unitList, GetCaster(), NPC_FROSTWING_WHELP, 150.0f);
if (Creature* creature = GetCaster()->ToCreature())
unitList.remove_if(OrderWhelpTargetSelector(creature));
if (unitList.empty())
return;
Acore::Containers::SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
class spell_frostwarden_handler_focus_fire : public SpellScriptLoader
class spell_frostwarden_handler_focus_fire : public SpellScript
{
public:
spell_frostwarden_handler_focus_fire() : SpellScriptLoader("spell_frostwarden_handler_focus_fire") { }
PrepareSpellScript(spell_frostwarden_handler_focus_fire);
class spell_frostwarden_handler_focus_fire_SpellScript : public SpellScript
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_frostwarden_handler_focus_fire_SpellScript);
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->AddThreat(GetHitUnit(), float(GetEffectValue()));
GetCaster()->GetAI()->SetData(DATA_WHELP_MARKER, 1);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_focus_fire_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_frostwarden_handler_focus_fire_AuraScript : public AuraScript
{
PrepareAuraScript(spell_frostwarden_handler_focus_fire_AuraScript);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue()));
caster->GetAI()->SetData(DATA_WHELP_MARKER, 0);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_frostwarden_handler_focus_fire_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_frostwarden_handler_focus_fire_SpellScript();
PreventHitDefaultEffect(effIndex);
GetCaster()->AddThreat(GetHitUnit(), float(GetEffectValue()));
GetCaster()->GetAI()->SetData(DATA_WHELP_MARKER, 1);
}
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_frostwarden_handler_focus_fire_AuraScript();
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_focus_fire::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_sindragosa_frost_breath : public SpellScriptLoader
class spell_frostwarden_handler_focus_fire_aura : public AuraScript
{
public:
spell_sindragosa_frost_breath() : SpellScriptLoader("spell_sindragosa_frost_breath") { }
PrepareAuraScript(spell_frostwarden_handler_focus_fire_aura);
class spell_sindragosa_frost_breath_SpellScript : public SpellScript
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PrepareSpellScript(spell_sindragosa_frost_breath_SpellScript);
void HandleInfusion()
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
Player* target = GetHitPlayer();
if (!target)
return;
// Check difficulty and quest status
if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
return;
// Check if player has Shadow's Edge equipped and not ready for infusion
if (!target->HasAura(SPELL_UNSATED_CRAVING) || target->HasAura(SPELL_FROST_IMBUED_BLADE))
return;
Aura* infusion = target->GetAura(SPELL_FROST_INFUSION, target->GetGUID());
if (infusion && infusion->GetStackAmount() >= 3)
{
target->RemoveAura(infusion);
target->CastSpell(target, SPELL_FROST_IMBUED_BLADE, TRIGGERED_FULL_MASK);
}
else
target->CastSpell(target, SPELL_FROST_INFUSION, TRIGGERED_FULL_MASK);
caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue()));
caster->GetAI()->SetData(DATA_WHELP_MARKER, 0);
}
}
void Register() override
{
AfterHit += SpellHitFn(spell_sindragosa_frost_breath_SpellScript::HandleInfusion);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_sindragosa_frost_breath_SpellScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_frostwarden_handler_focus_fire_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_sindragosa_frost_breath : public SpellScript
{
PrepareSpellScript(spell_sindragosa_frost_breath);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_UNSATED_CRAVING, SPELL_FROST_IMBUED_BLADE, SPELL_FROST_INFUSION });
}
void HandleInfusion()
{
Player* target = GetHitPlayer();
if (!target)
return;
// Check difficulty and quest status
if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
return;
// Check if player has Shadow's Edge equipped and not ready for infusion
if (!target->HasAura(SPELL_UNSATED_CRAVING) || target->HasAura(SPELL_FROST_IMBUED_BLADE))
return;
Aura* infusion = target->GetAura(SPELL_FROST_INFUSION, target->GetGUID());
if (infusion && infusion->GetStackAmount() >= 3)
{
target->RemoveAura(infusion);
target->CastSpell(target, SPELL_FROST_IMBUED_BLADE, TRIGGERED_FULL_MASK);
}
else
target->CastSpell(target, SPELL_FROST_INFUSION, TRIGGERED_FULL_MASK);
}
void Register() override
{
AfterHit += SpellHitFn(spell_sindragosa_frost_breath::HandleInfusion);
}
};
@@ -1955,29 +1808,29 @@ void AddSC_boss_sindragosa()
{
new boss_sindragosa();
new npc_ice_tomb();
new spell_sindragosa_s_fury();
RegisterSpellScript(spell_sindragosa_s_fury);
RegisterSpellScript(spell_sindragosa_unchained_magic);
new spell_sindragosa_permeating_chill();
new spell_sindragosa_instability();
new spell_sindragosa_icy_grip();
new spell_sindragosa_icy_grip_jump();
new spell_sindragosa_ice_tomb_filter();
new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY);
new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON);
new spell_sindragosa_frost_beacon();
new spell_sindragosa_ice_tomb();
new spell_sindragosa_mystic_buffet();
new spell_sindragosa_soul_preservation();
RegisterSpellScript(spell_sindragosa_permeating_chill_aura);
RegisterSpellScript(spell_sindragosa_instability_aura);
RegisterSpellScript(spell_sindragosa_icy_grip);
RegisterSpellScript(spell_sindragosa_icy_grip_jump);
RegisterSpellScript(spell_sindragosa_ice_tomb_filter);
RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY);
RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON);
RegisterSpellScript(spell_sindragosa_frost_beacon_aura);
RegisterSpellAndAuraScriptPair(spell_sindragosa_ice_tomb_trap, spell_sindragosa_ice_tomb_trap_aura);
RegisterSpellScript(spell_sindragosa_mystic_buffet);
RegisterSpellScript(spell_sindragosa_soul_preservation_aura);
new achievement_all_you_can_eat();
new npc_spinestalker();
new npc_rimefang();
new spell_rimefang_icy_blast();
RegisterSpellScript(spell_rimefang_icy_blast);
new at_sindragosa_lair();
new npc_sindragosa_trash();
new spell_frostwarden_handler_order_whelp();
new spell_frostwarden_handler_focus_fire();
RegisterSpellScript(spell_frostwarden_handler_order_whelp);
RegisterSpellAndAuraScriptPair(spell_frostwarden_handler_focus_fire, spell_frostwarden_handler_focus_fire_aura);
new spell_sindragosa_frost_breath();
RegisterSpellScript(spell_sindragosa_frost_breath);
}

View File

@@ -1138,372 +1138,280 @@ public:
}
};
class spell_dreamwalker_summon_portal : public SpellScriptLoader
class spell_dreamwalker_summon_portal : public SpellScript
{
public:
spell_dreamwalker_summon_portal() : SpellScriptLoader("spell_dreamwalker_summon_portal") { }
PrepareSpellScript(spell_dreamwalker_summon_portal);
class spell_dreamwalker_summon_portal_SpellScript : public SpellScript
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_dreamwalker_summon_portal_SpellScript);
PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* target = GetHitUnit();
if (!target)
return;
uint32 spellId = (GetSpellInfo()->Id == 72224 ? 71301 : 71977); // spell implicit target replaced to TARGET_DEST_DEST
float minDist = 20.0f;
float maxDist = 30.0f;
float dist = (maxDist - minDist) * rand_norm() + minDist;
float startAngle = 3 * M_PI / 2;
float maxAddAngle = ((target->GetMap()->GetSpawnMode() % 2) == 0 ? M_PI : 2 * M_PI);
float angle = startAngle + rand_norm() * maxAddAngle;
target->CastSpell(target->GetPositionX() + cos(angle)*dist, target->GetPositionY() + std::sin(angle)*dist, target->GetPositionZ(), spellId, true);
}
uint32 spellId = (GetSpellInfo()->Id == 72224 ? 71301 : 71977); // spell implicit target replaced to TARGET_DEST_DEST
float minDist = 20.0f;
float maxDist = 30.0f;
float dist = (maxDist - minDist) * rand_norm() + minDist;
float startAngle = 3 * M_PI / 2;
float maxAddAngle = ((target->GetMap()->GetSpawnMode() % 2) == 0 ? M_PI : 2 * M_PI);
float angle = startAngle + rand_norm() * maxAddAngle;
target->CastSpell(target->GetPositionX() + cos(angle)*dist, target->GetPositionY() + std::sin(angle)*dist, target->GetPositionZ(), spellId, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_dreamwalker_summon_portal_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_portal::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader
class spell_dreamwalker_twisted_nightmares : public SpellScript
{
public:
spell_dreamwalker_twisted_nightmares() : SpellScriptLoader("spell_dreamwalker_twisted_nightmares") { }
PrepareSpellScript(spell_dreamwalker_twisted_nightmares);
class spell_dreamwalker_twisted_nightmares_SpellScript : public SpellScript
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_dreamwalker_twisted_nightmares_SpellScript);
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
GetHitUnit()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
}
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
GetHitUnit()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_twisted_nightmares_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_FORCE_CAST);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_dreamwalker_twisted_nightmares_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_twisted_nightmares::HandleScript, EFFECT_2, SPELL_EFFECT_FORCE_CAST);
}
};
class spell_dreamwalker_nightmare_cloud : public SpellScriptLoader
class spell_dreamwalker_nightmare_cloud_aura : public AuraScript
{
public:
spell_dreamwalker_nightmare_cloud() : SpellScriptLoader("spell_dreamwalker_nightmare_cloud") { }
PrepareAuraScript(spell_dreamwalker_nightmare_cloud_aura);
class spell_dreamwalker_nightmare_cloud_AuraScript : public AuraScript
bool Load() override
{
PrepareAuraScript(spell_dreamwalker_nightmare_cloud_AuraScript);
bool Load() override
{
_instance = GetOwner()->GetInstanceScript();
return _instance != nullptr;
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS)
PreventDefaultAction();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_nightmare_cloud_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
InstanceScript* _instance;
};
AuraScript* GetAuraScript() const override
{
return new spell_dreamwalker_nightmare_cloud_AuraScript();
_instance = GetOwner()->GetInstanceScript();
return _instance != nullptr;
}
};
class spell_dreamwalker_mana_void : public SpellScriptLoader
{
public:
spell_dreamwalker_mana_void() : SpellScriptLoader("spell_dreamwalker_mana_void") { }
class spell_dreamwalker_mana_void_AuraScript : public AuraScript
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PrepareAuraScript(spell_dreamwalker_mana_void_AuraScript);
void PeriodicTick(AuraEffect const* aurEff)
{
// first 3 ticks have amplitude 1 second
// remaining tick every 500ms
if (aurEff->GetTickNumber() <= 5)
if (!(aurEff->GetTickNumber() & 1))
PreventDefaultAction();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_mana_void_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dreamwalker_mana_void_AuraScript();
}
};
class spell_dreamwalker_decay_periodic_timer : public SpellScriptLoader
{
public:
spell_dreamwalker_decay_periodic_timer() : SpellScriptLoader("spell_dreamwalker_decay_periodic_timer") { }
class spell_dreamwalker_decay_periodic_timer_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dreamwalker_decay_periodic_timer_AuraScript);
bool Load() override
{
_decayRate = GetId() != SPELL_TIMER_BLAZING_SKELETON ? 1000 : 5000;
return true;
}
void DecayPeriodicTimer(AuraEffect* aurEff)
{
int32 timer = aurEff->GetPeriodicTimer();
if (timer <= 5000)
return;
aurEff->SetPeriodicTimer(timer - _decayRate);
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dreamwalker_decay_periodic_timer_AuraScript::DecayPeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
int32 _decayRate;
};
AuraScript* GetAuraScript() const override
{
return new spell_dreamwalker_decay_periodic_timer_AuraScript();
}
};
class spell_dreamwalker_summoner : public SpellScriptLoader
{
public:
spell_dreamwalker_summoner() : SpellScriptLoader("spell_dreamwalker_summoner") { }
class spell_dreamwalker_summoner_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dreamwalker_summoner_SpellScript);
bool Load() override
{
if (!GetCaster()->GetInstanceScript())
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 250.0f, true));
std::list<WorldObject*> list_copy = targets;
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
if (targets.empty())
{
if (list_copy.empty())
return;
targets = list_copy;
}
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
void HandleForceCast(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dreamwalker_summoner_SpellScript();
}
};
class spell_dreamwalker_summon_suppresser : public SpellScriptLoader
{
public:
spell_dreamwalker_summon_suppresser() : SpellScriptLoader("spell_dreamwalker_summon_suppresser") { }
class spell_dreamwalker_summon_suppresser_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dreamwalker_summon_suppresser_AuraScript);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS)
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
}
std::list<Creature*> summoners;
caster->GetCreaturesWithEntryInRange(summoners, 200.0f, NPC_WORLD_TRIGGER);
std::list<Creature*> list_copy = summoners;
summoners.remove_if(Acore::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
if (summoners.empty())
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_nightmare_cloud_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
private:
InstanceScript* _instance;
};
class spell_dreamwalker_mana_void_aura : public AuraScript
{
PrepareAuraScript(spell_dreamwalker_mana_void_aura);
void PeriodicTick(AuraEffect const* aurEff)
{
// first 3 ticks have amplitude 1 second
// remaining tick every 500ms
if (aurEff->GetTickNumber() <= 5)
if (!(aurEff->GetTickNumber() & 1))
PreventDefaultAction();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_mana_void_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_dreamwalker_decay_periodic_timer_aura : public AuraScript
{
PrepareAuraScript(spell_dreamwalker_decay_periodic_timer_aura);
bool Load() override
{
_decayRate = GetId() != SPELL_TIMER_BLAZING_SKELETON ? 1000 : 5000;
return true;
}
void DecayPeriodicTimer(AuraEffect* aurEff)
{
int32 timer = aurEff->GetPeriodicTimer();
if (timer <= 5000)
return;
aurEff->SetPeriodicTimer(timer - _decayRate);
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dreamwalker_decay_periodic_timer_aura::DecayPeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
private:
int32 _decayRate;
};
class spell_dreamwalker_summoner : public SpellScript
{
PrepareSpellScript(spell_dreamwalker_summoner);
bool Load() override
{
if (!GetCaster()->GetInstanceScript())
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::AllWorldObjectsInExactRange(GetCaster(), 250.0f, true));
std::list<WorldObject*> list_copy = targets;
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
if (targets.empty())
{
if (list_copy.empty())
return;
targets = list_copy;
}
WorldObject* target = Acore::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
void HandleForceCast(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
class spell_dreamwalker_summon_suppresser_aura : public AuraScript
{
PrepareAuraScript(spell_dreamwalker_summon_suppresser_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_SUPPRESSER });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
std::list<Creature*> summoners;
caster->GetCreaturesWithEntryInRange(summoners, 200.0f, NPC_WORLD_TRIGGER);
std::list<Creature*> list_copy = summoners;
summoners.remove_if(Acore::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
if (summoners.empty())
{
if (list_copy.empty())
return;
summoners = list_copy;
}
Acore::Containers::RandomResize(summoners, 2);
for (uint32 i = 0; i < 3; ++i)
caster->CastSpell(summoners.front(), SPELL_SUMMON_SUPPRESSER, true);
for (uint32 i = 0; i < 3; ++i)
caster->CastSpell(summoners.back(), SPELL_SUMMON_SUPPRESSER, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_summon_suppresser_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_dreamwalker_summon_suppresser_effect : public SpellScript
{
PrepareSpellScript(spell_dreamwalker_summon_suppresser_effect);
bool Load() override
{
if (!GetCaster()->GetInstanceScript())
return false;
return true;
}
void HandleForceCast(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_suppresser_effect::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
class spell_valithria_suppression_aura : public AuraScript
{
PrepareAuraScript(spell_valithria_suppression_aura);
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
const_cast<AuraEffect*>(aurEff)->SetAmount(0);
Unit* target = GetTarget();
Unit::AuraApplicationMap& aam = target->GetAppliedAuras();
Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id);
uint32 count = target->GetAuraCount(GetSpellInfo()->Id);
if (range.first == range.second)
return;
for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
if (count == 1 || itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount())
{
if (list_copy.empty())
return;
summoners = list_copy;
itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue());
break;
}
Acore::Containers::RandomResize(summoners, 2);
for (uint32 i = 0; i < 3; ++i)
caster->CastSpell(summoners.front(), SPELL_SUMMON_SUPPRESSER, true);
for (uint32 i = 0; i < 3; ++i)
caster->CastSpell(summoners.back(), SPELL_SUMMON_SUPPRESSER, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_summon_suppresser_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dreamwalker_summon_suppresser_AuraScript();
}
};
class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader
{
public:
spell_dreamwalker_summon_suppresser_effect() : SpellScriptLoader("spell_dreamwalker_summon_suppresser_effect") { }
class spell_dreamwalker_summon_suppresser_effect_SpellScript : public SpellScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareSpellScript(spell_dreamwalker_summon_suppresser_effect_SpellScript);
Unit* target = GetTarget();
Unit::AuraApplicationMap& aam = target->GetAppliedAuras();
Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id);
uint32 count = target->GetAuraCount(GetSpellInfo()->Id);
bool Load() override
{
if (!GetCaster()->GetInstanceScript())
return false;
return true;
}
if (range.first == range.second)
return;
void HandleForceCast(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit())
return;
for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
if (itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount())
itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(0);
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_suppresser_effect_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dreamwalker_summon_suppresser_effect_SpellScript();
range.first->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue());
}
};
class spell_valithria_suppression : public SpellScriptLoader
{
public:
spell_valithria_suppression() : SpellScriptLoader("spell_valithria_suppression") { }
class spell_valithria_suppression_AuraScript : public AuraScript
void Register() override
{
PrepareAuraScript(spell_valithria_suppression_AuraScript);
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
const_cast<AuraEffect*>(aurEff)->SetAmount(0);
Unit* target = GetTarget();
Unit::AuraApplicationMap& aam = target->GetAppliedAuras();
Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id);
uint32 count = target->GetAuraCount(GetSpellInfo()->Id);
if (range.first == range.second)
return;
for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
if (count == 1 || itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount())
{
itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue());
break;
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
Unit::AuraApplicationMap& aam = target->GetAppliedAuras();
Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id);
uint32 count = target->GetAuraCount(GetSpellInfo()->Id);
if (range.first == range.second)
return;
for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
if (itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount())
itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(0);
range.first->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_valithria_suppression_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
AfterEffectRemove += AuraEffectRemoveFn(spell_valithria_suppression_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_valithria_suppression_AuraScript();
AfterEffectApply += AuraEffectApplyFn(spell_valithria_suppression_aura::OnApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
AfterEffectRemove += AuraEffectRemoveFn(spell_valithria_suppression_aura::OnRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1531,15 +1439,15 @@ void AddSC_boss_valithria_dreamwalker()
new npc_blistering_zombie();
new npc_gluttonous_abomination();
new spell_dreamwalker_summon_portal();
new spell_dreamwalker_twisted_nightmares();
new spell_dreamwalker_nightmare_cloud();
new spell_dreamwalker_mana_void();
new spell_dreamwalker_decay_periodic_timer();
new spell_dreamwalker_summoner();
new spell_dreamwalker_summon_suppresser();
new spell_dreamwalker_summon_suppresser_effect();
new spell_valithria_suppression();
RegisterSpellScript(spell_dreamwalker_summon_portal);
RegisterSpellScript(spell_dreamwalker_twisted_nightmares);
RegisterSpellScript(spell_dreamwalker_nightmare_cloud_aura);
RegisterSpellScript(spell_dreamwalker_mana_void_aura);
RegisterSpellScript(spell_dreamwalker_decay_periodic_timer_aura);
RegisterSpellScript(spell_dreamwalker_summoner);
RegisterSpellScript(spell_dreamwalker_summon_suppresser_aura);
RegisterSpellScript(spell_dreamwalker_summon_suppresser_effect);
RegisterSpellScript(spell_valithria_suppression_aura);
new achievement_portal_jockey();
}

View File

@@ -1890,252 +1890,207 @@ public:
}
};
class spell_icc_stoneform : public SpellScriptLoader
class spell_icc_stoneform_aura : public AuraScript
{
public:
spell_icc_stoneform() : SpellScriptLoader("spell_icc_stoneform") { }
PrepareAuraScript(spell_icc_stoneform_aura);
class spell_icc_stoneform_AuraScript : public AuraScript
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_icc_stoneform_AuraScript);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Creature* target = GetTarget()->ToCreature())
{
if (Creature* target = GetTarget()->ToCreature())
{
target->SetReactState(REACT_PASSIVE);
target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(true);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02);
}
target->SetReactState(REACT_PASSIVE);
target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(true);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02);
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* target = GetTarget()->ToCreature())
{
target->SetReactState(REACT_AGGRESSIVE);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(false);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_icc_stoneform_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_icc_stoneform_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_icc_stoneform_AuraScript();
if (Creature* target = GetTarget()->ToCreature())
{
target->SetReactState(REACT_AGGRESSIVE);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(false);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_icc_stoneform_aura::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_icc_stoneform_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_icc_sprit_alarm : public SpellScriptLoader
class spell_icc_sprit_alarm : public SpellScript
{
public:
spell_icc_sprit_alarm() : SpellScriptLoader("spell_icc_sprit_alarm") { }
PrepareSpellScript(spell_icc_sprit_alarm);
class spell_icc_sprit_alarm_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_icc_sprit_alarm_SpellScript);
return ValidateSpellInfo({ SPELL_STONEFORM });
}
void HandleEvent(SpellEffIndex effIndex)
void HandleEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
uint32 trapId = 0;
switch (GetSpellInfo()->Effects[effIndex].MiscValue)
{
PreventHitDefaultEffect(effIndex);
uint32 trapId = 0;
switch (GetSpellInfo()->Effects[effIndex].MiscValue)
{
case EVENT_AWAKEN_WARD_1:
trapId = GO_SPIRIT_ALARM_1;
break;
case EVENT_AWAKEN_WARD_2:
trapId = GO_SPIRIT_ALARM_2;
break;
case EVENT_AWAKEN_WARD_3:
trapId = GO_SPIRIT_ALARM_3;
break;
case EVENT_AWAKEN_WARD_4:
trapId = GO_SPIRIT_ALARM_4;
break;
default:
return;
}
case EVENT_AWAKEN_WARD_1:
trapId = GO_SPIRIT_ALARM_1;
break;
case EVENT_AWAKEN_WARD_2:
trapId = GO_SPIRIT_ALARM_2;
break;
case EVENT_AWAKEN_WARD_3:
trapId = GO_SPIRIT_ALARM_3;
break;
case EVENT_AWAKEN_WARD_4:
trapId = GO_SPIRIT_ALARM_4;
break;
default:
return;
}
if (GameObject* trap = GetCaster()->FindNearestGameObject(trapId, 5.0f))
{
trap->SetRespawnTime(trap->GetGOInfo()->GetAutoCloseTime() / IN_MILLISECONDS);
}
if (GameObject* trap = GetCaster()->FindNearestGameObject(trapId, 5.0f))
{
trap->SetRespawnTime(trap->GetGOInfo()->GetAutoCloseTime() / IN_MILLISECONDS);
}
std::list<Creature*> wards;
GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, 150.0f);
wards.sort(Acore::ObjectDistanceOrderPred(GetCaster()));
for (std::list<Creature*>::iterator itr = wards.begin(); itr != wards.end(); ++itr)
std::list<Creature*> wards;
GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, 150.0f);
wards.sort(Acore::ObjectDistanceOrderPred(GetCaster()));
for (std::list<Creature*>::iterator itr = wards.begin(); itr != wards.end(); ++itr)
{
if ((*itr)->IsAlive() && (*itr)->HasAura(SPELL_STONEFORM))
{
if ((*itr)->IsAlive() && (*itr)->HasAura(SPELL_STONEFORM))
(*itr)->AI()->Talk(SAY_TRAP_ACTIVATE);
(*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM);
(*itr)->AI()->SetData(1, 1);
break;
}
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_icc_sprit_alarm::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT);
}
};
class spell_icc_geist_alarm : public SpellScript
{
PrepareSpellScript(spell_icc_geist_alarm);
void HandleEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
Position p = {4356.77f, 2971.90f, 360.52f, M_PI / 2};
if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p))
{
bool hasTarget = false;
Unit* target = nullptr;
if ((target = l->SelectNearestTarget(20.0f)))
hasTarget = true;
else
{
(*itr)->AI()->Talk(SAY_TRAP_ACTIVATE);
(*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM);
(*itr)->AI()->SetData(1, 1);
break;
target = l->SelectNearestTarget(120.0f);
l->GetMotionMaster()->MoveJump(l->GetPositionX(), l->GetPositionY() + 55.0f, l->GetPositionZ(), 20.0f, 6.0f);
}
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_icc_sprit_alarm_SpellScript::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_icc_sprit_alarm_SpellScript();
}
};
class spell_icc_geist_alarm : public SpellScriptLoader
{
public:
spell_icc_geist_alarm() : SpellScriptLoader("spell_icc_geist_alarm") { }
class spell_icc_geist_alarm_SpellScript : public SpellScript
{
PrepareSpellScript(spell_icc_geist_alarm_SpellScript);
void HandleEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
Position p = {4356.77f, 2971.90f, 360.52f, M_PI / 2};
if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p))
l->AI()->Talk(0);
l->AI()->AttackStart(target);
l->AddThreat(target, 1.0f);
for (uint8 i = 0; i < 5; ++i)
{
bool hasTarget = false;
Unit* target = nullptr;
if ((target = l->SelectNearestTarget(20.0f)))
hasTarget = true;
else
float dist = 2.0f + rand_norm() * 4.0f;
float angle = rand_norm() * 2 * M_PI;
Position pos(p);
l->MovePosition(pos, dist, angle);
if (Creature* c = l->SummonCreature(NPC_VENGEFUL_FLESHREAPER, pos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30 * MINUTE * IN_MILLISECONDS))
{
target = l->SelectNearestTarget(120.0f);
l->GetMotionMaster()->MoveJump(l->GetPositionX(), l->GetPositionY() + 55.0f, l->GetPositionZ(), 20.0f, 6.0f);
}
l->AI()->Talk(0);
l->AI()->AttackStart(target);
l->AddThreat(target, 1.0f);
for (uint8 i = 0; i < 5; ++i)
{
float dist = 2.0f + rand_norm() * 4.0f;
float angle = rand_norm() * 2 * M_PI;
Position pos(p);
l->MovePosition(pos, dist, angle);
if (Creature* c = l->SummonCreature(NPC_VENGEFUL_FLESHREAPER, pos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30 * MINUTE * IN_MILLISECONDS))
{
c->AI()->AttackStart(l->GetVictim());
c->AddThreat(l->GetVictim(), 1.0f);
if (!hasTarget)
c->GetMotionMaster()->MoveJump(c->GetPositionX(), c->GetPositionY() + 55.0f, c->GetPositionZ(), 20.0f, 6.0f);
}
c->AI()->AttackStart(l->GetVictim());
c->AddThreat(l->GetVictim(), 1.0f);
if (!hasTarget)
c->GetMotionMaster()->MoveJump(c->GetPositionX(), c->GetPositionY() + 55.0f, c->GetPositionZ(), 20.0f, 6.0f);
}
}
}
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_icc_geist_alarm_SpellScript::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_icc_geist_alarm_SpellScript();
OnEffectHit += SpellEffectFn(spell_icc_geist_alarm::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT);
}
};
class spell_frost_giant_death_plague : public SpellScriptLoader
class spell_frost_giant_death_plague : public SpellScript
{
public:
spell_frost_giant_death_plague() : SpellScriptLoader("spell_frost_giant_death_plague") { }
PrepareSpellScript(spell_frost_giant_death_plague);
class spell_frost_giant_death_plague_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_frost_giant_death_plague_SpellScript);
return ValidateSpellInfo({ SPELL_DEATH_PLAGUE_AURA, SPELL_DEATH_PLAGUE_KILL, SPELL_RECENTLY_INFECTED });
}
// First effect
void CountTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(Acore::ObjectGUIDCheck(GetCaster()->GetGUID(), true));
// First effect
void CountTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(Acore::ObjectGUIDCheck(GetCaster()->GetGUID(), true));
bool kill = true;
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (!(*itr)->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
{
kill = false;
break;
}
if (kill)
GetCaster()->CastSpell(GetCaster(), SPELL_DEATH_PLAGUE_KILL, true);
else
bool kill = true;
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (!(*itr)->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
{
GetCaster()->CastSpell(GetCaster(), SPELL_RECENTLY_INFECTED, true);
targets.push_back(GetCaster());
kill = false;
break;
}
}
void HandleScript(SpellEffIndex /*effIndex*/)
if (kill)
GetCaster()->CastSpell(GetCaster(), SPELL_DEATH_PLAGUE_KILL, true);
else
{
if (!GetHitUnit()->HasAura(SPELL_RECENTLY_INFECTED) && !GetHitUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_DEATH_PLAGUE_AURA, true);
GetCaster()->CastSpell(GetCaster(), SPELL_RECENTLY_INFECTED, true);
targets.push_back(GetCaster());
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_frost_giant_death_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_frost_giant_death_plague_SpellScript();
if (!GetHitUnit()->HasAura(SPELL_RECENTLY_INFECTED) && !GetHitUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_DEATH_PLAGUE_AURA, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_frost_giant_death_plague::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
class spell_icc_harvest_blight_specimen : public SpellScriptLoader
class spell_icc_harvest_blight_specimen : public SpellScript
{
public:
spell_icc_harvest_blight_specimen() : SpellScriptLoader("spell_icc_harvest_blight_specimen") { }
PrepareSpellScript(spell_icc_harvest_blight_specimen);
class spell_icc_harvest_blight_specimen_SpellScript : public SpellScript
void HandleScript(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_icc_harvest_blight_specimen_SpellScript);
PreventHitDefaultEffect(effIndex);
GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue()));
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue()));
}
void HandleQuestComplete(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue()));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_icc_harvest_blight_specimen_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_icc_harvest_blight_specimen_SpellScript::HandleQuestComplete, EFFECT_1, SPELL_EFFECT_QUEST_COMPLETE);
}
};
SpellScript* GetSpellScript() const override
void HandleQuestComplete(SpellEffIndex /*effIndex*/)
{
return new spell_icc_harvest_blight_specimen_SpellScript();
GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue()));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_icc_harvest_blight_specimen::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_icc_harvest_blight_specimen::HandleQuestComplete, EFFECT_1, SPELL_EFFECT_QUEST_COMPLETE);
}
};
@@ -2150,103 +2105,75 @@ public:
}
};
class spell_svalna_revive_champion : public SpellScriptLoader
class spell_svalna_revive_champion : public SpellScript
{
public:
spell_svalna_revive_champion() : SpellScriptLoader("spell_svalna_revive_champion") { }
PrepareSpellScript(spell_svalna_revive_champion);
class spell_svalna_revive_champion_SpellScript : public SpellScript
void RemoveAliveTarget(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_svalna_revive_champion_SpellScript);
targets.remove_if(AliveCheck());
Acore::Containers::RandomResize(targets, 2);
}
void RemoveAliveTarget(std::list<WorldObject*>& targets)
{
targets.remove_if(AliveCheck());
Acore::Containers::RandomResize(targets, 2);
}
void Land(SpellEffIndex /*effIndex*/)
{
Creature* caster = GetCaster()->ToCreature();
if (!caster)
return;
Position pos = caster->GetNearPosition(5.0f, 0.0f);
pos.m_positionZ = caster->GetMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
pos.m_positionZ += 0.1f;
caster->SendMeleeAttackStop(caster->GetVictim());
caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, 7.0f);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHit += SpellEffectFn(spell_svalna_revive_champion_SpellScript::Land, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Land(SpellEffIndex /*effIndex*/)
{
return new spell_svalna_revive_champion_SpellScript();
Creature* caster = GetCaster()->ToCreature();
if (!caster)
return;
Position pos = caster->GetNearPosition(5.0f, 0.0f);
pos.m_positionZ = caster->GetMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
pos.m_positionZ += 0.1f;
caster->SendMeleeAttackStop(caster->GetVictim());
caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, 7.0f);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_svalna_revive_champion::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHit += SpellEffectFn(spell_svalna_revive_champion::Land, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_svalna_remove_spear : public SpellScriptLoader
class spell_svalna_remove_spear : public SpellScript
{
public:
spell_svalna_remove_spear() : SpellScriptLoader("spell_svalna_remove_spear") { }
PrepareSpellScript(spell_svalna_remove_spear);
class spell_svalna_remove_spear_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_svalna_remove_spear_SpellScript);
return ValidateSpellInfo({ SPELL_IMPALING_SPEAR });
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
{
if (Unit* vehicle = target->GetVehicleBase())
vehicle->RemoveAurasDueToSpell(SPELL_IMPALING_SPEAR);
target->DespawnOrUnsummon(1);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_svalna_remove_spear_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_svalna_remove_spear_SpellScript();
PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
{
if (Unit* vehicle = target->GetVehicleBase())
vehicle->RemoveAurasDueToSpell(SPELL_IMPALING_SPEAR);
target->DespawnOrUnsummon(1);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_svalna_remove_spear::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_icc_soul_missile : public SpellScriptLoader
class spell_icc_soul_missile : public SpellScript
{
public:
spell_icc_soul_missile() : SpellScriptLoader("spell_icc_soul_missile") { }
PrepareSpellScript(spell_icc_soul_missile);
class spell_icc_soul_missile_SpellScript : public SpellScript
void RelocateDest()
{
PrepareSpellScript(spell_icc_soul_missile_SpellScript);
static Position const offset = {0.0f, 0.0f, 200.0f, 0.0f};
const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
}
void RelocateDest()
{
static Position const offset = {0.0f, 0.0f, 200.0f, 0.0f};
const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
}
void Register() override
{
OnCast += SpellCastFn(spell_icc_soul_missile_SpellScript::RelocateDest);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_icc_soul_missile_SpellScript();
OnCast += SpellCastFn(spell_icc_soul_missile::RelocateDest);
}
};
@@ -2346,207 +2273,160 @@ public:
// pussywizard below:
class spell_icc_web_wrap : public SpellScriptLoader
class spell_icc_web_wrap_aura : public AuraScript
{
public:
spell_icc_web_wrap() : SpellScriptLoader("spell_icc_web_wrap") { }
PrepareAuraScript(spell_icc_web_wrap_aura);
class spell_icc_web_wrap_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_icc_web_wrap_AuraScript);
return ValidateSpellInfo({ 71010 });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(71010))
target->CastSpell(target, 71010, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_icc_web_wrap_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_icc_web_wrap_AuraScript();
Unit* target = GetTarget();
if (!target->HasAura(71010))
target->CastSpell(target, 71010, true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_icc_web_wrap_aura::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_icc_dark_reckoning : public SpellScriptLoader
class spell_icc_dark_reckoning_aura : public AuraScript
{
public:
spell_icc_dark_reckoning() : SpellScriptLoader("spell_icc_dark_reckoning") { }
PrepareAuraScript(spell_icc_dark_reckoning_aura);
class spell_icc_dark_reckoning_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_icc_dark_reckoning_AuraScript);
return ValidateSpellInfo({ 69482 });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), 69482, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_dark_reckoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_icc_dark_reckoning_AuraScript();
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), 69482, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_dark_reckoning_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_stinky_precious_decimate : public SpellScriptLoader
class spell_stinky_precious_decimate : public SpellScript
{
public:
spell_stinky_precious_decimate() : SpellScriptLoader("spell_stinky_precious_decimate") { }
PrepareSpellScript(spell_stinky_precious_decimate);
class spell_stinky_precious_decimate_SpellScript : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_stinky_precious_decimate_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
if (GetHitUnit()->GetHealthPct() > float(GetEffectValue()))
{
if (GetHitUnit()->GetHealthPct() > float(GetEffectValue()))
uint32 newHealth = GetHitUnit()->GetMaxHealth() * uint32(GetEffectValue()) / 100;
GetHitUnit()->SetHealth(newHealth);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_stinky_precious_decimate::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_icc_yf_frozen_orb_aura : public AuraScript
{
PrepareAuraScript(spell_icc_yf_frozen_orb_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ 71285 });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* c = GetCaster())
if (Unit* t = GetTarget())
c->CastSpell(t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 71285, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yf_frozen_orb_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_icc_yh_volley_aura : public AuraScript
{
PrepareAuraScript(spell_icc_yh_volley_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ 41089 });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* c = GetCaster())
if (Unit* t = GetTarget())
{
uint32 newHealth = GetHitUnit()->GetMaxHealth() * uint32(GetEffectValue()) / 100;
GetHitUnit()->SetHealth(newHealth);
if ((aurEff->GetTickNumber() % 5) == 0)
c->SetFacingToObject(t);
int32 basepoints1 = aurEff->GetAmount();
c->CastCustomSpell(t, 41089, 0, &basepoints1, 0, true);
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_stinky_precious_decimate_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_stinky_precious_decimate_SpellScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yh_volley_aura::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE);
}
};
class spell_icc_yf_frozen_orb : public SpellScriptLoader
class spell_icc_yd_summon_undead : public SpellScript
{
public:
spell_icc_yf_frozen_orb() : SpellScriptLoader("spell_icc_yf_frozen_orb") { }
PrepareSpellScript(spell_icc_yd_summon_undead);
class spell_icc_yf_frozen_orb_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_icc_yf_frozen_orb_AuraScript)
return ValidateSpellInfo({ 71302 });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* c = GetCaster())
if (Unit* t = GetTarget())
c->CastSpell(t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 71285, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yf_frozen_orb_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleDummyLaunch(SpellEffIndex /*effIndex*/)
{
return new spell_icc_yf_frozen_orb_AuraScript();
if (Unit* c = GetCaster())
if (c->GetMapId() == 631)
for (uint8 i = 0; i < 5; ++i)
c->CastSpell(c, 71302, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_icc_yd_summon_undead::HandleDummyLaunch, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_icc_yh_volley : public SpellScriptLoader
class spell_icc_shattered_bones : public SpellScript
{
public:
spell_icc_yh_volley() : SpellScriptLoader("spell_icc_yh_volley") { }
PrepareSpellScript(spell_icc_shattered_bones);
class spell_icc_yh_volley_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_icc_yh_volley_AuraScript)
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* c = GetCaster())
if (Unit* t = GetTarget())
{
if ((aurEff->GetTickNumber() % 5) == 0)
c->SetFacingToObject(t);
int32 basepoints1 = aurEff->GetAmount();
c->CastCustomSpell(t, 41089, 0, &basepoints1, 0, true);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yh_volley_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_icc_yh_volley_AuraScript();
return ValidateSpellInfo({ 70963 });
}
};
class spell_icc_yd_summon_undead : public SpellScriptLoader
{
public:
spell_icc_yd_summon_undead() : SpellScriptLoader("spell_icc_yd_summon_undead") { }
class spell_icc_yd_summon_undead_SpellScript : public SpellScript
void HandleDummy()
{
PrepareSpellScript(spell_icc_yd_summon_undead_SpellScript);
void HandleDummyLaunch(SpellEffIndex /*effIndex*/)
{
if (Unit* c = GetCaster())
if (c->GetMapId() == 631)
for (uint8 i = 0; i < 5; ++i)
c->CastSpell(c, 71302, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_icc_yd_summon_undead_SpellScript::HandleDummyLaunch, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_icc_yd_summon_undead_SpellScript();
for (uint8 i = 0; i < 10; ++i)
GetCaster()->CastSpell((Unit*)nullptr, 70963, true);
}
};
class spell_icc_shattered_bones : public SpellScriptLoader
{
public:
spell_icc_shattered_bones() : SpellScriptLoader("spell_icc_shattered_bones") { }
class spell_icc_shattered_bones_SpellScript : public SpellScript
void Register() override
{
PrepareSpellScript(spell_icc_shattered_bones_SpellScript);
void HandleDummy()
{
for (uint8 i = 0; i < 10; ++i)
GetCaster()->CastSpell((Unit*)nullptr, 70963, true);
}
void Register() override
{
AfterCast += SpellCastFn(spell_icc_shattered_bones_SpellScript::HandleDummy);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_icc_shattered_bones_SpellScript();
AfterCast += SpellCastFn(spell_icc_shattered_bones::HandleDummy);
}
};
@@ -3780,28 +3660,29 @@ void AddSC_icecrown_citadel()
new npc_frostwing_vrykul();
new npc_impaling_spear();
new npc_arthas_teleport_visual();
new spell_icc_stoneform();
new spell_icc_sprit_alarm();
new spell_icc_geist_alarm();
new spell_frost_giant_death_plague();
new spell_icc_harvest_blight_specimen();
new spell_trigger_spell_from_caster("spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL);
new spell_svalna_revive_champion();
new spell_svalna_remove_spear();
new spell_icc_soul_missile();
RegisterSpellScript(spell_icc_stoneform_aura);
RegisterSpellScript(spell_icc_sprit_alarm);
RegisterSpellScript(spell_icc_geist_alarm);
RegisterSpellScript(spell_frost_giant_death_plague);
RegisterSpellScript(spell_icc_harvest_blight_specimen);
RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL);
RegisterSpellScript(spell_svalna_revive_champion);
RegisterSpellScript(spell_svalna_remove_spear);
RegisterSpellScript(spell_icc_soul_missile);
new at_icc_saurfang_portal();
new at_icc_shutdown_traps();
new at_icc_start_blood_quickening();
new at_icc_start_frostwing_gauntlet();
// pussywizard below:
new spell_icc_web_wrap();
new spell_icc_dark_reckoning();
new spell_stinky_precious_decimate();
new spell_icc_yf_frozen_orb();
new spell_icc_yh_volley();
new spell_icc_yd_summon_undead();
new spell_icc_shattered_bones();
RegisterSpellScript(spell_icc_web_wrap_aura);
RegisterSpellScript(spell_icc_dark_reckoning_aura);
RegisterSpellScript(spell_stinky_precious_decimate);
RegisterSpellScript(spell_icc_yf_frozen_orb_aura);
RegisterSpellScript(spell_icc_yh_volley_aura);
RegisterSpellScript(spell_icc_yd_summon_undead);
RegisterSpellScript(spell_icc_shattered_bones);
new npc_icc_skybreaker_hierophant();
new npc_icc_skybreaker_marksman();
new npc_icc_skybreaker_vicar();

View File

@@ -591,39 +591,26 @@ enum ItemIds
ITEM_GOBLIN_ROCKET_PACK = 49278
};
class spell_trigger_spell_from_caster : public SpellScriptLoader
class spell_trigger_spell_from_caster : public SpellScript
{
PrepareSpellScript(spell_trigger_spell_from_caster);
public:
spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId) : SpellScriptLoader(scriptName), _triggerId(triggerId) { }
spell_trigger_spell_from_caster(uint32 triggerId) : SpellScript(), _triggerId(triggerId) { }
class spell_trigger_spell_from_caster_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript);
return ValidateSpellInfo({ _triggerId });
}
public:
spell_trigger_spell_from_caster_SpellScript(uint32 triggerId) : SpellScript(), _triggerId(triggerId) { }
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ _triggerId });
}
void HandleTrigger()
{
GetCaster()->CastSpell(GetHitUnit(), _triggerId, true);
}
void Register() override
{
AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger);
}
uint32 _triggerId;
};
SpellScript* GetSpellScript() const override
void HandleTrigger()
{
return new spell_trigger_spell_from_caster_SpellScript(_triggerId);
GetCaster()->CastSpell(GetHitUnit(), _triggerId, true);
}
void Register() override
{
AfterHit += SpellHitFn(spell_trigger_spell_from_caster::HandleTrigger);
}
private: