Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-06-28 18:36:45 +08:00
57 changed files with 1524 additions and 1417 deletions

View File

@@ -303,43 +303,32 @@ public:
}
};
class spell_egg_event : public SpellScriptLoader
class spell_egg_event : public SpellScript
{
public:
spell_egg_event() : SpellScriptLoader("spell_egg_event") { }
PrepareSpellScript(spell_egg_event);
class spell_egg_eventSpellScript : public SpellScript
void HandleOnHit()
{
PrepareSpellScript(spell_egg_eventSpellScript);
void HandleOnHit()
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
instance->SetData(DATA_EGG_EVENT, SPECIAL);
}
if (Creature* razorgore = GetCaster()->ToCreature())
{
if (GameObject* egg = GetHitGObj())
{
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
egg->SetLootState(GO_READY);
egg->UseDoorOrButton(10000);
egg->SetRespawnTime(WEEK);
}
}
instance->SetData(DATA_EGG_EVENT, SPECIAL);
}
void Register() override
if (Creature* razorgore = GetCaster()->ToCreature())
{
OnHit += SpellHitFn(spell_egg_eventSpellScript::HandleOnHit);
if (GameObject* egg = GetHitGObj())
{
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
egg->SetLootState(GO_READY);
egg->UseDoorOrButton(10000);
egg->SetRespawnTime(WEEK);
}
}
};
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_egg_eventSpellScript();
OnHit += SpellHitFn(spell_egg_event::HandleOnHit);
}
};
@@ -347,6 +336,6 @@ void AddSC_boss_razorgore()
{
new boss_razorgore();
new go_orb_of_domination();
new spell_egg_event();
RegisterSpellScript(spell_egg_event);
}

View File

@@ -478,37 +478,26 @@ enum ShadowFlame
};
// 22539 - Shadowflame (used in Blackwing Lair)
class spell_bwl_shadowflame : public SpellScriptLoader
class spell_bwl_shadowflame : public SpellScript
{
public:
spell_bwl_shadowflame() : SpellScriptLoader("spell_bwl_shadowflame") { }
PrepareSpellScript(spell_bwl_shadowflame);
class spell_bwl_shadowflame_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_bwl_shadowflame_SpellScript);
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
}
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
if (Unit* victim = GetHitUnit())
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
return new spell_bwl_shadowflame_SpellScript;
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
if (Unit* victim = GetHitUnit())
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
@@ -539,7 +528,7 @@ public:
void AddSC_instance_blackwing_lair()
{
new instance_blackwing_lair();
new spell_bwl_shadowflame();
RegisterSpellScript(spell_bwl_shadowflame);
new at_orb_of_command();
}

View File

@@ -128,118 +128,96 @@ public:
};
// 19695 Inferno
class spell_geddon_inferno : public SpellScriptLoader
class spell_geddon_inferno_aura : public AuraScript
{
public:
spell_geddon_inferno() : SpellScriptLoader("spell_geddon_inferno") { }
PrepareAuraScript(spell_geddon_inferno_aura);
class spell_geddon_inferno_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_geddon_inferno_AuraScript);
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
}
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* caster = GetUnitOwner())
{
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
int32 multiplier = 1;
switch (aurEff->GetTickNumber())
{
case 3:
case 4:
multiplier = 2;
break;
case 5:
case 6:
multiplier = 4;
break;
case 7:
multiplier = 6;
break;
case 8:
multiplier = 10;
break;
}
caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_AuraScript::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_AuraScript::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_geddon_inferno_AuraScript();
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* caster = GetUnitOwner())
{
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
int32 multiplier = 1;
switch (aurEff->GetTickNumber())
{
case 3:
case 4:
multiplier = 2;
break;
case 5:
case 6:
multiplier = 4;
break;
case 7:
multiplier = 6;
break;
case 8:
multiplier = 10;
break;
}
caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_aura::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_aura::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 20478 Armageddon
class spell_geddon_armageddon : public SpellScriptLoader
class spell_geddon_armageddon_aura : public AuraScript
{
public:
spell_geddon_armageddon() : SpellScriptLoader("spell_geddon_armageddon") { }
PrepareAuraScript(spell_geddon_armageddon_aura);
class spell_geddon_armageddon_AuraScript : public AuraScript
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_geddon_armageddon_AuraScript);
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_AuraScript::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_AuraScript::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_geddon_armageddon_AuraScript();
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_aura::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_aura::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -248,7 +226,7 @@ void AddSC_boss_baron_geddon()
new boss_baron_geddon();
// Spells
new spell_geddon_inferno();
new spell_geddon_armageddon();
RegisterSpellScript(spell_geddon_inferno_aura);
RegisterSpellScript(spell_geddon_armageddon_aura);
}

View File

@@ -172,75 +172,52 @@ public:
};
// 23487 Separation Anxiety (server side)
class spell_garr_separation_nexiety : public SpellScriptLoader
class spell_garr_separation_anxiety_aura : public AuraScript
{
public:
spell_garr_separation_nexiety() : SpellScriptLoader("spell_garr_separation_nexiety") {}
PrepareAuraScript(spell_garr_separation_anxiety_aura);
class spell_garr_separation_nexiety_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_garr_separation_nexiety_AuraScript);
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
}
void HandlePeriodic(AuraEffect const* aurEff)
{
Unit const* caster = GetCaster();
Unit* target = GetTarget();
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
{
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// Should return a fully valid AuraScript pointer.
AuraScript* GetAuraScript() const override
void HandlePeriodic(AuraEffect const* aurEff)
{
return new spell_garr_separation_nexiety_AuraScript();
Unit const* caster = GetCaster();
Unit* target = GetTarget();
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
{
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
//19515 Frenzy (SERVERSIDE)
class spell_garr_frenzy : public SpellScriptLoader
class spell_garr_frenzy : public SpellScript
{
public:
spell_garr_frenzy() : SpellScriptLoader("spell_garr_frenzy") {}
PrepareSpellScript(spell_garr_frenzy);
class spell_garr_frenzy_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_garr_frenzy_SpellScript);
return ValidateSpellInfo({ SPELL_FRENZY });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_FRENZY });
}
void HandleHit(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_FRENZY);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleHit(SpellEffIndex /*effIndex*/)
{
return new spell_garr_frenzy_SpellScript();
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_FRENZY);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -250,7 +227,7 @@ void AddSC_boss_garr()
new npc_garr_firesworn();
// Spells
new spell_garr_separation_nexiety();
new spell_garr_frenzy();
RegisterSpellScript(spell_garr_separation_anxiety_aura);
RegisterSpellScript(spell_garr_frenzy);
}

View File

@@ -119,55 +119,44 @@ public:
// 19411 Lava Bomb
// 20474 Lava Bomb
class spell_magmadar_lava_bomb : public SpellScriptLoader
class spell_magmadar_lava_bomb : public SpellScript
{
public:
spell_magmadar_lava_bomb() : SpellScriptLoader("spell_magmadar_lava_bomb") {}
PrepareSpellScript(spell_magmadar_lava_bomb);
class spell_magmadar_lava_bomb_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_magmadar_lava_bomb_SpellScript);
return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
uint32 spellId = 0;
switch (m_scriptSpellId)
{
uint32 spellId = 0;
switch (m_scriptSpellId)
case SPELL_LAVA_BOMB:
{
case SPELL_LAVA_BOMB:
{
spellId = SPELL_LAVA_BOMB_EFFECT;
break;
}
case SPELL_LAVA_BOMB_RANGED:
{
spellId = SPELL_LAVA_BOMB_RANGED_EFFECT;
break;
}
default:
{
return;
}
spellId = SPELL_LAVA_BOMB_EFFECT;
break;
}
case SPELL_LAVA_BOMB_RANGED:
{
spellId = SPELL_LAVA_BOMB_RANGED_EFFECT;
break;
}
default:
{
return;
}
target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID());
}
target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID());
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_magmadar_lava_bomb_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -176,6 +165,6 @@ void AddSC_boss_magmadar()
new boss_magmadar();
// Spells
new spell_magmadar_lava_bomb();
RegisterSpellScript(spell_magmadar_lava_bomb);
}

View File

