diff --git a/data/sql/updates/pending_db_world/rev_1638046780431340000.sql b/data/sql/updates/pending_db_world/rev_1638046780431340000.sql
new file mode 100644
index 000000000..0ea3509be
--- /dev/null
+++ b/data/sql/updates/pending_db_world/rev_1638046780431340000.sql
@@ -0,0 +1,13 @@
+INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1638046780431340000');
+
+UPDATE `creature_template` SET `AiName`='', `ScriptName`='boss_kormok' WHERE `entry`=16118;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=16118 AND `source_type`=0;
+
+DELETE FROM `creature_text` WHERE `creatureid`=16118;
+INSERT INTO `creature_text` VALUES
+(16118,0,0,'You think you can summon us? We are the ones that summon, not you! We bash you good for this and suck the marrow from your bones!',14,0,100,0,0,0,11968,0,'Kormok - Talk Summon'),
+(16118,1,0,'You so little and puny... you no make good servants for Kormok!',12,0,100,0,0,0,11959,0,'Kormok - Talk Aggro'),
+(16118,2,0,'%s becomes enraged!',16,0,100,0,0,0,10677,0,'Kormok - Enrage'),
+(16118,3,0,'We am free! Thank you little, puny ones.',14,0,100,0,0,0,11873,0,'Kormok - Death');
+
+UPDATE `spell_dbc` SET `Effect_1`=28, `EffectMiscValueB_1`=64 WHERE `ID` IN (27690,27691,27692,27693);
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
new file mode 100644
index 000000000..f4699217d
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
@@ -0,0 +1,214 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "scholomance.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "TaskScheduler.h"
+
+enum Spells
+{
+ SPELL_SHADOWBOLT_VOLLEY = 20741,
+ SPELL_BONE_SHIELD = 27688,
+
+ SPELL_SUMMON_BONE_MAGES = 27695,
+
+ SPELL_SUMMON_BONE_MAGE_FRONT_LEFT = 27696,
+ SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT = 27697,
+ SPELL_SUMMON_BONE_MAGE_BACK_RIGHT = 27698,
+ SPELL_SUMMON_BONE_MAGE_BACK_LEFT = 27699,
+
+ SPELL_SUMMON_BONE_MINION1 = 27690,
+ SPELL_SUMMON_BONE_MINION2 = 27691,
+ SPELL_SUMMON_BONE_MINION3 = 27692,
+ SPELL_SUMMON_BONE_MINION4 = 27693,
+
+ SPELL_SUMMON_BONE_MINIONS = 27687
+};
+
+enum Events
+{
+ EVENT_SHADOWBOLT_VOLLEY = 1,
+ EVENT_SUMMON_MINIONS
+};
+
+enum Says
+{
+ TALK_SUMMON = 0,
+ TALK_AGGRO = 1,
+ TALK_ENRAGE = 2,
+ TALK_DEATH = 3
+};
+
+struct boss_kormok : public ScriptedAI
+{
+ boss_kormok(Creature* creature) : ScriptedAI(creature), _summons(creature) {}
+
+ void Reset() override
+ {
+ _mages = false;
+
+ _scheduler.CancelAll();
+ _scheduler.SetValidator([this]
+ {
+ return !me->HasUnitState(UNIT_STATE_CASTING);
+ });
+
+ _summons.DespawnAll();
+ }
+
+ void IsSummonedBy(Unit* /*summoner*/) override
+ {
+ Talk(TALK_SUMMON);
+
+ _scheduler.Schedule(2s, [this](TaskContext context)
+ {
+ DoCastSelf(SPELL_BONE_SHIELD);
+ context.Repeat(45s);
+ });
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ Talk(TALK_AGGRO);
+
+ _scheduler.Schedule(10s, [this](TaskContext context)
+ {
+ DoCastVictim(SPELL_SHADOWBOLT_VOLLEY);
+ context.Repeat(15s);
+ })
+ .Schedule(15s, [this](TaskContext context)
+ {
+ DoCast(SPELL_SUMMON_BONE_MINIONS);
+ context.Repeat(12s);
+ });
+ }
+
+ void JustSummoned(Creature* summon) override
+ {
+ _summons.Summon(summon);
+ DoZoneInCombat(summon);
+ }
+
+ void SummonedCreatureDespawn(Creature* summon) override
+ {
+ _summons.Despawn(summon);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*damageSchoolMask*/) override
+ {
+ if (!_mages && me->HealthBelowPctDamaged(25, damage))
+ {
+ _mages = true;
+
+ Talk(TALK_ENRAGE);
+
+ DoCast(SPELL_SUMMON_BONE_MAGES);
+ }
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ Talk(TALK_DEATH);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _scheduler.Update(diff);
+
+ if (!UpdateVictim())
+ {
+ return;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ TaskScheduler _scheduler;
+ SummonList _summons;
+ bool _mages;
+};
+
+uint32 const SummonMageSpells[4] =
+{
+ SPELL_SUMMON_BONE_MAGE_FRONT_LEFT,
+ SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT,
+ SPELL_SUMMON_BONE_MAGE_BACK_RIGHT,
+ SPELL_SUMMON_BONE_MAGE_BACK_LEFT,
+};
+
+// 27695 - Summon Bone Mages
+class spell_kormok_summon_bone_mages : public SpellScript
+{
+ PrepareSpellScript(spell_kormok_summon_bone_mages);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ return ValidateSpellInfo(SummonMageSpells);
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+
+ for (uint32 i = 0; i < 2; ++i)
+ {
+ GetCaster()->CastSpell(GetCaster(), SummonMageSpells[urand(0, 3)], true);
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_mages::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+};
+
+// 27687 - Summon Bone Minions
+class spell_kormok_summon_bone_minions : public SpellScript
+{
+ PrepareSpellScript(spell_kormok_summon_bone_minions);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ return ValidateSpellInfo({ SPELL_SUMMON_BONE_MINIONS });
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+
+ // Possible spells to handle this not found.
+ for (uint32 i = 0; i < 4; ++i)
+ {
+ GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_BONE_MINION1 + i, true);
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_minions::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+};
+
+void AddSC_boss_kormok()
+{
+ RegisterScholomanceCreatureAI(boss_kormok);
+ RegisterSpellScript(spell_kormok_summon_bone_mages);
+ RegisterSpellScript(spell_kormok_summon_bone_minions);
+}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
index 5c10b5dab..272f24e93 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
@@ -289,63 +289,6 @@ public:
}
};
-class spell_kormok_summon_bone_mages : SpellScriptLoader
-{
-public:
- spell_kormok_summon_bone_mages() : SpellScriptLoader("spell_kormok_summon_bone_mages") { }
-
- class spell_kormok_summon_bone_magesSpellScript : public SpellScript
- {
- PrepareSpellScript(spell_kormok_summon_bone_magesSpellScript);
-
- void HandleScript(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
- for (uint8 i = 0; i < 2; ++i)
- GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_BONE_MAGE_FRONT_LEFT + urand(0, 3), true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_magesSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_kormok_summon_bone_magesSpellScript();
- }
-};
-
-class spell_kormok_summon_bone_minions : SpellScriptLoader
-{
-public:
- spell_kormok_summon_bone_minions() : SpellScriptLoader("spell_kormok_summon_bone_minions") { }
-
- class spell_kormok_summon_bone_minionsSpellScript : public SpellScript
- {
- PrepareSpellScript(spell_kormok_summon_bone_minionsSpellScript);
-
- void HandleScript(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
-
- for (uint32 i = 0; i < 4; ++i)
- GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_BONE_MINION1 + i, true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_minionsSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_kormok_summon_bone_minionsSpellScript();
- }
-};
-
class spell_scholomance_boon_of_life : public SpellScriptLoader
{
public:
@@ -525,8 +468,6 @@ void AddSC_instance_scholomance()
{
new instance_scholomance();
new spell_scholomance_fixate();
- new spell_kormok_summon_bone_mages();
- new spell_kormok_summon_bone_minions();
new spell_scholomance_boon_of_life();
new npc_scholomance_occultist();
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
index ec77c48b8..a53f33ebf 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
+++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
@@ -62,23 +62,12 @@ enum GameobjectIds
GO_GATE_GANDLING_UP_SOUTH = 177375
};
-enum SpellIds
-{
- SPELL_SUMMON_BONE_MAGE_FRONT_LEFT = 27696,
- SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT = 27697,
- SPELL_SUMMON_BONE_MAGE_BACK_RIGHT = 27698,
- SPELL_SUMMON_BONE_MAGE_BACK_LEFT = 27699,
-
- SPELL_SUMMON_BONE_MINION1 = 27690,
- SPELL_SUMMON_BONE_MINION2 = 27691,
- SPELL_SUMMON_BONE_MINION3 = 27692,
- SPELL_SUMMON_BONE_MINION4 = 27693
-};
-
template
inline AI* GetScholomanceAI(T* obj)
{
return GetInstanceAI(obj, ScholomanceScriptName);
}
+#define RegisterScholomanceCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetScholomanceAI)
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
index 58cc5fa7f..40bc88c23 100644
--- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
+++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
@@ -97,6 +97,7 @@ void AddSC_the_scarlet_enclave_c5();
void AddSC_instance_scarlet_monastery(); //Scarlet Monastery
void AddSC_boss_kirtonos_the_herald();
void AddSC_boss_darkmaster_gandling();
+void AddSC_boss_kormok();
void AddSC_instance_scholomance(); //Scholomance
void AddSC_instance_shadowfang_keep(); //Shadowfang keep
void AddSC_boss_baroness_anastari();
@@ -240,6 +241,7 @@ void AddEasternKingdomsScripts()
AddSC_instance_scarlet_monastery(); //Scarlet Monastery
AddSC_boss_kirtonos_the_herald();
AddSC_boss_darkmaster_gandling();
+ AddSC_boss_kormok();
AddSC_instance_scholomance(); //Scholomance
AddSC_instance_shadowfang_keep(); //Shadowfang keep
AddSC_boss_baroness_anastari();