diff options
-rw-r--r-- | sql/updates/world/2014_09_05_01_world_misc.sql | 6 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp | 211 |
2 files changed, 59 insertions, 158 deletions
diff --git a/sql/updates/world/2014_09_05_01_world_misc.sql b/sql/updates/world/2014_09_05_01_world_misc.sql new file mode 100644 index 00000000000..e03ca9e8c40 --- /dev/null +++ b/sql/updates/world/2014_09_05_01_world_misc.sql @@ -0,0 +1,6 @@ +-- Corrects unit_flags and sets AI for Illusion of Jandice Barov (11439)
+SET @ENTRY := 11439;
+UPDATE `creature_template` SET `ScriptName` = '', `AIName` = 'SmartAI', `unit_flags` = `unit_flags` &~4194304 WHERE `entry` = @ENTRY;
+DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 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`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@ENTRY, 0, 0, 0, 0, 0, 100, 2, 2000, 8000, 5000, 8000, 11, 15284, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Illusion of Jandice Barov - In Combat - Cast 'Cleave' (Normal Dungeon)");
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 02c0f70b7c8..44885a01270 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,23 +15,21 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_jandicebarov -SD%Complete: 100 -SDComment: -SDCategory: Scholomance -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" enum Spells { - SPELL_CURSEOFBLOOD = 24673, - //SPELL_ILLUSION = 17773, + SPELL_CURSE_OF_BLOOD = 24673, + SPELL_ILLUSION = 17773, +}; - // Spells of Illusion of Jandice Barov - SPELL_CLEAVE = 15284 +enum Events +{ + EVENT_CURSE_OF_BLOOD = 1, + EVENT_ILLUSION, + EVENT_CLEAVE, + EVENT_SET_VISIBILITY }; class boss_jandice_barov : public CreatureScript @@ -40,189 +37,87 @@ class boss_jandice_barov : public CreatureScript public: boss_jandice_barov() : CreatureScript("boss_jandice_barov") { } - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_jandicebarovAI(creature); - } - struct boss_jandicebarovAI : public ScriptedAI { - boss_jandicebarovAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } + boss_jandicebarovAI(Creature* creature) : ScriptedAI(creature), Summons(me) { } - void Initialize() + void Reset() override { - CurseOfBlood_Timer = 15000; - Illusion_Timer = 30000; - Invisible_Timer = 3000; //Too much too low? - Invisible = false; + events.Reset(); + Summons.DespawnAll(); } - uint32 CurseOfBlood_Timer; - uint32 Illusion_Timer; - //uint32 Illusioncounter; - uint32 Invisible_Timer; - bool Invisible; - - void Reset() override + void JustSummoned(Creature* summoned) override { - Initialize(); + // Illusions should attack a random target. + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + summoned->AI()->AttackStart(target); + + summoned->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); // Not sure if this is correct. + Summons.Summon(summoned); } void EnterCombat(Unit* /*who*/) override { + events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, 15000); + events.ScheduleEvent(EVENT_ILLUSION, 30000); } - void SummonIllusions(Unit* victim) + void JustDied(Unit* /*killer*/) override { - if (Creature* Illusion = DoSpawnCreature(11439, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Illusion->AI()->AttackStart(victim); + Summons.DespawnAll(); } void UpdateAI(uint32 diff) override { - if (Invisible && Invisible_Timer <= diff) - { - //Become visible again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11073); //Jandice Model - Invisible = false; - } else if (Invisible) - { - Invisible_Timer -= diff; - //Do nothing while invisible - return; - } - - //Return since we have no target if (!UpdateVictim()) return; - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) - { - //Cast - DoCastVictim(SPELL_CURSEOFBLOOD); + events.Update(diff); - //45 seconds - CurseOfBlood_Timer = 30000; - } else CurseOfBlood_Timer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - //Illusion_Timer - if (!Invisible && Illusion_Timer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); // Invisible Model - DoModifyThreatPercent(me->GetVictim(), -99); - - //Summon 10 Illusions attacking random gamers - Unit* target = NULL; - for (uint8 i = 0; i < 10; ++i) + switch (eventId) { - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) - SummonIllusions(target); + case EVENT_CURSE_OF_BLOOD: + DoCastVictim(SPELL_CURSE_OF_BLOOD); + events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, 30000); + break; + case EVENT_ILLUSION: + DoCast(SPELL_ILLUSION); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); // Invisible Model + DoModifyThreatPercent(me->GetVictim(), -99); + events.ScheduleEvent(EVENT_SET_VISIBILITY, 3000); + events.ScheduleEvent(EVENT_ILLUSION, 25000); + break; + case EVENT_SET_VISIBILITY: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11073); //Jandice Model + break; + default: + break; } - Invisible = true; - Invisible_Timer = 3000; - - //25 seconds until we should cast this agian - Illusion_Timer = 25000; - } else Illusion_Timer -= diff; - - // //Illusion_Timer - // if (Illusion_Timer <= diff) - // { - // //Cast - // DoCastVictim(SPELL_ILLUSION); - // - // //3 Illusion will be summoned - // if (Illusioncounter < 3) - // { - // Illusion_Timer = 500; - // ++Illusioncounter; - // } - // else { - // //15 seconds until we should cast this again - // Illusion_Timer = 15000; - // Illusioncounter = 0; - // } - // - // } else Illusion_Timer -= diff; + } DoMeleeAttackIfReady(); } + + private: + EventMap events; + SummonList Summons; }; -}; - -// Illusion of Jandice Barov Script - -class npc_illusionofjandicebarov : public CreatureScript -{ -public: - npc_illusionofjandicebarov() : CreatureScript("npc_illusionofjandicebarov") { } - CreatureAI* GetAI(Creature* creature) const override { - return new npc_illusionofjandicebarovAI(creature); + return new boss_jandicebarovAI(creature); } - - struct npc_illusionofjandicebarovAI : public ScriptedAI - { - npc_illusionofjandicebarovAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - Cleave_Timer = urand(2000, 8000); - } - - uint32 Cleave_Timer; - - void Reset() override - { - Initialize(); - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); - } - - void EnterCombat(Unit* /*who*/) override - { - } - - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - //Cast - DoCastVictim(SPELL_CLEAVE); - - //5-8 seconds - Cleave_Timer = urand(5000, 8000); - } else Cleave_Timer -= diff; - - DoMeleeAttackIfReady(); - } - }; - }; void AddSC_boss_jandicebarov() { new boss_jandice_barov(); - new npc_illusionofjandicebarov(); } |