@@ -581,108 +581,74 @@ public:
};
// 20538 Hate to Zero (SERVERSIDE)
class spell_hate_to_zero : public SpellScriptLoader
class spell_hate_to_zero : public SpellScript
{
public:
spell_hate_to_zero() : SpellScriptLoader("spell_hate_to_zero") {}
PrepareSpellScript(spell_hate_to_zero);
class spell_hate_to_zero_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_hate_to_zero_SpellScript);
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
bool Load() override
void HandleHit(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleHit(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (Creature* creatureCaster = caster->ToCreature())
{
if (Creature* creatureCaster = caster->ToCreature())
{
creatureCaster->GetThreatMgr().ResetAllThreat();
}
creatureCaster->GetThreatMgr().ResetAllThreat();
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_hate_to_zero_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 21094 Separation Anxiety (server side)
class spell_majordomo_separation_nexiety : public SpellScriptLoader
class spell_majordomo_separation_anxiety_aura : public AuraScript
{
public:
spell_majordomo_separation_nexiety() : SpellScriptLoader("spell_majordomo_separation_nexiety") {}
PrepareAuraScript(spell_majordomo_separation_anxiety_aura);
class spell_majordomo_separation_nexiety_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_majordomo_separation_nexiety_AuraScript);
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
}
void HandlePeriodic(AuraEffect const* aurEff)
{
Unit const* caster = GetCaster();
Unit* target = GetTarget();
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
{
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// Should return a fully valid AuraScript pointer.
AuraScript* GetAuraScript() const override
void HandlePeriodic(AuraEffect const* aurEff)
{
return new spell_majordomo_separation_nexiety_AuraScript();
Unit const* caster = GetCaster();
Unit* target = GetTarget();
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
{
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 19774 Summon Ragnaros
class spell_summon_ragnaros : public SpellScriptLoader
class spell_summon_ragnaros : public SpellScript
{
public:
spell_summon_ragnaros() : SpellScriptLoader("spell_summon_ragnaros") {}
PrepareSpellScript(spell_summon_ragnaros);
class spell_summon_ragnaros_SpellScript : public SpellScript
void HandleHit()
{
PrepareSpellScript(spell_summon_ragnaros_SpellScript);
void HandleHit()
if (Unit* caster = GetCaster())
{
if (Unit* caster = GetCaster())
{
caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS);
}
caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS);
}
}
void Register() override
{
AfterCast += SpellCastFn(spell_summon_ragnaros_SpellScript::HandleHit);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_summon_ragnaros_SpellScript();
AfterCast += SpellCastFn(spell_summon_ragnaros::HandleHit);
}
};
@@ -691,8 +657,8 @@ void AddSC_boss_majordomo()
new boss_majordomo();
// Spells
new spell_hate_to_zero();
new spell_majordomo_separation_nexiety();
new spell_summon_ragnaros();
RegisterSpellScript(spell_hate_to_zero);
RegisterSpellScript(spell_majordomo_separation_anxiety_aura);
RegisterSpellScript(spell_summon_ragnaros);
}

View File

@@ -109,85 +109,74 @@ public:
};
// 23138 - Gate of Shazzrah
class spell_shazzrah_gate_dummy : public SpellScriptLoader
class spell_shazzrah_gate_dummy : public SpellScript
{
public:
spell_shazzrah_gate_dummy() : SpellScriptLoader("spell_shazzrah_gate_dummy") {}
PrepareSpellScript(spell_shazzrah_gate_dummy);
class spell_shazzrah_gate_dummy_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_shazzrah_gate_dummy_SpellScript);
return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
void FilterTargets(std::list<WorldObject*>& targets)
{
Unit* caster = GetCaster();
if (!targets.empty())
{
return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE });
}
void FilterTargets(std::list<WorldObject*>& targets)
{
Unit* caster = GetCaster();
if (!targets.empty())
targets.remove_if([caster](WorldObject const* target) -> bool
{
targets.remove_if([caster](WorldObject const* target) -> bool
Player const* plrTarget = target->ToPlayer();
// Should not target non player targets
if (!plrTarget)
{
Player const* plrTarget = target->ToPlayer();
// Should not target non player targets
if (!plrTarget)
{
return true;
}
// Should skip current victim
if (caster->GetVictim() == plrTarget)
{
return true;
}
// Should not target enemies within melee range
if (plrTarget->IsWithinMeleeRange(caster))
{
return true;
}
return false;
});
}
if (!targets.empty())
{
Acore::Containers::RandomResize(targets, 1);
}
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (caster && target)
{
target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true);
caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION);
if (Creature* creatureCaster = caster->ToCreature())
{
creatureCaster->GetThreatMgr().ResetAllThreat();
creatureCaster->GetThreatMgr().AddThreat(target, 1);
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
return true;
}
// Should skip current victim
if (caster->GetVictim() == plrTarget)
{
return true;
}
// Should not target enemies within melee range
if (plrTarget->IsWithinMeleeRange(caster))
{
return true;
}
return false;
});
}
if (!targets.empty())
{
Acore::Containers::RandomResize(targets, 1);
}
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (caster && target)
{
target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true);
caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION);
if (Creature* creatureCaster = caster->ToCreature())
{
creatureCaster->GetThreatMgr().ResetAllThreat();
creatureCaster->GetThreatMgr().AddThreat(target, 1);
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
}
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_shazzrah_gate_dummy_SpellScript();
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -196,6 +185,6 @@ void AddSC_boss_shazzrah()
new boss_shazzrah();
// Spells
new spell_shazzrah_gate_dummy();
RegisterSpellScript(spell_shazzrah_gate_dummy);
}

View File

@@ -118,101 +118,95 @@ public:
};
// 19822 Play Dead
class spell_mc_play_dead : public SpellScriptLoader
class spell_mc_play_dead_aura : public AuraScript
{
public:
spell_mc_play_dead() : SpellScriptLoader("spell_mc_play_dead") { }
PrepareAuraScript(spell_mc_play_dead_aura);
class spell_mc_play_dead_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_mc_play_dead_AuraScript);
return ValidateSpellInfo({ SPELL_PLAY_DEAD_PACIFY, SPELL_PLAY_DEAD });
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* creatureTarget = GetTarget()->ToCreature();
if (!creatureTarget)
{
return;
}
creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetReactState(REACT_PASSIVE);
creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
creatureTarget->AttackStop();
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* creatureTarget = GetTarget()->ToCreature();
if (!creatureTarget)
{
return;
}
creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY);
creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
creatureTarget->SetReactState(REACT_AGGRESSIVE);
if (!creatureTarget->IsInCombat())
{
return;
}
bool shouldDie = true;
std::list<Creature*> hounds;
creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND);
// Perform lambda based check to find if there is any nearby
if (!hounds.empty())
{
// Alive hound been found within 80 yards -> cancel suicide
if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound)
{
return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD);
}) != hounds.end())
{
shouldDie = false;
}
}
if (!shouldDie)
{
if (CreatureAI* targetAI = creatureTarget->AI())
{
targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true);
targetAI->DoCastSelf(SPELL_FULL_HEALTH, true);
targetAI->Talk(EMOTE_IGNITE);
}
}
else
{
Unit::Kill(creatureTarget, creatureTarget);
creatureTarget->DespawnOrUnsummon(14000);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
bool Load() override
{
return new spell_mc_play_dead_AuraScript();
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* creatureTarget = GetTarget()->ToCreature();
if (!creatureTarget)
{
return;
}
creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetReactState(REACT_PASSIVE);
creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
creatureTarget->AttackStop();
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* creatureTarget = GetTarget()->ToCreature();
if (!creatureTarget)
{
return;
}
creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY);
creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
creatureTarget->SetReactState(REACT_AGGRESSIVE);
if (!creatureTarget->IsInCombat())
{
return;
}
bool shouldDie = true;
std::list<Creature*> hounds;
creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND);
// Perform lambda based check to find if there is any nearby
if (!hounds.empty())
{
// Alive hound been found within 80 yards -> cancel suicide
if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound)
{
return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD);
}) != hounds.end())
{
shouldDie = false;
}
}
if (!shouldDie)
{
if (CreatureAI* targetAI = creatureTarget->AI())
{
targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true);
targetAI->DoCastSelf(SPELL_FULL_HEALTH, true);
targetAI->Talk(EMOTE_IGNITE);
}
}
else
{
Unit::Kill(creatureTarget, creatureTarget);
creatureTarget->DespawnOrUnsummon(14000);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -272,6 +266,6 @@ void AddSC_molten_core()
RegisterCreatureAI(npc_lava_spawn);
// Spells
new spell_mc_play_dead();
RegisterSpellScript(spell_mc_play_dead_aura);
}

