aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp413
1 files changed, 179 insertions, 234 deletions
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index 2fa286e6a41..0f9fc145a06 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -69,267 +69,212 @@ enum Events
Position const Landing = { -263.0534f, -660.8658f, 26.50903f, 0.0f };
-class boss_trollgore : public CreatureScript
+struct boss_trollgore : public BossAI
{
- public:
- boss_trollgore() : CreatureScript("boss_trollgore") { }
-
- struct boss_trollgoreAI : public BossAI
+ boss_trollgore(Creature* creature) : BossAI(creature, DATA_TROLLGORE)
+ {
+ Initialize();
+ }
+
+ void Initialize()
+ {
+ _consumptionJunction = true;
+ }
+
+ void Reset() override
+ {
+ _Reset();
+ Initialize();
+ }
+
+ void JustEngagedWith(Unit* who) override
+ {
+ BossAI::JustEngagedWith(who);
+ Talk(SAY_AGGRO);
+
+ events.ScheduleEvent(EVENT_CONSUME, 15s);
+ events.ScheduleEvent(EVENT_CRUSH, 1s, 5s);
+ events.ScheduleEvent(EVENT_INFECTED_WOUND, 10s, 60s);
+ events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 3s);
+ events.ScheduleEvent(EVENT_SPAWN, 30s, 40s);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- boss_trollgoreAI(Creature* creature) : BossAI(creature, DATA_TROLLGORE)
- {
- Initialize();
- }
-
- void Initialize()
+ switch (eventId)
{
- _consumptionJunction = true;
+ case EVENT_CONSUME:
+ Talk(SAY_CONSUME);
+ DoCastAOE(SPELL_CONSUME);
+ events.ScheduleEvent(EVENT_CONSUME, 15s);
+ break;
+ case EVENT_CRUSH:
+ DoCastVictim(SPELL_CRUSH);
+ events.ScheduleEvent(EVENT_CRUSH, 10s, 15s);
+ break;
+ case EVENT_INFECTED_WOUND:
+ DoCastVictim(SPELL_INFECTED_WOUND);
+ events.ScheduleEvent(EVENT_INFECTED_WOUND, 25s, 35s);
+ break;
+ case EVENT_CORPSE_EXPLODE:
+ Talk(SAY_EXPLODE);
+ DoCastAOE(SPELL_CORPSE_EXPLODE);
+ events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 15s, 19s);
+ break;
+ case EVENT_SPAWN:
+ for (uint8 i = 0; i < 3; ++i)
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
+ trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), me->GetGUID());
+
+ events.ScheduleEvent(EVENT_SPAWN, 30s, 40s);
+ break;
+ default:
+ break;
}
- void Reset() override
- {
- _Reset();
- Initialize();
- }
-
- void JustEngagedWith(Unit* who) override
- {
- BossAI::JustEngagedWith(who);
- Talk(SAY_AGGRO);
-
- events.ScheduleEvent(EVENT_CONSUME, 15s);
- events.ScheduleEvent(EVENT_CRUSH, 1s, 5s);
- events.ScheduleEvent(EVENT_INFECTED_WOUND, 10s, 60s);
- events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 3s);
- events.ScheduleEvent(EVENT_SPAWN, 30s, 40s);
- }
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_CONSUME:
- Talk(SAY_CONSUME);
- DoCastAOE(SPELL_CONSUME);
- events.ScheduleEvent(EVENT_CONSUME, 15s);
- break;
- case EVENT_CRUSH:
- DoCastVictim(SPELL_CRUSH);
- events.ScheduleEvent(EVENT_CRUSH, 10s, 15s);
- break;
- case EVENT_INFECTED_WOUND:
- DoCastVictim(SPELL_INFECTED_WOUND);
- events.ScheduleEvent(EVENT_INFECTED_WOUND, 25s, 35s);
- break;
- case EVENT_CORPSE_EXPLODE:
- Talk(SAY_EXPLODE);
- DoCastAOE(SPELL_CORPSE_EXPLODE);
- events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 15s, 19s);
- break;
- case EVENT_SPAWN:
- for (uint8 i = 0; i < 3; ++i)
- if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
- trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), me->GetGUID());
-
- events.ScheduleEvent(EVENT_SPAWN, 30s, 40s);
- break;
- default:
- break;
- }
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- }
-
- if (_consumptionJunction)
- {
- Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
- if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
- _consumptionJunction = false;
- }
-
- DoMeleeAttackIfReady();
- }
+ if (_consumptionJunction)
+ {
+ Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
+ if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
+ _consumptionJunction = false;
+ }
- void JustDied(Unit* /*killer*/) override
- {
- _JustDied();
- Talk(SAY_DEATH);
- }
+ DoMeleeAttackIfReady();
+ }
- uint32 GetData(uint32 type) const override
- {
- if (type == DATA_CONSUMPTION_JUNCTION)
- return _consumptionJunction ? 1 : 0;
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
- return 0;
- }
+ uint32 GetData(uint32 type) const override
+ {
+ if (type == DATA_CONSUMPTION_JUNCTION)
+ return _consumptionJunction ? 1 : 0;
- void KilledUnit(Unit* victim) override
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
+ return 0;
+ }
- Talk(SAY_KILL);
- }
+ void KilledUnit(Unit* victim) override
+ {
+ if (victim->GetTypeId() != TYPEID_PLAYER)
+ return;
- void JustSummoned(Creature* summon) override
- {
- summon->GetMotionMaster()->MovePoint(POINT_LANDING, Landing);
- summons.Summon(summon);
- }
+ Talk(SAY_KILL);
+ }
- private:
- bool _consumptionJunction;
- };
+ void JustSummoned(Creature* summon) override
+ {
+ summon->GetMotionMaster()->MovePoint(POINT_LANDING, Landing);
+ summons.Summon(summon);
+ }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetDrakTharonKeepAI<boss_trollgoreAI>(creature);
- }
+ private:
+ bool _consumptionJunction;
};
-class npc_drakkari_invader : public CreatureScript
+struct npc_drakkari_invader : public ScriptedAI
{
- public:
- npc_drakkari_invader() : CreatureScript("npc_drakkari_invader") { }
-
- struct npc_drakkari_invaderAI : public ScriptedAI
- {
- npc_drakkari_invaderAI(Creature* creature) : ScriptedAI(creature) { }
-
- void MovementInform(uint32 type, uint32 pointId) override
- {
- if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
- {
- me->Dismount();
- me->SetImmuneToAll(false);
- DoCastAOE(SPELL_INVADER_TAUNT);
- }
- }
- };
+ npc_drakkari_invader(Creature* creature) : ScriptedAI(creature) { }
- CreatureAI* GetAI(Creature* creature) const override
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
{
- return GetDrakTharonKeepAI<npc_drakkari_invaderAI>(creature);
+ me->Dismount();
+ me->SetImmuneToAll(false);
+ DoCastAOE(SPELL_INVADER_TAUNT);
}
+ }
};
// 49380, 59803 - Consume
-class spell_trollgore_consume : public SpellScriptLoader
+class spell_trollgore_consume : public SpellScript
{
- public:
- spell_trollgore_consume() : SpellScriptLoader("spell_trollgore_consume") { }
-
- class spell_trollgore_consume_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_trollgore_consume_SpellScript);
-
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellInfo({ SPELL_CONSUME_BUFF });
- }
-
- void HandleConsume(SpellEffIndex /*effIndex*/)
- {
- if (Unit* target = GetHitUnit())
- target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_trollgore_consume_SpellScript::HandleConsume, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_trollgore_consume_SpellScript();
- }
+ PrepareSpellScript(spell_trollgore_consume);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_CONSUME_BUFF });
+ }
+
+ void HandleConsume(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_trollgore_consume::HandleConsume, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
};
// 49555, 59807 - Corpse Explode
-class spell_trollgore_corpse_explode : public SpellScriptLoader
+class spell_trollgore_corpse_explode : public AuraScript
{
- public:
- spell_trollgore_corpse_explode() : SpellScriptLoader("spell_trollgore_corpse_explode") { }
-
- class spell_trollgore_corpse_explode_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_trollgore_corpse_explode_AuraScript);
-
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellInfo({ SPELL_CORPSE_EXPLODE_DAMAGE });
- }
-
- void PeriodicTick(AuraEffect const* aurEff)
- {
- if (aurEff->GetTickNumber() == 2)
- if (Unit* caster = GetCaster())
- caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
- }
-
- void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- if (Creature* target = GetTarget()->ToCreature())
- target->DespawnOrUnsummon();
- }
-
- void Register() override
- {
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_trollgore_corpse_explode_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
- AfterEffectRemove += AuraEffectRemoveFn(spell_trollgore_corpse_explode_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
- }
- };
-
- AuraScript* GetAuraScript() const override
- {
- return new spell_trollgore_corpse_explode_AuraScript();
- }
+ PrepareAuraScript(spell_trollgore_corpse_explode);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_CORPSE_EXPLODE_DAMAGE });
+ }
+
+ void PeriodicTick(AuraEffect const* aurEff)
+ {
+ if (aurEff->GetTickNumber() == 2)
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
+ }
+
+ void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Creature* target = GetTarget()->ToCreature())
+ target->DespawnOrUnsummon();
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_trollgore_corpse_explode::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_trollgore_corpse_explode::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
};
// 49405 - Invader Taunt Trigger
-class spell_trollgore_invader_taunt : public SpellScriptLoader
+class spell_trollgore_invader_taunt : public SpellScript
{
- public:
- spell_trollgore_invader_taunt() : SpellScriptLoader("spell_trollgore_invader_taunt") { }
-
- class spell_trollgore_invader_taunt_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_trollgore_invader_taunt_SpellScript);
-
- bool Validate(SpellInfo const* spellInfo) override
- {
- return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) });
- }
-
- void HandleTaunt(SpellEffIndex /*effIndex*/)
- {
- if (Unit* target = GetHitUnit())
- target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_trollgore_invader_taunt_SpellScript::HandleTaunt, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_trollgore_invader_taunt_SpellScript();
- }
+ PrepareSpellScript(spell_trollgore_invader_taunt);
+
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) });
+ }
+
+ void HandleTaunt(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_trollgore_invader_taunt::HandleTaunt, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
};
class achievement_consumption_junction : public AchievementCriteriaScript
@@ -354,10 +299,10 @@ class achievement_consumption_junction : public AchievementCriteriaScript
void AddSC_boss_trollgore()
{
- new boss_trollgore();
- new npc_drakkari_invader();
- new spell_trollgore_consume();
- new spell_trollgore_corpse_explode();
- new spell_trollgore_invader_taunt();
+ RegisterDrakTharonKeepCreatureAI(boss_trollgore);
+ RegisterDrakTharonKeepCreatureAI(npc_drakkari_invader);
+ RegisterSpellScript(spell_trollgore_consume);
+ RegisterSpellScript(spell_trollgore_corpse_explode);
+ RegisterSpellScript(spell_trollgore_invader_taunt);
new achievement_consumption_junction();
}