diff --git a/data/sql/updates/pending_db_world/rev_1695008245587651800.sql b/data/sql/updates/pending_db_world/rev_1695008245587651800.sql new file mode 100644 index 000000000..03ad0b949 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1695008245587651800.sql @@ -0,0 +1,14 @@ +-- +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 17265; + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17265) AND (`source_type` = 0) AND (`id` IN (0)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17265, 0, 0, 0, 60, 0, 100, 0, 2400, 8000, 2400, 8000, 0, 11, 30184, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Fiendish Portal - On Update - Cast \'Summon Fiendish Imp\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 17267; + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17267) AND (`source_type` = 0) AND (`id` IN (0)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17267, 0, 0, 0, 0, 0, 100, 0, 2000, 2000, 2000, 2200, 0, 11, 30050, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Fiendish Imp - In Combat - Cast \'Firebolt\''); + +UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask`|1 WHERE `entry` = 17229; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index b81b7cd8b..3092045df 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -52,7 +52,6 @@ enum Spells enum Creatures { NPC_DEMONCHAINS = 17248, - NPC_FIENDISHIMP = 17267, NPC_PORTAL = 17265 }; @@ -146,64 +145,6 @@ private: ObjectGuid sacrificeGUID; }; -struct npc_fiendish_portal : public PassiveAI -{ - npc_fiendish_portal(Creature* creature) : PassiveAI(creature), summons(me) {} - - void Reset() override - { - DespawnAllImp(); - } - - void JustSummoned(Creature* summon) override - { - summons.Summon(summon); - DoZoneInCombat(summon); - } - - void DespawnAllImp() - { - summons.DespawnAll(); - } - -private: - SummonList summons; -}; - -struct npc_fiendish_imp : public ScriptedAI -{ - npc_fiendish_imp(Creature* creature) : ScriptedAI(creature) {} - - void Reset() override - { - _scheduler.CancelAll(); - } - - void JustEngagedWith(Unit* /*who*/) override - { - _scheduler.Schedule(2s, [this](TaskContext context) - { - DoCastVictim(SPELL_FIREBOLT); - context.Repeat(2200ms); - }); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - DoMeleeAttackIfReady(); - } - -private: - TaskScheduler _scheduler; -}; - struct boss_terestian_illhoof : public BossAI { boss_terestian_illhoof(Creature* creature) : BossAI(creature, DATA_TERESTIAN) @@ -218,20 +159,6 @@ struct boss_terestian_illhoof : public BossAI { _Reset(); SummonKilrek(); - portalsCount = 0; - berserk = false; - for (uint8 i = 0; i < 2; ++i) - { - if (portalGUID[i]) - { - if (Creature* pPortal = ObjectAccessor::GetCreature(*me, portalGUID[i])) - { - pPortal->AI()->Reset(); - pPortal->DespawnOrUnsummon(); - } - portalGUID[i].Clear(); - } - } } void SummonKilrek() @@ -267,31 +194,15 @@ struct boss_terestian_illhoof : public BossAI { DoCastVictim(SPELL_SHADOW_BOLT); context.Repeat(10s); - }).Schedule(10s, [this](TaskContext context) + }).Schedule(10s, [this](TaskContext) { - if (!portalGUID[0]) - { - DoCastVictim(SPELL_FIENDISH_PORTAL); - } - if (!portalGUID[1]) - { - DoCastVictim(SPELL_FIENDISH_PORTAL_1); - } - if (portalGUID[0] && portalGUID[1]) - { - if (Creature* pPortal = ObjectAccessor::GetCreature(*me, portalGUID[urand(0, 1)])) - { - pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP); - } - context.Repeat(5s); - } + DoCastAOE(SPELL_FIENDISH_PORTAL); + }).Schedule(11s, [this](TaskContext) + { + DoCastAOE(SPELL_FIENDISH_PORTAL_1); }).Schedule(10min, [this](TaskContext /*context*/) { - if (!berserk) - { - DoCastSelf(SPELL_BERSERK); - berserk = true; - } + DoCastSelf(SPELL_BERSERK); }); } @@ -299,13 +210,14 @@ struct boss_terestian_illhoof : public BossAI { if (summoned->GetEntry() == NPC_PORTAL) { - portalGUID[portalsCount] = summoned->GetGUID(); - ++portalsCount; + summoned->SetReactState(REACT_PASSIVE); if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) { Talk(SAY_SUMMON); } } + + summons.Summon(summoned); } void KilledUnit(Unit* victim) override @@ -318,44 +230,14 @@ struct boss_terestian_illhoof : public BossAI void JustDied(Unit* /*killer*/) override { + _JustDied(); Talk(SAY_DEATH); - for (uint8 i = 0; i < 2; ++i) - { - if (portalGUID[i]) - { - if (Creature* pPortal = ObjectAccessor::GetCreature((*me), portalGUID[i])) - { - pPortal->AI()->Reset(); - pPortal->DespawnOrUnsummon(); - } - portalGUID[i].Clear(); - } - } } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - scheduler.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - DoMeleeAttackIfReady(); - } - -private: - bool berserk; - ObjectGuid portalGUID[2]; - uint8 portalsCount; }; void AddSC_boss_terestian_illhoof() { RegisterKarazhanCreatureAI(boss_terestian_illhoof); - RegisterKarazhanCreatureAI(npc_fiendish_imp); - RegisterKarazhanCreatureAI(npc_fiendish_portal); RegisterKarazhanCreatureAI(npc_kilrek); RegisterKarazhanCreatureAI(npc_demon_chain); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 6f4a47161..f8568de6c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -44,6 +44,7 @@ ObjectData const creatureData[] = { NPC_ROMULO, DATA_ROMULO }, { NPC_JULIANNE, DATA_JULIANNE }, { NPC_NIGHTBANE, DATA_NIGHTBANE }, + { NPC_TERESTIAN_ILLHOOF, DATA_TERESTIAN }, { 0, 0 } }; @@ -122,6 +123,16 @@ public: case NPC_ECHO_OF_MEDIVH: _echoOfMedivhGUID = creature->GetGUID(); break; + case NPC_FIENDISH_IMP: + if (Creature* terestrian = GetCreature(DATA_TERESTIAN)) + { + if (terestrian->AI()) + { + terestrian->AI()->JustSummoned(creature); + creature->SetInCombatWithZone(); + } + } + break; default: break; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index 25a7fec00..274a5f1f3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -117,6 +117,7 @@ enum KZCreatures NPC_ROAR = 17546, NPC_STRAWMAN = 17543, NPC_TINHEAD = 17547, + NPC_FIENDISH_IMP = 17267, // Chess Event NPC_ECHO_OF_MEDIVH = 16816,