View File

@@ -144,8 +144,6 @@ struct boss_netherspite : public BossAI
if (p && p->IsAlive() // alive
&& (!target || target->GetDistance2d(portal) > p->GetDistance2d(portal)) // closer than current best
&& !p->HasAura(PlayerDebuff[j]) // not exhausted
&& !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam
&& !p->HasAura(PlayerBuff[(j + 2) % 3])
&& IsBetween(me, p, portal)) // on the beam
target = p;
}
@@ -296,6 +294,7 @@ struct boss_netherspite : public BossAI
{
BossAI::JustDied(killer);
HandleDoors(true);
DestroyPortals();
}
void UpdateAI(uint32 diff) override

View File

@@ -20,22 +20,23 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "TaskScheduler.h"
#include "PassiveAI.h"
#include "karazhan.h"
enum Spells
{
// phase 1
// Ground Phase
SPELL_RAIN_OF_BONES = 37098,
SPELL_SMOKING_BLAST = 37057,
SPELL_FIREBALL_BARRAGE = 30282,
SPELL_SEARING_CINDERS = 30127,
// Air Phase
SPELL_BELLOWING_ROAR = 39427,
SPELL_CLEAVE = 30131,
SPELL_CHARRED_EARTH = 30129,
SPELL_DISTRACTING_ASH = 30130,
SPELL_SMOLDERING_BREATH = 30210,
SPELL_TAIL_SWEEP = 25653,
// phase 2
SPELL_RAIN_OF_BONES = 37098,
SPELL_SMOKING_BLAST = 37057,
SPELL_FIREBALL_BARRAGE = 30282,
SPELL_SEARING_CINDERS = 30127,
SPELL_SUMMON_SKELETON = 30170
};
@@ -43,20 +44,45 @@ enum Says
{
EMOTE_SUMMON = 0,
YELL_AGGRO = 1,
YELL_FLY_PHASE = 2,
YELL_AIR_PHASE = 2,
YELL_LAND_PHASE = 3,
EMOTE_BREATH = 4
};
enum Groups
enum Actions
{
ACTION_START_INTRO = 0
};
enum Phases
{
PHASE_INTRO = 0,
PHASE_GROUND = 1,
PHASE_FLY = 2,
PHASE_TRANSITION = 3,
};
enum Groups
{
GROUP_GROUND = 0,
GROUP_FLYING = 1
};
GROUP_AIR = 1,
GROUP_LAND = 2
};
enum Points
{
POINT_DESPAWN = 10 // Other points used dynamically throughout the script
POINT_INTRO_TAKE_OFF = 11,
POINT_INTRO_PRE_LAND = 8,
POINT_INTRO_LAND = 12,
POINT_PRE_FLY_EAST = 21,
POINT_PRE_FLY_SOUTH = 22,
POINT_PRE_FLY_WEST = 23,
POINT_PRE_FLY = 24,
POINT_FLY = 31,
POINT_LANDING_PRE = 41,
POINT_LANDING_WEST = 42,
POINT_PRE_LAND = 5,
POINT_LAND = 51,
};
float IntroWay[8][3] =
@@ -71,13 +97,20 @@ float IntroWay[8][3] =
{-11163.00f, -1903.00f, 91.473f}
}; //TODO: move to table
Position const homePos = {-11003.7f, -1760.19f, 140.253f};
Position const introLandPos = {-11142.712f, -1891.193f, 92.25038f};
Position const preFlySouthPos = {-11193.77f, -1921.983f, 107.9845f};
Position const preFlyEastPos = {-11167.065f, -1976.3473f, 109.91183f};
Position const preFlyWestPos = {-11095.48f, -1866.5396f, 107.868996};
Position const preFlyPos = {-11154.900391f, -1850.670044f, 103.264999f};
Position const flyPos = {-11160.125f, -1870.683f, 97.73876f};
Position const landPos = {-11162.231f, -1900.3287f, 91.47627f};
struct boss_nightbane : public BossAI
{
boss_nightbane(Creature* creature) : BossAI(creature, DATA_NIGHTBANE)
{
_intro = true;
_skeletonCount = 5;
_movePhase = 0;
}
void Reset() override
@@ -85,33 +118,37 @@ struct boss_nightbane : public BossAI
BossAI::Reset();
_skeletonscheduler.CancelAll();
me->SetSpeed(MOVE_RUN, 2.0f);
me->SetDisableGravity(_intro);
me->SetWalk(false);
me->setActive(true);
_triggerCountTakeOffWhileFlying = 0;
_airPhasesCompleted = 0;
_flying = false;
_movement = false;
_intro = true;
Phase = 1;
_movePhase = 0;
me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run);
me->SetCanFly(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
ScheduleHealthCheckEvent({ 75, 50, 25 }, [&]{
TakeOff();
TriggerHealthTakeOff();
});
}
void JustReachedHome() override
{
BossAI::JustReachedHome();
me->DespawnOnEvade();
}
void EnterEvadeMode(EvadeReason why) override
{
BossAI::EnterEvadeMode(why);
me->SetHomePosition(homePos);
me->SetCanFly(true);
me->SetDisableGravity(true);
me->SendMovementFlagUpdate();
me->GetMotionMaster()->MoveTakeoff(POINT_DESPAWN, -11013.246f, -1770.5212f, 166.50139f);
BossAI::EnterEvadeMode(why);
}
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageEffectType, SpellSchoolMask spellSchoolMask) override
{
if (_flying || Phase == 2)
if (_airPhasesCompleted < 3)
{
if (damage >= me->GetHealth())
{
@@ -124,12 +161,31 @@ struct boss_nightbane : public BossAI
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
_intro = false;
Talk(YELL_AGGRO);
ScheduleGround();
}
void DoAction(int32 action) override
{
if (action == ACTION_START_INTRO)
{
me->GetMap()->LoadGrid(-11260.0f, -1771.0f); // load grid at far end of intro path
me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE + 100.0f); // see nightbane
me->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);
_phase = PHASE_INTRO;
Talk(EMOTE_SUMMON);
scheduler.Schedule(2s, [this](TaskContext /*context*/)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetDisableGravity(true);
me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f);
}).Schedule(4s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePath(me->GetEntry()*10, false);
});
}
}
void ScheduleGround()
{
scheduler.Schedule(30s, GROUP_GROUND, [this](TaskContext context)
@@ -169,12 +225,13 @@ struct boss_nightbane : public BossAI
{
_skeletonSpawnCounter = 0;
scheduler.Schedule(2s, GROUP_FLYING, [this](TaskContext)
scheduler.Schedule(2s, GROUP_AIR, [this](TaskContext)
{
DoResetThreatList();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f))
{
_skeletonSpawnPos = target->GetPosition();
me->SetFacingTo(_skeletonSpawnPos.GetOrientation());
me->CastSpell(_skeletonSpawnPos.GetPositionX(), _skeletonSpawnPos.GetPositionY(), _skeletonSpawnPos.GetPositionZ(), SPELL_RAIN_OF_BONES, true);
_skeletonscheduler.Schedule(50ms, [this](TaskContext context)
{
@@ -187,18 +244,23 @@ struct boss_nightbane : public BossAI
}
});
}
}).Schedule(20s, GROUP_FLYING, [this](TaskContext context)
}).Schedule(20s, GROUP_AIR, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_DISTRACTING_ASH);
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
{
me->SetFacingToObject(target);
DoCast(target, SPELL_DISTRACTING_ASH);
}
context.Repeat(2s); //timer wrong?
}).Schedule(25s, GROUP_FLYING, [this](TaskContext context)
}).Schedule(25s, GROUP_AIR, [this](TaskContext context)
{
//5 seconds added due to double trigger?
//trigger for timer in original + in rain of bones
//timers need some investigation
me->SetFacingToObject(me->GetVictim());
DoCastVictim(SPELL_SMOKING_BLAST);
context.Repeat(1500ms); //timer wrong?
}).Schedule(13s, GROUP_FLYING, [this](TaskContext context)
}).Schedule(13s, GROUP_AIR, [this](TaskContext context)
{
DoCastOnFarAwayPlayers(SPELL_FIREBALL_BARRAGE, false, 80.0f);
context.Repeat(20s);
@@ -207,58 +269,135 @@ struct boss_nightbane : public BossAI
void AttackStart(Unit* who) override
{
if (!_intro && !_flying)
if (_phase == PHASE_GROUND)
ScriptedAI::AttackStart(who);
}
void MoveInLineOfSight(Unit* who) override
{
if (!_intro && !_flying)
if (_phase == PHASE_GROUND)
ScriptedAI::MoveInLineOfSight(who);
}
void PathEndReached(uint32 pathId) override
{
BossAI::PathEndReached(pathId);
if (pathId == me->GetEntry()*10) // intro
{
me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE); // restore visibility
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->ClearUnitState(UNIT_STATE_IGNORE_PATHFINDING);
me->GetMotionMaster()->MovePoint(POINT_INTRO_LAND, introLandPos);
me->SetSpeed(MOVE_RUN, 2.0f);
}).Schedule(3s, [this](TaskContext /*context*/)
{
me->SetDisableGravity(false);
me->SetCanFly(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
_phase = PHASE_GROUND;
me->SetReactState(REACT_AGGRESSIVE);
me->SetInCombatWithZone();
}).Schedule(8s, [this](TaskContext /*context*/)
{
if (!SelectTargetFromPlayerList(45.0f))
{
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
}
});
}
else if (pathId == me->GetEntry()*10+1) // landing
{
_airPhasesCompleted++;
if (_triggerCountTakeOffWhileFlying > 0)
{
_triggerCountTakeOffWhileFlying--;
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, preFlySouthPos);
});
}
else
{
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
DoResetThreatList();
me->GetMotionMaster()->MovePoint(POINT_LAND, landPos);
me->SetDisableGravity(false);
me->SetCanFly(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
_phase = PHASE_GROUND;
ScheduleGround();
});
}
}
}
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE)
return;
if (id == POINT_DESPAWN)
switch (id)
{
me->DespawnOnEvade();
}
if (_intro)
{
if (id >= 8)
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->SetInCombatWithZone();
return;
}
_movePhase = id + 1;
return;
}
if (_flying)
{
if (id == 0)
{
case POINT_INTRO_TAKE_OFF:
break;
case POINT_INTRO_LAND:
DoStartMovement(me->GetVictim());
break;
case POINT_PRE_FLY_EAST:
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, preFlySouthPos);
});
break;
case POINT_PRE_FLY_SOUTH:
case POINT_PRE_FLY_WEST:
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, preFlyPos);
});
break;
case POINT_PRE_FLY:
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_FLY, flyPos);
});
break;
case POINT_FLY:
_phase = PHASE_FLY;
Talk(EMOTE_BREATH);
_flying = false;
Phase = 2;
return;
}
if (id < 8)
_movePhase = id + 1;
else
{
Phase = 1;
_flying = false;
_movement = true;
return;
}
ScheduleFly();
ScheduleLand();
break;
case POINT_LANDING_PRE:
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_LANDING_WEST, preFlyWestPos);
});
break;
case POINT_LANDING_WEST:
if (_triggerCountTakeOffWhileFlying > 0)
{
_airPhasesCompleted++;
_triggerCountTakeOffWhileFlying--;
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, preFlyPos);
});
}
else
{
scheduler.Schedule(0s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false);
});
}
break;
case POINT_LAND:
DoStartMovement(me->GetVictim());
break;
}
}
@@ -284,107 +423,79 @@ struct boss_nightbane : public BossAI
}
}
void TakeOff()
void TriggerHealthTakeOff()
{
Talk(YELL_FLY_PHASE);
if (_phase != PHASE_GROUND)
{
_triggerCountTakeOffWhileFlying++;
return;
}
_phase = PHASE_TRANSITION;
Talk(YELL_AIR_PHASE);
scheduler.CancelGroup(GROUP_GROUND);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->SetDisableGravity(true);
me->SetCanFly(true);
me->SendMovementFlagUpdate();
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
FlyToClosestPreFlyWayPoint();
}
void FlyToClosestPreFlyWayPoint()
{
Position closestWP = preFlyPos;
if (me->GetDistance(preFlyEastPos) < me->GetDistance(closestWP))
closestWP = preFlyEastPos;
if (me->GetDistance(preFlySouthPos) < me->GetDistance(closestWP))
closestWP = preFlySouthPos;
if (me->GetDistance(preFlyWestPos) < me->GetDistance(closestWP))
closestWP = preFlyWestPos;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(0, IntroWay[2][0], IntroWay[2][1], IntroWay[2][2]);
if (closestWP == preFlyPos)
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, closestWP);
else if (closestWP == preFlyEastPos)
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_EAST, closestWP);
else if (closestWP == preFlySouthPos)
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, closestWP);
else if (closestWP == preFlyWestPos)
me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_WEST, closestWP);
}
_flying = true;
ScheduleFly();
//handle landing again
scheduler.Schedule(45s, 60s, [this](TaskContext)
void ScheduleLand()
{
scheduler.Schedule(30s, GROUP_LAND, [this](TaskContext) /*context*/
{
Talk(YELL_LAND_PHASE);
scheduler.CancelGroup(GROUP_AIR);
_phase = PHASE_TRANSITION;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(3, IntroWay[3][0], IntroWay[3][1], IntroWay[3][2]);
_flying = true;
scheduler.CancelGroup(GROUP_FLYING);
scheduler.Schedule(2s, [this](TaskContext)
{
ScheduleGround();
});
me->GetMotionMaster()->MovePoint(POINT_LANDING_PRE, preFlyPos);
});
}
void UpdateAI(uint32 diff) override
{
if (_intro)
{
if (_movePhase)
{
if (_movePhase >= 7)
{
me->SetDisableGravity(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
}
else
{
me->GetMotionMaster()->MovePoint(_movePhase, IntroWay[_movePhase][0], IntroWay[_movePhase][1], IntroWay[_movePhase][2]);
}
_movePhase = 0;
}
return;
}
if (_flying && _movePhase)
{
if (_movePhase >= 7)
{
me->SetDisableGravity(false);
DoResetThreatList();
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
}
else
me->GetMotionMaster()->MovePoint(_movePhase, IntroWay[_movePhase][0], IntroWay[_movePhase][1], IntroWay[_movePhase][2]);
_movePhase = 0;
}
scheduler.Update(diff);
_skeletonscheduler.Update(diff);
if (!UpdateVictim())
return;
if (_flying)
return;
scheduler.Update(diff);
_skeletonscheduler.Update(diff);
// Phase 1 "GROUND FIGHT"
if (Phase == 1)
if (_phase == PHASE_GROUND)
{
if (_movement)
{
DoStartMovement(me->GetVictim());
_movement = false;
}
DoMeleeAttackIfReady();
}
}
private:
uint32 Phase;
uint8 _phase;
uint8 _airPhasesCompleted;
uint8 _triggerCountTakeOffWhileFlying;
TaskScheduler _skeletonscheduler;
bool _intro;
bool _flying;
bool _movement;
uint32 _movePhase;
uint8 _skeletonCount;
uint8 _skeletonSpawnCounter;
Position _skeletonSpawnPos;
@@ -399,22 +510,31 @@ public:
{
if (InstanceScript* instance = go->GetInstanceScript())
{
if (instance->GetData(DATA_NIGHTBANE) != DONE && !go->FindNearestCreature(NPC_NIGHTBANE, 40.0f))
// if (instance->GetBossState(DATA_NIGHTBANE) == NOT_STARTED || instance->GetBossState(DATA_NIGHTBANE) == FAIL)
if (instance->GetBossState(DATA_NIGHTBANE) == NOT_STARTED)
{
if (Creature* nightbane = instance->GetCreature(DATA_NIGHTBANE))
{
nightbane->GetMotionMaster()->MovePoint(0, IntroWay[0][0], IntroWay[0][1], IntroWay[0][2]);
nightbane->AI()->Talk(EMOTE_SUMMON);
if (nightbane->IsAlive())
{
nightbane->AI()->DoAction(ACTION_START_INTRO);
return true;
}
}
}
}
return false;
}
};
struct npc_nightbane_helper_target : public NullCreatureAI
{
npc_nightbane_helper_target(Creature* creature) : NullCreatureAI(creature) { me->SetDisableGravity(true); }
};
void AddSC_boss_nightbane()
{
RegisterKarazhanCreatureAI(boss_nightbane);
new go_blackened_urn();
RegisterKarazhanCreatureAI(npc_nightbane_helper_target);
}

View File

@@ -528,103 +528,85 @@ public:
};
};
class spell_karazhan_brittle_bones : public SpellScriptLoader
class spell_karazhan_brittle_bones_aura : public AuraScript
{
public:
spell_karazhan_brittle_bones() : SpellScriptLoader("spell_karazhan_brittle_bones") { }
PrepareAuraScript(spell_karazhan_brittle_bones_aura);
class spell_karazhan_brittle_bones_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_karazhan_brittle_bones_AuraScript);
return ValidateSpellInfo({ SPELL_RATTLED });
}
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = 5000;
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (roll_chance_i(35))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true);
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
{
return new spell_karazhan_brittle_bones_AuraScript();
isPeriodic = true;
amplitude = 5000;
}
void Update(AuraEffect const* /*effect*/)
{
PreventDefaultAction();
if (roll_chance_i(35))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true);
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_aura::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_aura::Update, EFFECT_0, SPELL_AURA_DUMMY);
}
};
class spell_karazhan_overload : public SpellScriptLoader
class spell_karazhan_overload_aura : public AuraScript
{
public:
spell_karazhan_overload() : SpellScriptLoader("spell_karazhan_overload") { }
PrepareAuraScript(spell_karazhan_overload_aura);
class spell_karazhan_overload_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_karazhan_overload_AuraScript);
return ValidateSpellInfo({ SPELL_OVERLOAD });
}
void PeriodicTick(AuraEffect const* auraEffect)
{
PreventDefaultAction();
//Should stop at 3200 damage, maybe check needed(?)
GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * pow(2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void PeriodicTick(AuraEffect const* auraEffect)
{
return new spell_karazhan_overload_AuraScript();
PreventDefaultAction();
//Should stop at 3200 damage, maybe check needed(?)
GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * pow(2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_karazhan_blink : public SpellScriptLoader
class spell_karazhan_blink : public SpellScript
{
public:
spell_karazhan_blink() : SpellScriptLoader("spell_karazhan_blink") { }
PrepareSpellScript(spell_karazhan_blink);
class spell_karazhan_blink_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_karazhan_blink_SpellScript);
return ValidateSpellInfo({ SPELL_BLINK });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->GetThreatMgr().ResetAllThreat();
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_BLINK, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_karazhan_blink_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex effIndex)
{
return new spell_karazhan_blink_SpellScript();
PreventHitDefaultEffect(effIndex);
GetCaster()->GetThreatMgr().ResetAllThreat();
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_BLINK, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_karazhan_blink::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
void AddSC_instance_karazhan()
{
new instance_karazhan();
new spell_karazhan_brittle_bones();
new spell_karazhan_overload();
new spell_karazhan_blink();
RegisterSpellScript(spell_karazhan_brittle_bones_aura);
RegisterSpellScript(spell_karazhan_overload_aura);
RegisterSpellScript(spell_karazhan_blink);
}

View File

@@ -161,41 +161,35 @@ public:
};
};
class spell_boss_salramm_steal_flesh : public SpellScriptLoader
class spell_boss_salramm_steal_flesh_aura : public AuraScript
{
public:
spell_boss_salramm_steal_flesh() : SpellScriptLoader("spell_boss_salramm_steal_flesh") { }
PrepareAuraScript(spell_boss_salramm_steal_flesh_aura);
class spell_boss_salramm_steal_flesh_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_boss_salramm_steal_flesh_AuraScript);
return ValidateSpellInfo({ SPELL_STEAL_FLESH_CASTER, SPELL_STEAL_FLESH_TARGET });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
Unit* target = GetUnitOwner();
if (caster)
{
caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true);
caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_boss_salramm_steal_flesh_AuraScript();
Unit* caster = GetCaster();
Unit* target = GetUnitOwner();
if (caster)
{
caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true);
caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true);
}
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_boss_salramm()
{
new boss_salramm();
new spell_boss_salramm_steal_flesh();
RegisterSpellScript(spell_boss_salramm_steal_flesh_aura);
}

View File

@@ -457,86 +457,64 @@ public:
};
// 10247 - Summon Zul'Farrak Zombies
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScript
{
public:
spell_zulfarrak_summon_zulfarrak_zombies() : SpellScriptLoader("spell_zulfarrak_summon_zulfarrak_zombies") { }
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
class spell_zulfarrak_summon_zulfarrak_zombies_SpellScript : public SpellScript
void HandleSummon(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript);
void HandleSummon(SpellEffIndex effIndex)
if (effIndex == EFFECT_0)
{
if (effIndex == EFFECT_0)
{
if (roll_chance_i(30))
{
PreventHitDefaultEffect(effIndex);
return;
}
}
else if (roll_chance_i(40))
if (roll_chance_i(30))
{
PreventHitDefaultEffect(effIndex);
return;
}
}
void Register() override
else if (roll_chance_i(40))
{
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
PreventHitDefaultEffect(effIndex);
return;
}
};
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_zulfarrak_summon_zulfarrak_zombies_SpellScript;
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
}
};
// 10738 - Unlocking
class spell_zulfarrak_unlocking : public SpellScriptLoader
class spell_zulfarrak_unlocking : public SpellScript
{
public:
spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { }
PrepareSpellScript(spell_zulfarrak_unlocking);
class spell_zulfarrak_unlocking_SpellScript : public SpellScript
void HandleOpenLock(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript);
void HandleOpenLock(SpellEffIndex /*effIndex*/)
GameObject* cage = GetHitGObj();
std::list<WorldObject*> cagesList;
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(GetCaster(), cagesList, objects);
Cell::VisitAllObjects(GetCaster(), searcher, 15.0f);
for (std::list<WorldObject*>::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr)
{
GameObject* cage = GetHitGObj();
std::list<WorldObject*> cagesList;
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(GetCaster(), cagesList, objects);
Cell::VisitAllObjects(GetCaster(), searcher, 15.0f);
for (std::list<WorldObject*>::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr)
{
if (GameObject* go = (*itr)->ToGameObject())
if (go->GetDisplayId() == cage->GetDisplayId())
go->UseDoorOrButton(0, false, GetCaster());
}
if (GameObject* go = (*itr)->ToGameObject())
if (go->GetDisplayId() == cage->GetDisplayId())
go->UseDoorOrButton(0, false, GetCaster());
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_zulfarrak_unlocking_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
}
};
void AddSC_instance_zulfarrak()
{
new instance_zulfarrak();
new spell_zulfarrak_summon_zulfarrak_zombies();
new spell_zulfarrak_unlocking();
RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
RegisterSpellScript(spell_zulfarrak_unlocking);
}

View File

@@ -361,90 +361,68 @@ public:
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
class spell_mount_check : public SpellScriptLoader
class spell_mount_check_aura : public AuraScript
{
public:
spell_mount_check() : SpellScriptLoader("spell_mount_check") { }
PrepareAuraScript(spell_mount_check_aura);
class spell_mount_check_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_mount_check_AuraScript)
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* owner = target->GetOwner();
if (!owner)
return;
if (owner->IsMounted() && !target->IsMounted())
{
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
target->Mount(volunteerAI->GetMountId());
}
else if (!owner->IsMounted() && target->IsMounted())
target->Dismount();
target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_mount_check_AuraScript();
Unit* target = GetTarget();
Unit* owner = target->GetOwner();
if (!owner)
return;
if (owner->IsMounted() && !target->IsMounted())
{
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
target->Mount(volunteerAI->GetMountId());
}
else if (!owner->IsMounted() && target->IsMounted())
target->Dismount();
target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_voljin_war_drums : public SpellScriptLoader
class spell_voljin_war_drums : public SpellScript
{
public:
spell_voljin_war_drums() : SpellScriptLoader("spell_voljin_war_drums") { }
PrepareSpellScript(spell_voljin_war_drums);
class spell_voljin_war_drums_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_voljin_war_drums_SpellScript)
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 motivate = 0;
if (target->GetEntry() == NPC_CITIZEN_1)
motivate = SPELL_MOTIVATE_1;
else if (target->GetEntry() == NPC_CITIZEN_2)
motivate = SPELL_MOTIVATE_2;
if (motivate)
caster->CastSpell(target, motivate, false);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_voljin_war_drums_SpellScript();
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 motivate = 0;
if (target->GetEntry() == NPC_CITIZEN_1)
motivate = SPELL_MOTIVATE_1;
else if (target->GetEntry() == NPC_CITIZEN_2)
motivate = SPELL_MOTIVATE_2;
if (motivate)
caster->CastSpell(target, motivate, false);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -460,45 +438,34 @@ enum VoodooSpells
};
// 17009
class spell_voodoo : public SpellScriptLoader
class spell_voodoo : public SpellScript
{
public:
spell_voodoo() : SpellScriptLoader("spell_voodoo") { }
PrepareSpellScript(spell_voodoo);
class spell_voodoo_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_voodoo_SpellScript)
return ValidateSpellInfo(
{
SPELL_BREW,
SPELL_GHOSTLY,
SPELL_HEX1,
SPELL_HEX2,
SPELL_HEX3,
SPELL_GROW,
SPELL_LAUNCH
});
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_BREW,
SPELL_GHOSTLY,
SPELL_HEX1,
SPELL_HEX2,
SPELL_HEX3,
SPELL_GROW,
SPELL_LAUNCH
});
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, spellid, false);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_voodoo_SpellScript();
uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, spellid, false);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voodoo::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -507,8 +474,8 @@ void AddSC_durotar()
new npc_tiger_matriarch_credit();
new npc_tiger_matriarch();
new npc_troll_volunteer();
new spell_mount_check();
new spell_voljin_war_drums();
new spell_voodoo();
RegisterSpellScript(spell_mount_check_aura);
RegisterSpellScript(spell_voljin_war_drums);
RegisterSpellScript(spell_voodoo);
}

View File

@@ -30,135 +30,102 @@ enum SpellScripts
SPELL_ENERGIZED = 42492,
};
class spell_ooze_zap : public SpellScriptLoader
class spell_ooze_zap : public SpellScript
{
public:
spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
PrepareSpellScript(spell_ooze_zap);
class spell_ooze_zap_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_ooze_zap_SpellScript);
return ValidateSpellInfo({ SPELL_OOZE_ZAP });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_OOZE_ZAP });
}
SpellCastResult CheckRequirement()
{
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GetHitUnit())
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement);
}
};
SpellScript* GetSpellScript() const override
SpellCastResult CheckRequirement()
{
return new spell_ooze_zap_SpellScript();
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GetHitUnit())
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_ooze_zap::CheckRequirement);
}
};
class spell_ooze_zap_channel_end : public SpellScriptLoader
class spell_ooze_zap_channel_end : public SpellScript
{
public:
spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
PrepareSpellScript(spell_ooze_zap_channel_end);
class spell_ooze_zap_channel_end_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Player* player = GetCaster()->ToPlayer())
player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
Unit::Kill(GetHitUnit(), GetHitUnit());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex effIndex)
{
return new spell_ooze_zap_channel_end_SpellScript();
PreventHitDefaultEffect(effIndex);
if (Player* player = GetCaster()->ToPlayer())
player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
Unit::Kill(GetHitUnit(), GetHitUnit());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_energize_aoe : public SpellScriptLoader
class spell_energize_aoe : public SpellScript
{
public:
spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
PrepareSpellScript(spell_energize_aoe);
class spell_energize_aoe_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_energize_aoe_SpellScript);
return ValidateSpellInfo({ SPELL_ENERGIZED });
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ENERGIZED });
}
void FilterTargets(std::list<WorldObject*>& targets)
{
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
targets.erase(itr++);
}
targets.push_back(GetCaster());
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
SpellScript* GetSpellScript() const override
void FilterTargets(std::list<WorldObject*>& targets)
{
return new spell_energize_aoe_SpellScript();
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
targets.erase(itr++);
}
targets.push_back(GetCaster());
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
void AddSC_dustwallow_marsh()
{
new spell_ooze_zap();
new spell_ooze_zap_channel_end();
new spell_energize_aoe();
RegisterSpellScript(spell_ooze_zap);
RegisterSpellScript(spell_ooze_zap_channel_end);
RegisterSpellScript(spell_energize_aoe);
}

View File

@@ -33,39 +33,28 @@ enum GordunniTrap
GO_GORDUNNI_DIRT_MOUND = 144064,
};
class spell_gordunni_trap : public SpellScriptLoader
class spell_gordunni_trap : public SpellScript
{
public:
spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { }
PrepareSpellScript(spell_gordunni_trap);
class spell_gordunni_trap_SpellScript : public SpellScript
void HandleDummy()
{
PrepareSpellScript(spell_gordunni_trap_SpellScript);
if (Unit* caster = GetCaster())
if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
{
chest->SetSpellId(GetSpellInfo()->Id);
caster->RemoveGameObject(chest, false);
}
}
void HandleDummy()
{
if (Unit* caster = GetCaster())
if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
{
chest->SetSpellId(GetSpellInfo()->Id);
caster->RemoveGameObject(chest, false);
}
}
void Register() override
{
OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_gordunni_trap_SpellScript();
OnCast += SpellCastFn(spell_gordunni_trap::HandleDummy);
}
};
void AddSC_feralas()
{
new spell_gordunni_trap();
RegisterSpellScript(spell_gordunni_trap);
}

View File

@@ -31,6 +31,7 @@ enum Spells
SPELL_EMERGE = 53500,
SPELL_SUBMERGE = 53421,
SPELL_SELF_ROOT = 42716,
SPELL_CLEAR_ALL_DEBUFFS = 34098,
SPELL_SUMMON_DARTER = 53599,
SPELL_SUMMON_ASSASSIN = 53610,
@@ -193,6 +194,7 @@ class boss_anub_arak : public CreatureScript
if (me->HealthBelowPct(eventId*25))
{
Talk(SAY_SUBMERGE);
DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true);
me->CastSpell(me, SPELL_IMPALE_PERIODIC, true);
me->CastSpell(me, SPELL_SUBMERGE, false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);

View File

@@ -88,6 +88,7 @@ enum AnubSpells
SPELL_SUBMERGE = 65981,
SPELL_EMERGE = 65982,
SPELL_BERSERK = 26662,
SPELL_CLEAR_ALL_DEBUFFS = 34098,
SPELL_FREEZING_SLASH = 66012,
SPELL_PENETRATING_COLD = 66013,
@@ -313,7 +314,7 @@ public:
{
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
bool berserk = me->HasAura(SPELL_BERSERK);
me->RemoveAllAuras();
DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true);
if (berserk)
me->CastSpell(me, SPELL_BERSERK, true);
Talk(EMOTE_SUBMERGE);
@@ -681,7 +682,7 @@ public:
{
me->GetMotionMaster()->MoveIdle();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->RemoveAllAuras();
DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true);
me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true);
me->CastSpell(me, SPELL_SPIDER_FRENZY, true);
me->CastSpell(me, SPELL_SUBMERGE, false);

View File

@@ -235,10 +235,10 @@ struct boss_ahune : public BossAI
switch (eventId)
{
case EVENT_INITIAL_EMERGE:
DoCastSelf(SPELL_BIRTH);
DoCastSelf(SPELL_STAND);
DoCastSelf(SPELL_AHUNE_SPANKY_HANDS);
DoCastSelf(SPELL_AHUNES_SHIELD);
DoCastSelf(SPELL_BIRTH, true);
DoCastSelf(SPELL_STAND, true);
DoCastSelf(SPELL_AHUNE_SPANKY_HANDS, true);
DoCastSelf(SPELL_AHUNES_SHIELD, true);
me->SetStandState(UNIT_STAND_STATE_STAND); // Likely needs to be moved to SPELL_STAND script, forced temporarily
break;
case EVENT_EMERGE:
@@ -248,7 +248,7 @@ struct boss_ahune : public BossAI
if (Creature* frozenCore = instance->GetCreature(DATA_FROZEN_CORE))
DoCast(frozenCore, SPELL_SYNCH_HEALTH, true);
else
DoCastSelf(SPELL_SUICIDE);
DoCastSelf(SPELL_SUICIDE, true);
events.Repeat(3s);
break;
default:
@@ -261,11 +261,11 @@ struct boss_ahune : public BossAI
if (Creature* frozenCore = instance->GetCreature(DATA_FROZEN_CORE))
frozenCore->AI()->DoAction(ACTION_AHUNE_RESURFACE);
DoCastSelf(SPELL_AHUNES_SHIELD);
DoCastSelf(SPELL_AHUNES_SHIELD, true);
me->RemoveAurasDueToSpell(SPELL_AHUNE_SELF_STUN);
me->RemoveAurasDueToSpell(SPELL_STAY_SUBMERGED);
DoCastSelf(SPELL_BIRTH);
DoCastSelf(SPELL_STAND);
DoCastSelf(SPELL_BIRTH, true);
DoCastSelf(SPELL_STAND, true);
DoCastSelf(SPELL_RESURFACE, true);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND);

View File

@@ -150,54 +150,43 @@ public:
}
};
class spell_mark_of_kazzak : public SpellScriptLoader
class spell_mark_of_kazzak_aura : public AuraScript
{
public:
spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { }
PrepareAuraScript(spell_mark_of_kazzak_aura);
class spell_mark_of_kazzak_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_mark_of_kazzak_AuraScript);
return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
{
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->GetPower(POWER_MANA) == 0)
{
target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
SetDuration(0); // Remove aura
}
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
}
};
AuraScript* GetAuraScript() const override
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
return new spell_mark_of_kazzak_AuraScript();
if (Unit* owner = GetUnitOwner())
{
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->GetPower(POWER_MANA) == 0)
{
target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
SetDuration(0); // Remove aura
}
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_aura::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
}
};
void AddSC_boss_doomlordkazzak()
{
new boss_doomlord_kazzak();
new spell_mark_of_kazzak();
RegisterSpellScript(spell_mark_of_kazzak_aura);
}

View File

@@ -223,31 +223,30 @@ public:
}
};
class spell_npc22275_crystal_prison : public SpellScriptLoader
enum CrystalPrison
{
public:
spell_npc22275_crystal_prison() : SpellScriptLoader("spell_npc22275_crystal_prison") { }
SPELL_CRYSTAL_SHATTER = 40898
};
class spell_npc22275_crystal_prison_AuraScript : public AuraScript
class spell_npc22275_crystal_prison_aura : public AuraScript
{
PrepareAuraScript(spell_npc22275_crystal_prison_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_npc22275_crystal_prison_AuraScript);
return ValidateSpellInfo({ SPELL_CRYSTAL_SHATTER });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
SetDuration(0);
GetTarget()->CastSpell(GetTarget(), 40898, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_npc22275_crystal_prison_AuraScript();
PreventDefaultAction();
SetDuration(0);
GetTarget()->CastSpell(GetTarget(), SPELL_CRYSTAL_SHATTER, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
@@ -1139,31 +1138,25 @@ public:
}
};
class spell_oscillating_field : public SpellScriptLoader
class spell_oscillating_field : public SpellScript
{
public:
spell_oscillating_field() : SpellScriptLoader("spell_oscillating_field") { }
PrepareSpellScript(spell_oscillating_field);
class spell_oscillating_field_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_oscillating_field_SpellScript);
return ValidateSpellInfo({ SPELL_OSCILLATION_FIELD });
}
void HandleEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE)
player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oscillating_field_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
void HandleEffect(SpellEffIndex /*effIndex*/)
{
return new spell_oscillating_field_SpellScript();
if (Player* player = GetHitPlayer())
if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE)
player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oscillating_field::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
@@ -1172,7 +1165,7 @@ void AddSC_blades_edge_mountains()
// Ours
new npc_deaths_door_fell_cannon_target_bunny();
new npc_deaths_fel_cannon();
new spell_npc22275_crystal_prison();
RegisterSpellScript(spell_npc22275_crystal_prison_aura);
// Theirs
new npc_nether_drake();
new npc_daranelle();
@@ -1180,5 +1173,5 @@ void AddSC_blades_edge_mountains()
new go_simon_cluster();
new go_apexis_relic();
new npc_oscillating_frequency_scanner_master_bunny();
new spell_oscillating_field();
RegisterSpellScript(spell_oscillating_field);
}

View File

@@ -25,39 +25,37 @@
#include "SpellScript.h"
#include "SpellScriptLoader.h"
// Ours
class spell_q10935_the_exorcism_of_colonel_jules : public SpellScriptLoader
enum q10935Exorcism
{
public:
spell_q10935_the_exorcism_of_colonel_jules() : SpellScriptLoader("spell_q10935_the_exorcism_of_colonel_jules") { }
SPELL_HOLY_FIRE = 39323,
SPELL_HEAL_BARADA = 39322
};
class spell_q10935_the_exorcism_of_colonel_jules_SpellScript : public SpellScript
class spell_q10935_the_exorcism_of_colonel_jules : public SpellScript
{
PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules_SpellScript);
return ValidateSpellInfo({ SPELL_HOLY_FIRE, SPELL_HEAL_BARADA });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
if (GetCaster()->IsHostileTo(target))
GetCaster()->CastSpell(target, 39323 /*SPELL_HOLY_FIRE*/, true);
else
GetCaster()->CastSpell(target, 39322 /*SPELL_HEAL_BARADA*/, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex effIndex)
{
return new spell_q10935_the_exorcism_of_colonel_jules_SpellScript();
PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
if (GetCaster()->IsHostileTo(target))
GetCaster()->CastSpell(target, SPELL_HOLY_FIRE, true);
else
GetCaster()->CastSpell(target, SPELL_HEAL_BARADA, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -607,7 +605,7 @@ public:
void AddSC_hellfire_peninsula()
{
// Ours
new spell_q10935_the_exorcism_of_colonel_jules();
RegisterSpellScript(spell_q10935_the_exorcism_of_colonel_jules);
// Theirs
new npc_aeranas();

View File

@@ -45,93 +45,81 @@ npc_enraged_spirit
EndContentData */
// Ours
class spell_q10612_10613_the_fel_and_the_furious : public SpellScriptLoader
enum TheFelAndTheFurious
{
public:
spell_q10612_10613_the_fel_and_the_furious() : SpellScriptLoader("spell_q10612_10613_the_fel_and_the_furious") { }
SPELL_ROCKET_LAUNCHER = 38083
};
class spell_q10612_10613_the_fel_and_the_furious_SpellScript : public SpellScript
class spell_q10612_10613_the_fel_and_the_furious : public SpellScript
{
PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious_SpellScript);
return ValidateSpellInfo({ SPELL_ROCKET_LAUNCHER });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!charmer)
return;
std::list<GameObject*> gList;
GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f);
uint8 counter = 0;
for (std::list<GameObject*>::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter)
{
Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!charmer)
return;
std::list<GameObject*> gList;
GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f);
uint8 counter = 0;
for (std::list<GameObject*>::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter)
if (counter >= 10)
break;
GameObject* go = *itr;
if (!go->isSpawned())
continue;
Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100);
if (cr2)
{
if (counter >= 10)
break;
GameObject* go = *itr;
if (!go->isSpawned())
continue;
Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100);
if (cr2)
{
cr2->SetFaction(FACTION_MONSTER);
cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
GetCaster()->CastSpell(cr2, 38083, true);
}
go->SetLootState(GO_JUST_DEACTIVATED);
charmer->KilledMonsterCredit(21959);
cr2->SetFaction(FACTION_MONSTER);
cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
GetCaster()->CastSpell(cr2, SPELL_ROCKET_LAUNCHER, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
go->SetLootState(GO_JUST_DEACTIVATED);
charmer->KilledMonsterCredit(21959);
}
};
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10612_10613_the_fel_and_the_furious_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_q10563_q10596_to_legion_hold : public SpellScriptLoader
class spell_q10563_q10596_to_legion_hold_aura : public AuraScript
{
public:
spell_q10563_q10596_to_legion_hold() : SpellScriptLoader("spell_q10563_q10596_to_legion_hold") { }
PrepareAuraScript(spell_q10563_q10596_to_legion_hold_aura);
class spell_q10563_q10596_to_legion_hold_AuraScript : public AuraScript
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q10563_q10596_to_legion_hold_AuraScript)
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Player* player = GetTarget()->ToPlayer())
{
if (Player* player = GetTarget()->ToPlayer())
{
player->KilledMonsterCredit(21502);
player->SetControlled(false, UNIT_STATE_STUNNED);
}
player->KilledMonsterCredit(21502);
player->SetControlled(false, UNIT_STATE_STUNNED);
}
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
{
player->SetControlled(true, UNIT_STATE_STUNNED);
player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_q10563_q10596_to_legion_hold_AuraScript();
if (Player* player = GetTarget()->ToPlayer())
{
player->SetControlled(true, UNIT_STATE_STUNNED);
player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1833,8 +1821,8 @@ public:
void AddSC_shadowmoon_valley()
{
// Ours
new spell_q10612_10613_the_fel_and_the_furious();
new spell_q10563_q10596_to_legion_hold();
RegisterSpellScript(spell_q10612_10613_the_fel_and_the_furious);
RegisterSpellScript(spell_q10563_q10596_to_legion_hold_aura);
// Theirs
new npc_invis_infernal_caster();

View File

@@ -36,103 +36,81 @@ enum fumping
SPELL_SUMMON_HAISHULUD = 39248,
};
class spell_q10930_big_bone_worm : public SpellScriptLoader
class spell_q10930_big_bone_worm : public SpellScript
{
public:
spell_q10930_big_bone_worm() : SpellScriptLoader("spell_q10930_big_bone_worm") { }
PrepareSpellScript(spell_q10930_big_bone_worm);
class spell_q10930_big_bone_worm_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10930_big_bone_worm_SpellScript);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_q10930_big_bone_worm_SpellScript();
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
class spell_q10930_big_bone_worm_AuraScript : public AuraScript
void Register() override
{
PrepareAuraScript(spell_q10930_big_bone_worm_AuraScript);
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_q10930_big_bone_worm_AuraScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
class spell_q10929_fumping : SpellScriptLoader
class spell_q10930_big_bone_worm_aura : public AuraScript
{
public:
spell_q10929_fumping() : SpellScriptLoader("spell_q10929_fumping") { }
PrepareAuraScript(spell_q10930_big_bone_worm_aura);
class spell_q10929_fumping_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10929_fumping_SpellScript);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_q10929_fumping_SpellScript();
return ValidateSpellInfo({ SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 });
}
class spell_q10929_fumping_AuraScript : public AuraScript
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q10929_fumping_AuraScript);
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_q10929_fumping_AuraScript();
OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_q10929_fumping : public SpellScript
{
PrepareSpellScript(spell_q10929_fumping);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
class spell_q10929_fumping_aura : public AuraScript
{
PrepareAuraScript(spell_q10929_fumping_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -162,30 +140,19 @@ enum q10036Torgos
NPC_TORGOS = 18707
};
class spell_q10036_torgos : public SpellScriptLoader
class spell_q10036_torgos : public SpellScript
{
public:
spell_q10036_torgos() : SpellScriptLoader("spell_q10036_torgos") { }
PrepareSpellScript(spell_q10036_torgos);
class spell_q10036_torgos_SpellScript : public SpellScript
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_q10036_torgos_SpellScript);
if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true))
torgos->GetAI()->AttackStart(GetCaster());
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true))
torgos->GetAI()->AttackStart(GetCaster());
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10036_torgos_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10036_torgos_SpellScript();
OnEffectLaunch += SpellEffectFn(spell_q10036_torgos::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
@@ -198,114 +165,80 @@ enum eQ10923EvilDrawsNear
NPC_AUCHENAI_DEATH_SPIRIT = 21967
};
class spell_q10923_evil_draws_near_summon : public SpellScriptLoader
class spell_q10923_evil_draws_near_summon : public SpellScript
{
public:
spell_q10923_evil_draws_near_summon() : SpellScriptLoader("spell_q10923_evil_draws_near_summon") { }
PrepareSpellScript(spell_q10923_evil_draws_near_summon);
class spell_q10923_evil_draws_near_summon_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10923_evil_draws_near_summon_SpellScript);
return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA });
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true))
auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
return new spell_q10923_evil_draws_near_summon_SpellScript();
if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true))
auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
class spell_q10923_evil_draws_near_periodic : public SpellScriptLoader
class spell_q10923_evil_draws_near_periodic_aura : public AuraScript
{
public:
spell_q10923_evil_draws_near_periodic() : SpellScriptLoader("spell_q10923_evil_draws_near_periodic") { }
PrepareAuraScript(spell_q10923_evil_draws_near_periodic_aura);
class spell_q10923_evil_draws_near_periodic_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_q10923_evil_draws_near_periodic_AuraScript);
return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2 });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_q10923_evil_draws_near_periodic_AuraScript();
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_q10923_evil_draws_near_visual : public SpellScriptLoader
class spell_q10923_evil_draws_near_visual : public SpellScript
{
public:
spell_q10923_evil_draws_near_visual() : SpellScriptLoader("spell_q10923_evil_draws_near_visual") { }
PrepareSpellScript(spell_q10923_evil_draws_near_visual);
class spell_q10923_evil_draws_near_visual_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10923_evil_draws_near_visual_SpellScript);
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f };
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10923_evil_draws_near_visual_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
}
};
class spell_q10898_skywing : public SpellScriptLoader
class spell_q10898_skywing : public SpellScript
{
public:
spell_q10898_skywing() : SpellScriptLoader("spell_q10898_skywing") { }
PrepareSpellScript(spell_q10898_skywing);
class spell_q10898_skywing_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10898_skywing_SpellScript);
// Adjust effect summon position
Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f };
dest.Relocate(*GetCaster());
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f };
dest.Relocate(*GetCaster());
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10898_skywing_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
@@ -701,14 +634,14 @@ public:
void AddSC_terokkar_forest()
{
// Ours
new spell_q10930_big_bone_worm();
new spell_q10929_fumping();
RegisterSpellAndAuraScriptPair(spell_q10930_big_bone_worm, spell_q10930_big_bone_worm_aura);
RegisterSpellAndAuraScriptPair(spell_q10929_fumping, spell_q10929_fumping_aura);
new npc_greatfather_aldrimus();
new spell_q10036_torgos();
new spell_q10923_evil_draws_near_summon();
new spell_q10923_evil_draws_near_periodic();
new spell_q10923_evil_draws_near_visual();
new spell_q10898_skywing();
RegisterSpellScript(spell_q10036_torgos);
RegisterSpellScript(spell_q10923_evil_draws_near_summon);
RegisterSpellScript(spell_q10923_evil_draws_near_periodic_aura);
RegisterSpellScript(spell_q10923_evil_draws_near_visual);
RegisterSpellScript(spell_q10898_skywing);
// Theirs
new npc_unkor_the_ruthless();

View File

@@ -5199,6 +5199,59 @@ class spell_gen_consumption : public SpellScript
}
};
// 37591 - Drunken Haze | 29690 - Drunken Skull Crack
enum DrunkenHaze
{
SPELL_DRUNKEN_HAZE = 37591,
SPELL_DRUNKEN_SKULL_CRACK = 29690
};
class spell_gen_sober_up : public AuraScript
{
PrepareAuraScript(spell_gen_sober_up);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DRUNKEN_HAZE, SPELL_DRUNKEN_SKULL_CRACK });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target && !target->ToPlayer())
return;
SpellEffIndex InebriateEffIndex;
if (Player* player = target->ToPlayer())
{
switch (GetSpellInfo()->Id)
{
case SPELL_DRUNKEN_HAZE:
InebriateEffIndex = EFFECT_1;
break;
case SPELL_DRUNKEN_SKULL_CRACK:
InebriateEffIndex = EFFECT_2;
break;
}
uint16 level = aurEff->GetSpellInfo()->Effects[InebriateEffIndex].CalcValue();
player->SetDrunkValue(player->GetDrunkValue() - (level > 100 ? 100 : level)); // Some (maybe it's only 29690) spells can have over 100 inebriate points
}
}
void Register() override
{
if (m_scriptSpellId == SPELL_DRUNKEN_HAZE)
{
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_sober_up::OnRemove, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
else
{
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_sober_up::OnRemove, EFFECT_1, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
}
};
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_silithyst);
@@ -5354,5 +5407,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_yehkinya_bramble);
RegisterSpellScript(spell_gen_choking_vines);
RegisterSpellScript(spell_gen_consumption);
RegisterSpellScript(spell_gen_sober_up);
}