diff options
12 files changed, 657 insertions, 845 deletions
diff --git a/sql/FULL/world_script_texts.sql b/sql/FULL/world_script_texts.sql index c15fc6ba557..3f37206eed7 100644 --- a/sql/FULL/world_script_texts.sql +++ b/sql/FULL/world_script_texts.sql @@ -1070,8 +1070,8 @@ INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content (-1548006, 'I will purge you from this place.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11298, 1, 0, 0, 'hydross SAY_CORRUPT_SLAY1'), (-1548007, 'You are no better than they!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11299, 1, 0, 0, 'hydross SAY_CORRUPT_SLAY2'), (-1548008, 'You are the disease, not I', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11300, 1, 0, 0, 'hydross SAY_CORRUPT_DEATH'), -(-1548009, 'Finally my banishment ends!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11312, 1, 0, 0, 'leotheras SAY_AGGRO'), -(-1548010, 'Be gone trifling elf. I''m in control now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11304, 1, 0, 0, 'leotheras SAY_SWITCH_TO_DEMON'), +(-1548009, 'Finally, my banishment ends!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11312, 1, 0, 0, 'leotheras SAY_AGGRO'), +(-1548010, 'Be gone, trifling elf. I am in control now!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11304, 1, 0, 0, 'leotheras SAY_SWITCH_TO_DEMON'), (-1548011, 'We all have our demons...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11305, 1, 0, 0, 'leotheras SAY_INNER_DEMONS'), (-1548012, 'I have no equal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11306, 1, 0, 0, 'leotheras SAY_DEMON_SLAY1'), (-1548013, 'Perish, mortal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11307, 1, 0, 0, 'leotheras SAY_DEMON_SLAY2'), @@ -1079,7 +1079,7 @@ INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content (-1548015, 'Kill! KILL!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11314, 1, 0, 0, 'leotheras SAY_NIGHTELF_SLAY1'), (-1548016, 'That''s right! Yes!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11315, 1, 0, 0, 'leotheras SAY_NIGHTELF_SLAY2'), (-1548017, 'Who''s the master now?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11316, 1, 0, 0, 'leotheras SAY_NIGHTELF_SLAY3'), -(-1548018, 'No! NO! What have you done?! I am the master, do you hear me? I... aaghh... Can''t... contain him...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11313, 1, 0, 0, 'leotheras SAY_FINAL_FORM'), +(-1548018, 'No... no! What have you done? I am the master! Do you hear me? I am... aaggh! Can''t... contain him...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11313, 1, 0, 0, 'leotheras SAY_FINAL_FORM'), (-1548019, 'At last I am liberated. It has been too long since I have tasted true freedom!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11309, 1, 0, 0, 'leotheras SAY_FREE'), (-1548020, 'You cannot kill me! Fools, I''ll be back! I''ll... aarghh...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11317, 1, 0, 0, 'leotheras SAY_DEATH'), (-1548021, 'Guards, attention! We have visitors...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 11277, 1, 0, 0, 'karathress SAY_AGGRO'), diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index c75312a3f68..1501289bfa1 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -381,7 +381,7 @@ UPDATE `gameobject_template` SET `ScriptName` = 'go_bridge_console' WHERE `entry /* Leotheras the Blind event */ UPDATE `creature_template` SET `ScriptName`='boss_leotheras_the_blind' WHERE `entry`=21215; -UPDATE `creature_template` SET `ScriptName`='boss_leotheras_the_blind_demonform' WHERE `entry`=21845; +UPDATE `creature_template` SET `ScriptName`='boss_leotheras_the_blind_demonform' WHERE `entry`=21875; UPDATE `creature_template` SET `ScriptName`='mob_greyheart_spellbinder' WHERE `entry`=21806; UPDATE `creature_template` SET `ScriptName`='mob_inner_demon' WHERE `entry`=21857; /* Fathom-lord Karathress event */ diff --git a/sql/updates/4115_world#sd2.sql b/sql/updates/4115_world#sd2.sql new file mode 100644 index 00000000000..19cfd191d73 --- /dev/null +++ b/sql/updates/4115_world#sd2.sql @@ -0,0 +1,7 @@ +UPDATE creature_template SET ScriptName='' WHERE entry=21845; +UPDATE creature_template SET ScriptName='boss_leotheras_the_blind_demonform' WHERE entry=21875; + +UPDATE script_texts SET content_default='Finally, my banishment ends!' WHERE entry=-1548009; +UPDATE script_texts SET content_default='Be gone, trifling elf. I am in control now!' WHERE entry=-1548010; +UPDATE script_texts SET content_default='No... no! What have you done? I am the master! Do you hear me? I am... aaggh! Can\'t... contain him...' WHERE entry=-1548018; + diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp index 59cf2acf589..43bafb7cf5f 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp @@ -24,19 +24,22 @@ EndScriptData */ #include "precompiled.h" #include "def_dark_portal.h" -#define SAY_ENTER -1269012 -#define SAY_AGGRO -1269013 -#define SAY_BANISH -1269014 -#define SAY_SLAY1 -1269015 -#define SAY_SLAY2 -1269016 -#define SAY_DEATH -1269017 -#define EMOTE_FRENZY -1269018 - -#define SPELL_CLEAVE 40504 -#define SPELL_TIME_STOP 31422 -#define SPELL_ENRAGE 37605 -#define SPELL_SAND_BREATH 31473 -#define H_SPELL_SAND_BREATH 39049 +enum +{ + SAY_ENTER = -1269012, + SAY_AGGRO = -1269013, + SAY_BANISH = -1269014, + SAY_SLAY1 = -1269015, + SAY_SLAY2 = -1269016, + SAY_DEATH = -1269017, + EMOTE_FRENZY = -1269018, + + SPELL_CLEAVE = 40504, + SPELL_TIME_STOP = 31422, + SPELL_ENRAGE = 37605, + SPELL_SAND_BREATH = 31473, + H_SPELL_SAND_BREATH = 39049 +}; struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI { @@ -55,9 +58,9 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI void Reset() { - SandBreath_Timer = 30000; - TimeStop_Timer = 40000; - Frenzy_Timer = 120000; + SandBreath_Timer = 15000+rand()%15000; + TimeStop_Timer = 10000+rand()%5000; + Frenzy_Timer = 30000+rand()%15000; } void EnterCombat(Unit *who) @@ -109,15 +112,15 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI //Sand Breath if (SandBreath_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_SAND_BREATH); - SandBreath_Timer = 30000; + DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_SAND_BREATH : SPELL_SAND_BREATH); + SandBreath_Timer = 15000+rand()%10000; }else SandBreath_Timer -= diff; //Time Stop if (TimeStop_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_TIME_STOP); - TimeStop_Timer = 40000; + TimeStop_Timer = 20000+rand()%15000; }else TimeStop_Timer -= diff; //Frenzy @@ -125,7 +128,7 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI { DoScriptText(EMOTE_FRENZY, m_creature); DoCast(m_creature, SPELL_ENRAGE); - Frenzy_Timer = 120000; + Frenzy_Timer = 20000+rand()%15000; }else Frenzy_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp index 18dab77f84c..b167ac99685 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp @@ -24,19 +24,22 @@ EndScriptData */ #include "precompiled.h" #include "def_dark_portal.h" -#define SAY_ENTER -1269006 -#define SAY_AGGRO -1269007 -#define SAY_BANISH -1269008 -#define SAY_SLAY1 -1269009 -#define SAY_SLAY2 -1269010 -#define SAY_DEATH -1269011 - -#define SPELL_ARCANE_BLAST 31457 -#define H_SPELL_ARCANE_BLAST 38538 -#define SPELL_ARCANE_DISCHARGE 31472 -#define H_SPELL_ARCANE_DISCHARGE 38539 -#define SPELL_TIME_LAPSE 31467 -#define SPELL_ATTRACTION 38540 //Not Implemented (Heroic mode) +enum +{ + SAY_ENTER = -1269006, + SAY_AGGRO = -1269007, + SAY_BANISH = -1269008, + SAY_SLAY1 = -1269009, + SAY_SLAY2 = -1269010, + SAY_DEATH = -1269011, + + SPELL_ARCANE_BLAST = 31457, + H_SPELL_ARCANE_BLAST = 38538, + SPELL_ARCANE_DISCHARGE = 31472, + H_SPELL_ARCANE_DISCHARGE = 38539, + SPELL_TIME_LAPSE = 31467, + SPELL_ATTRACTION = 38540 //Not Implemented (Heroic mode) +}; struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI { @@ -51,11 +54,15 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI uint32 ArcaneBlast_Timer; uint32 TimeLapse_Timer; + uint32 Attraction_Timer; + uint32 ArcaneDischarge_Timer; void Reset() { - ArcaneBlast_Timer = 20000; - TimeLapse_Timer = 15000; + ArcaneBlast_Timer = 18000+rand()%5000; + TimeLapse_Timer = 10000+rand()%5000; + ArcaneDischarge_Timer = 20000+rand()%10000; + Attraction_Timer = 25000+rand()%10000; } void EnterCombat(Unit *who) @@ -104,10 +111,18 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI //Arcane Blast if (ArcaneBlast_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_ARCANE_BLAST); - ArcaneBlast_Timer = 20000+rand()%5000; + DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_ARCANE_BLAST : SPELL_ARCANE_BLAST); + ArcaneBlast_Timer = 15000+rand()%10000; }else ArcaneBlast_Timer -= diff; + //Arcane Discharge + if (ArcaneDischarge_Timer < diff) + { + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); + DoCast(target,HeroicMode ? H_SPELL_ARCANE_DISCHARGE : SPELL_ARCANE_DISCHARGE); + ArcaneDischarge_Timer = 20000+rand()%10000; + }else ArcaneDischarge_Timer -= diff; + //Time Lapse if (TimeLapse_Timer < diff) { @@ -116,6 +131,15 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI TimeLapse_Timer = 15000+rand()%10000; }else TimeLapse_Timer -= diff; + if (HeroicMode) + { + if (Attraction_Timer < diff) + { + DoCast(m_creature,SPELL_ATTRACTION); + Attraction_Timer = 25000+rand()%10000; + }else Attraction_Timer -= diff; + } + DoMeleeAttackIfReady(); } }; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp index edf204c20e4..eea9a28da36 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp @@ -24,18 +24,21 @@ EndScriptData */ #include "precompiled.h" #include "def_dark_portal.h" -#define SAY_ENTER -1269000 -#define SAY_AGGRO -1269001 -#define SAY_BANISH -1269002 -#define SAY_SLAY1 -1269003 -#define SAY_SLAY2 -1269004 -#define SAY_DEATH -1269005 - -#define SPELL_HASTE 31458 -#define SPELL_MORTAL_WOUND 31464 -#define SPELL_WING_BUFFET 31475 -#define H_SPELL_WING_BUFFET 38593 -#define SPELL_REFLECT 38592 //Not Implemented (Heroic mod) +enum +{ + SAY_ENTER = -1269000, + SAY_AGGRO = -1269001, + SAY_BANISH = -1269002, + SAY_SLAY1 = -1269003, + SAY_SLAY2 = -1269004, + SAY_DEATH = -1269005, + + SPELL_HASTE = 31458, + SPELL_MORTAL_WOUND = 31464, + SPELL_WING_BUFFET = 31475, + H_SPELL_WING_BUFFET = 38593, + SPELL_REFLECT = 38592 //Not Implemented (Heroic mod) +}; struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI { @@ -50,14 +53,18 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI uint32 Haste_Timer; uint32 SpellReflection_Timer; + uint32 MortalWound_Timer; + uint32 WingBuffet_Timer; void Reset() { m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - Haste_Timer = 20000; - SpellReflection_Timer = 40000; + Haste_Timer = 15000+rand()%8000; + SpellReflection_Timer = 30000; + MortalWound_Timer = 8000; + WingBuffet_Timer = 25000+rand()%10000; } void EnterCombat(Unit *who) @@ -111,12 +118,28 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI Haste_Timer = 20000+rand()%5000; }else Haste_Timer -= diff; - //Spell Reflection - if (SpellReflection_Timer < diff) + //MortalWound_Timer + if (MortalWound_Timer < diff) + { + DoCast(m_creature, SPELL_MORTAL_WOUND); + MortalWound_Timer = 10000+rand()%10000; + }else MortalWound_Timer -= diff; + + //Wing ruffet + if (WingBuffet_Timer < diff) { - DoCast(m_creature, SPELL_REFLECT); - SpellReflection_Timer = 40000+rand()%10000; - }else SpellReflection_Timer -= diff; + DoCast(m_creature,HeroicMode ? H_SPELL_WING_BUFFET : SPELL_WING_BUFFET); + WingBuffet_Timer = 20000+rand()%10000; + }else WingBuffet_Timer -= diff; + + if (HeroicMode) + { + if (SpellReflection_Timer < diff) + { + DoCast(m_creature,SPELL_REFLECT); + SpellReflection_Timer = 25000+rand()%10000; + }else SpellReflection_Timer -= diff; + } DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp index d23ab67d938..daeefa36159 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp @@ -150,15 +150,10 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI void SpawnAdds() { - uint32 uiAdd = 0; + for(uint8 i = 0; i < 4; ++i) + DoSpawnCreature(m_bCorruptedForm ? NPC_TAINTED_SPAWN : NPC_PURE_SPAWN, + afSpawnDiffs[i][0], afSpawnDiffs[i][1], 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (m_bCorruptedForm) - uiAdd = NPC_TAINTED_SPAWN; - else - uiAdd = NPC_PURE_SPAWN; - - for(uint8 i = 0; i < 4; i++) - DoSpawnCreature(uiAdd, afSpawnDiffs[i][0], afSpawnDiffs[i][1], 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); } void UpdateAI(const uint32 uiDiff) diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index e1fdcf5ab15..79b9c6d3c34 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -16,220 +16,179 @@ /* ScriptData SDName: Boss_Lady_Vashj -SD%Complete: 99 -SDComment: Missing blizzlike Shield Generators coords +SD%Complete: 60 +SDComment: Code cleanup needed. This script needs further adjustments. SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "precompiled.h" #include "def_serpent_shrine.h" #include "../../../creature/simple_ai.h" +#include "Item.h" #include "Spell.h" -#define SAY_INTRO -1548042 -#define SAY_AGGRO1 -1548043 -#define SAY_AGGRO2 -1548044 -#define SAY_AGGRO3 -1548045 -#define SAY_AGGRO4 -1548046 -#define SAY_PHASE1 -1548047 -#define SAY_PHASE2 -1548048 -#define SAY_PHASE3 -1548049 -#define SAY_BOWSHOT1 -1548050 -#define SAY_BOWSHOT2 -1548051 -#define SAY_SLAY1 -1548052 -#define SAY_SLAY2 -1548053 -#define SAY_SLAY3 -1548054 -#define SAY_DEATH -1548055 - -#define SPELL_SURGE 38044 -#define SPELL_MULTI_SHOT 38310 -#define SPELL_SHOCK_BLAST 38509 -#define SPELL_ENTANGLE 38316 -#define SPELL_STATIC_CHARGE_TRIGGER 38280 -#define SPELL_FORKED_LIGHTNING 40088 -#define SPELL_SHOOT 40873 -#define SPELL_POISON_BOLT 40095 -#define SPELL_TOXIC_SPORES 38575 -#define SPELL_MAGIC_BARRIER 38112 - -#define MIDDLE_X 30.134 -#define MIDDLE_Y -923.65 -#define MIDDLE_Z 42.9 - -#define SPOREBAT_X 30.977156 -#define SPOREBAT_Y -925.297761 -#define SPOREBAT_Z 77.176567 -#define SPOREBAT_O 5.223932 - -#define SHIED_GENERATOR_CHANNEL 19870 -#define ENCHANTED_ELEMENTAL 21958 -#define TAINTED_ELEMENTAL 22009 -#define COILFANG_STRIDER 22056 -#define COILFANG_ELITE 22055 -#define TOXIC_SPOREBAT 22140 -#define TOXIC_SPORES_TRIGGER 22207 - -float ElementPos[8][4] = +enum { - {8.3, -835.3, 21.9, 5}, - {53.4, -835.3, 21.9, 4.5}, - {96, -861.9, 21.8, 4}, - {96, -986.4, 21.4, 2.5}, - {54.4, -1010.6, 22, 1.8}, - {9.8, -1012, 21.7, 1.4}, - {-35, -987.6, 21.5, 0.8}, - {-58.9, -901.6, 21.5, 6} + SAY_INTRO = -1548042, + SAY_AGGRO1 = -1548043, + SAY_AGGRO2 = -1548044, + SAY_AGGRO3 = -1548045, + SAY_AGGRO4 = -1548046, + SAY_PHASE1 = -1548047, + SAY_PHASE2 = -1548048, + SAY_PHASE3 = -1548049, + SAY_BOWSHOT1 = -1548050, + SAY_BOWSHOT2 = -1548051, + SAY_SLAY1 = -1548052, + SAY_SLAY2 = -1548053, + SAY_SLAY3 = -1548054, + SAY_DEATH = -1548055, + + POINT_MOVE_CENTER = 0, + + PHASE_1 = 1, + PHASE_2 = 2, + PHASE_3 = 3, + + SPELL_MULTI_SHOT = 38310, + SPELL_SHOCK_BLAST = 38509, + SPELL_ENTANGLE = 38316, + SPELL_STATIC_CHARGE_TRIGGER = 38280, + SPELL_FORKED_LIGHTNING = 38145, + SPELL_SHOOT = 38295, + + SPELL_TOXIC_SPORES = 38575, + SPELL_MAGIC_BARRIER = 38112, + SPELL_SURGE = 38044, + + //tainted elemental + SPELL_POISON_BOLT = 38253, + SPELL_SUMMON_TAINTED = 38139, + + NPC_ENCHANTED_ELEMENTAL = 21958, + NPC_TAINTED_ELEMENTAL = 22009, + NPC_COILFANG_STRIDER = 22056, + NPC_COILFANG_ELITE = 22055, + NPC_TOXIC_SPOREBAT = 22140, + + NPC_SHIELD_GENERATOR = 19870 }; -float ElementWPPos[8][3] = -{ - {71.700752, -883.905884, 41.097168}, - {45.039848, -868.022827, 41.097015}, - {14.585141, -867.894470, 41.097061}, - {-25.415508, -906.737732, 41.097061}, - {-11.801594, -963.405884, 41.097067}, - {14.556657, -979.051514, 41.097137}, - {43.466549, -979.406677, 41.097027}, - {69.945908, -964.663940, 41.097054} -}; +const float afMiddlePos[3] = {30.134f, -923.65f, 42.9f}; + +const float afSporebatPos[4] = {30.977156f, -925.297761f, 77.176567f, 5.223932f}; -float SporebatWPPos[8][3] = +const float afElementPos[8][4] = { - {31.6,-896.3,59.1}, - {9.1, -913.9, 56}, - {5.2, -934.4, 52.4}, - {20.7, -946.9, 49.7}, - {41, -941.9, 51}, - {47.7, -927.3, 55}, - {42.2, -912.4, 51.7}, - {27, -905.9, 50} + {8.3f , -835.3f , 21.9f, 5.0f}, + {53.4f , -835.3f , 21.9f, 4.5f}, + {96.0f , -861.9f , 21.8f, 4.0f}, + {96.0f , -986.4f , 21.4f, 2.5f}, + {54.4f , -1010.6f, 22.0f, 1.8f}, + {9.8f , -1012.0f, 21.7f, 1.4f}, + {-35.0f, -987.6f , 21.5f, 0.8f}, + {-58.9f, -901.6f , 21.5f, 6.0f} }; -float CoilfangElitePos[3][4] = +const float afCoilfangElitePos[3][4] = { - {28.84, -923.28, 42.9, 6}, - {31.183281, -953.502625, 41.523602, 1.640957}, - {58.895180, -923.124268, 41.545307, 3.152848} + {28.84f , -923.28f , 42.9f , 6.0f }, + {31.183281f, -953.502625f, 41.523602f, 1.640957f}, + {58.895180f, -923.124268f, 41.545307f, 3.152848f} }; -float CoilfangStriderPos[3][4] = +const float afCoilfangStriderPos[3][4] = { - {66.427010, -948.778503, 41.262245, 2.584220}, - {7.513962, -959.538208, 41.300422, 1.034629}, - {-12.843201, -907.798401, 41.239620, 6.087094} + {66.427f, -948.778f, 41.262245f, 2.584f}, + {7.513f , -959.538f, 41.300422f, 1.0346f}, + {-12.843f, -907.798f, 41.239620f, 6.087f} }; -float ShieldGeneratorChannelPos[4][4] = +const float afShieldGeneratorChannelPos[4][4] = { - {49.6262, -902.181, 43.0975, 3.95683}, - {10.988, -901.616, 42.5371, 5.4373}, - {10.3859, -944.036, 42.5446, 0.779888}, - {49.3126, -943.398, 42.5501, 2.40174} + {49.626f, -902.181f, 41.54f, 3.956f}, + {10.988f, -901.616f, 41.54f, 5.437f}, + {10.385f, -944.036f, 41.54f, 0.779f}, + {49.312f, -943.398f, 41.54f, 2.401f} }; //Lady Vashj AI -struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI +struct MANGOS_DLL_DECL boss_lady_vashjAI : public ScriptedAI { - boss_lady_vashjAI (Creature *c) : ScriptedAI(c) + boss_lady_vashjAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = c->GetInstanceData(); - Intro = false; - JustCreated = true; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on creature create (no need do intro if wiped) + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + + for(uint8 i = 0; i < 4; i++) + m_auiShieldGeneratorChannel[i] = 0; + + Reset(); } - ScriptedInstance *pInstance; - - uint64 ShieldGeneratorChannel[4]; - - uint32 AggroTimer; - uint32 ShockBlast_Timer; - uint32 Entangle_Timer; - uint32 StaticCharge_Timer; - uint32 ForkedLightning_Timer; - uint32 Check_Timer; - uint32 EnchantedElemental_Timer; - uint32 TaintedElemental_Timer; - uint32 CoilfangElite_Timer; - uint32 CoilfangStrider_Timer; - uint32 SummonSporebat_Timer; - uint32 SummonSporebat_StaticTimer; - uint8 EnchantedElemental_Pos; - uint8 Phase; - - bool Entangle; - bool Intro; - bool CanAttack; - bool JustCreated; + ScriptedInstance *m_pInstance; // the instance + + uint64 m_auiShieldGeneratorChannel[4]; + + // timers + uint32 m_uiShockBlast_Timer; + uint32 m_uiEntangle_Timer; + uint32 m_uiStaticCharge_Timer; + uint32 m_uiForkedLightning_Timer; + uint32 m_uiCheck_Timer; + uint32 m_uiEnchantedElemental_Timer; + uint32 m_uiTaintedElemental_Timer; + uint32 m_uiCoilfangElite_Timer; + uint32 m_uiCoilfangStrider_Timer; + uint32 m_uiSummonSporebat_Timer; + uint32 m_uiSummonSporebat_StaticTimer; + uint8 m_uiEnchantedElemental_Pos; + uint8 m_uiPhase; + + bool m_bEntangle; void Reset() { - AggroTimer = 19000; - ShockBlast_Timer = 1+rand()%60000; - Entangle_Timer = 30000; - StaticCharge_Timer = 10000+rand()%15000; - ForkedLightning_Timer = 2000; - Check_Timer = 15000; - EnchantedElemental_Timer = 5000; - TaintedElemental_Timer = 50000; - CoilfangElite_Timer = 45000+rand()%5000; - CoilfangStrider_Timer = 60000+rand()%10000; - SummonSporebat_Timer = 10000; - SummonSporebat_StaticTimer = 30000; - EnchantedElemental_Pos = 0; - Phase = 0; - - Entangle = false; - if(JustCreated) - { - CanAttack = false; - JustCreated = false; - }else CanAttack = true; + SetCombatMovement(true); - Unit *remo; - for(uint8 i = 0; i < 4; i++) - { - remo = Unit::GetUnit(*m_creature, ShieldGeneratorChannel[i]); - if (remo) - remo->setDeathState(JUST_DIED); - } + m_uiShockBlast_Timer = 1+rand()%60000; + m_uiEntangle_Timer = 30000; + m_uiStaticCharge_Timer = 10000+rand()%15000; + m_uiCheck_Timer = 1000; - if(pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); - ShieldGeneratorChannel[0] = 0; - ShieldGeneratorChannel[1] = 0; - ShieldGeneratorChannel[2] = 0; - ShieldGeneratorChannel[3] = 0; + m_uiForkedLightning_Timer = 43000+rand()%6000; + m_uiEnchantedElemental_Timer = 10000; + m_uiTaintedElemental_Timer = 50000; + m_uiCoilfangElite_Timer = 45000; + m_uiCoilfangStrider_Timer = 60000; - m_creature->SetCorpseDelay(1000*60*60); - } + m_uiSummonSporebat_Timer = 10000; + m_uiSummonSporebat_StaticTimer = 30000; + m_uiEnchantedElemental_Pos = 0; + m_uiPhase = PHASE_1; - //Called when a tainted elemental dies - void EventTaintedElementalDeath() - { - //the next will spawn 50 seconds after the previous one's death - if(TaintedElemental_Timer > 50000) - TaintedElemental_Timer = 50000; - } - void KilledUnit(Unit *victim) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; - } + m_bEntangle = false; + + RemoveAllShieldGenerators(); + + if (m_pInstance) + m_pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); } - void JustDied(Unit *victim) + void RemoveAllShieldGenerators() { - DoScriptText(SAY_DEATH, m_creature); + for(uint8 i = 0; i < 4; i++) + { + if (Unit* pTemp = Unit::GetUnit(*m_creature,m_auiShieldGeneratorChannel[i])) + { + if (pTemp->isAlive()) + pTemp->setDeathState(JUST_DIED); - if(pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, DONE); + m_auiShieldGeneratorChannel[i] = 0; + } + } } - void StartEvent() + void Aggro(Unit* pWho) { switch(rand()%4) { @@ -239,592 +198,419 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI case 3: DoScriptText(SAY_AGGRO4, m_creature); break; } - Phase = 1; - - if(pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, IN_PROGRESS); + if (m_pInstance) + m_pInstance->SetData(DATA_LADYVASHJEVENT, IN_PROGRESS); } - void EnterCombat(Unit *who) + void MovementInform(uint32 uiType, uint32 uiPointId) { - if (pInstance) + if (uiType != POINT_MOTION_TYPE) + return; + + if (uiPointId == POINT_MOVE_CENTER) { - //remove old tainted cores to prevent cheating in phase 2 - Map *map = m_creature->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin();i != PlayerList.end(); ++i) + m_creature->RemoveAllAuras(); + + for(uint8 i = 0; i < 4; i++) { - if(Player* i_pl = i->getSource()) - { - i_pl->DestroyItemCount(31088, 1, true); - } + if (Creature* pCreature = m_creature->SummonCreature(NPC_SHIELD_GENERATOR, afShieldGeneratorChannelPos[i][0], afShieldGeneratorChannelPos[i][1], afShieldGeneratorChannelPos[i][2], afShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0)) + m_auiShieldGeneratorChannel[i] = pCreature->GetGUID(); } } - if(Phase != 2) - AttackStart(who); - - if(!m_creature->isInCombat()) - StartEvent(); } - void MoveInLineOfSight(Unit *who) + void JustSummoned(Creature* pSummoned) { - if (!Intro) + uint32 uiEntry = pSummoned->GetEntry(); + + if (uiEntry == NPC_COILFANG_STRIDER || uiEntry == NPC_COILFANG_ELITE || uiEntry == NPC_TOXIC_SPOREBAT) { - Intro = true; - DoScriptText(SAY_INTRO, m_creature); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); } - if (!CanAttack) - return; - if (!who || m_creature->getVictim()) - return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + if (uiEntry == NPC_SHIELD_GENERATOR) { - float attackRadius = m_creature->GetAttackDistance(who); - if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) + //we should really expect database to have this set already + if (!pSummoned->HasFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))) { - //if(who->HasStealthAura()) - // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - - if(Phase != 2) - AttackStart(who); - - if(!m_creature->isInCombat()) - StartEvent(); + pSummoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pSummoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } + + pSummoned->CastSpell(m_creature,SPELL_MAGIC_BARRIER,true); } } - void CastShootOrMultishot() + //called when any summoned (by m_creature) despawns + void SummonedCreatureDespawn(Creature* pDespawned) { - switch(rand()%2) + if (pDespawned->GetEntry() == NPC_TAINTED_ELEMENTAL) { - case 0: - //Shoot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. - DoCast(m_creature->getVictim(), SPELL_SHOOT); - break; - case 1: - //Multishot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. - DoCast(m_creature->getVictim(), SPELL_MULTI_SHOT); - break; - } - if(rand()%3) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_BOWSHOT1, m_creature); break; - case 1: DoScriptText(SAY_BOWSHOT2, m_creature); break; - } + if (m_uiTaintedElemental_Timer > 50000) + m_uiTaintedElemental_Timer = 50000; } } - void UpdateAI(const uint32 diff) + void KilledUnit(Unit* pVictim) { - if(!CanAttack && Intro) - { - if(AggroTimer < diff) - { - CanAttack = true; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer=19000; - }else - { - AggroTimer-=diff; - return; - } - } - //to prevent abuses during phase 2 - if(Phase == 2 && !m_creature->getVictim() && m_creature->isInCombat()) + switch(rand()%3) { - EnterEvadeMode(); - return; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } + } + + void JustDied(Unit* pVictim) + { + DoScriptText(SAY_DEATH, m_creature); + + if (m_pInstance) + m_pInstance->SetData(DATA_LADYVASHJEVENT, DONE); + } + + void CastShootOrMultishot() + { + //Shoot: Used in m_uiPhases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. + //Multishot: Used in m_uiPhases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. + DoCast(m_creature->getVictim(), urand(0,1) ? SPELL_SHOOT : SPELL_MULTI_SHOT); + + if (rand()%3) + DoScriptText(urand(0,1) ? SAY_BOWSHOT1 : SAY_BOWSHOT2, m_creature); + } + + void UpdateAI(const uint32 uiDiff) + { //Return since we have no target - if (!UpdateVictim() ) + if (!UpdateVictim()) return; - if(Phase == 1 || Phase == 3) + if (m_uiPhase == PHASE_1 || m_uiPhase == PHASE_3) { - //ShockBlast_Timer - if (ShockBlast_Timer < diff) + //m_uiShockBlast_Timer + if (m_uiShockBlast_Timer < uiDiff) { - //Shock Burst - //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. + //Randomly used in m_uiPhases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. DoCast(m_creature->getVictim(), SPELL_SHOCK_BLAST); - m_creature->TauntApply(m_creature->getVictim()); - ShockBlast_Timer = 1000+rand()%14000; //random cooldown - }else ShockBlast_Timer -= diff; + m_uiShockBlast_Timer = 1000+rand()%14000; //random cooldown + }else m_uiShockBlast_Timer -= uiDiff; - //StaticCharge_Timer - if(StaticCharge_Timer < diff) + //m_uiStaticCharge_Timer + if (m_uiStaticCharge_Timer < uiDiff) { - //Static Charge - //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); + //Used on random people (only 1 person at any given time) in m_uiPhases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) - //cast Static Charge every 2 seconds for 20 seconds - DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); + //cast Static Charge every 2 seconds for 20 seconds + if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) + DoCast(pTarget, SPELL_STATIC_CHARGE_TRIGGER); - StaticCharge_Timer = 10000+rand()%20000; //blizzlike - }else StaticCharge_Timer -= diff; + m_uiStaticCharge_Timer = 10000+rand()%20000; + }else m_uiStaticCharge_Timer -= uiDiff; - //Entangle_Timer - if (Entangle_Timer < diff) + //m_uiEntangle_Timer + if (m_uiEntangle_Timer < uiDiff) { - if(!Entangle) + if (!m_bEntangle) { - //Entangle - //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. + //Used in m_uiPhases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. DoCast(m_creature->getVictim(), SPELL_ENTANGLE); - Entangle = true; - Entangle_Timer = 10000; + m_bEntangle = true; + m_uiEntangle_Timer = 10000; } else { CastShootOrMultishot(); - Entangle = false; - Entangle_Timer = 20000+rand()%5000; + m_bEntangle = false; + m_uiEntangle_Timer = 20000+rand()%5000; } - }else Entangle_Timer -= diff; + }else m_uiEntangle_Timer -= uiDiff; - //Phase 1 - if(Phase == 1) + //m_uiPhase 1 + if (m_uiPhase == PHASE_1) { - //Start phase 2 - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 70) + //m_uiPhase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 70) { - //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. - Phase = 2; - - m_creature->GetMotionMaster()->Clear(); - DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); + DoScriptText(SAY_PHASE2, m_creature); - Creature *pCreature; - for(uint8 i = 0; i < 4; i++) + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) { - pCreature = m_creature->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (pCreature) - ShieldGeneratorChannel[i] = pCreature->GetGUID(); + //set false, so MoveChase is not triggered in AttackStart + SetCombatMovement(false); + + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MovePoint(POINT_MOVE_CENTER, afMiddlePos[0], afMiddlePos[1], afMiddlePos[2]); } - DoScriptText(SAY_PHASE2, m_creature); + + m_uiPhase = PHASE_2; + return; } } - //Phase 3 + //m_uiPhase PHASE_3 else { - //SummonSporebat_Timer - if(SummonSporebat_Timer < diff) + //m_uiSummonSporebat_Timer + if (m_uiSummonSporebat_Timer < uiDiff) { - Creature *Sporebat = NULL; - Sporebat = m_creature->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0); - - if(Sporebat) - { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) - Sporebat->AI()->AttackStart(target); - } + m_creature->SummonCreature(NPC_TOXIC_SPOREBAT, + afSporebatPos[0], afSporebatPos[1], afSporebatPos[2], afSporebatPos[3], + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); //summon sporebats faster and faster - if(SummonSporebat_StaticTimer > 1000) - SummonSporebat_StaticTimer -= 1000; - - SummonSporebat_Timer = SummonSporebat_StaticTimer; + if (m_uiSummonSporebat_StaticTimer > 1000) + m_uiSummonSporebat_StaticTimer -= 1000; - if(SummonSporebat_Timer < 5000) - SummonSporebat_Timer = 5000; - - }else SummonSporebat_Timer -= diff; + m_uiSummonSporebat_Timer = m_uiSummonSporebat_StaticTimer; + }else m_uiSummonSporebat_Timer -= uiDiff; } //Melee attack DoMeleeAttackIfReady(); - //Check_Timer - used to check if somebody is in melee range - if(Check_Timer < diff) + //m_uiCheck_Timer - used to check if somebody is in melee range + if (m_uiCheck_Timer < uiDiff) { - bool InMeleeRange = false; - Unit *target; + bool bInMeleeRange = false; std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - //if in melee range - if(target && target->IsWithinDistInMap(m_creature, 5)) + Unit* pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); + + //if in melee range + if (pTarget && pTarget->IsWithinDistInMap(m_creature, ATTACK_DISTANCE)) { - InMeleeRange = true; + bInMeleeRange = true; break; } } //if nobody is in melee range - if(!InMeleeRange) + if (!bInMeleeRange) CastShootOrMultishot(); - Check_Timer = 5000; - }else Check_Timer -= diff; + m_uiCheck_Timer = 1500; + }else m_uiCheck_Timer -= uiDiff; } - //Phase 2 + //m_uiPhase PHASE_2 else { - //ForkedLightning_Timer - if(ForkedLightning_Timer < diff) + //m_uiForkedLightning_Timer + if (m_uiForkedLightning_Timer < uiDiff) { - //Forked Lightning - //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); + //Used constantly in m_uiPhase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(!target) - target = m_creature->getVictim(); + if (!pTarget) + pTarget = m_creature->getVictim(); - DoCast(target, SPELL_FORKED_LIGHTNING); + DoCast(pTarget, SPELL_FORKED_LIGHTNING); - ForkedLightning_Timer = 2000+rand()%6000; //blizzlike - }else ForkedLightning_Timer -= diff; + m_uiForkedLightning_Timer = 3000+rand()%6000; + }else m_uiForkedLightning_Timer -= uiDiff; - //EnchantedElemental_Timer - if(EnchantedElemental_Timer < diff) + //NPC_ENCHANTED_ELEMENTAL + if (m_uiEnchantedElemental_Timer < uiDiff) { - Creature *Elemental; - Elemental = m_creature->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Creature* pElemental = m_creature->SummonCreature(NPC_ENCHANTED_ELEMENTAL, afElementPos[m_uiEnchantedElemental_Pos][0], afElementPos[m_uiEnchantedElemental_Pos][1], afElementPos[m_uiEnchantedElemental_Pos][2], afElementPos[m_uiEnchantedElemental_Pos][3], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + pElemental->GetMotionMaster()->MoveFollow(m_creature, 0.0f, 0.0f); - if(EnchantedElemental_Pos == 7) - EnchantedElemental_Pos = 0; + if (m_uiEnchantedElemental_Pos == 7) + m_uiEnchantedElemental_Pos = 0; else - EnchantedElemental_Pos++; + ++m_uiEnchantedElemental_Pos; - EnchantedElemental_Timer = 10000+rand()%5000; - }else EnchantedElemental_Timer -= diff; + m_uiEnchantedElemental_Timer = 10000+rand()%5000; + }else m_uiEnchantedElemental_Timer -= uiDiff; - //TaintedElemental_Timer - if(TaintedElemental_Timer < diff) + //NPC_TAINTED_ELEMENTAL + if (m_uiTaintedElemental_Timer < uiDiff) { - Creature *Tain_Elemental; - uint32 pos = rand()%8; - Tain_Elemental = m_creature->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0); + uint32 uiPos = urand(0,7); + + m_creature->SummonCreature(NPC_TAINTED_ELEMENTAL, + afElementPos[uiPos][0], afElementPos[uiPos][1], afElementPos[uiPos][2], afElementPos[uiPos][3], + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 15000); - TaintedElemental_Timer = 120000; - }else TaintedElemental_Timer -= diff; + m_uiTaintedElemental_Timer = 120000; + }else m_uiTaintedElemental_Timer -= uiDiff; - //CoilfangElite_Timer - if(CoilfangElite_Timer < diff) + //NPC_COILFANG_ELITE + if (m_uiCoilfangElite_Timer < uiDiff) { - uint32 pos = rand()%3; - Creature* CoilfangElite = NULL; - CoilfangElite = m_creature->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if(CoilfangElite) - { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) - CoilfangElite->AI()->AttackStart(target); - else if(m_creature->getVictim()) - CoilfangElite->AI()->AttackStart(m_creature->getVictim()); - } - CoilfangElite_Timer = 45000+rand()%5000; - }else CoilfangElite_Timer -= diff; + uint32 uiPos = urand(0,2); + + m_creature->SummonCreature(NPC_COILFANG_ELITE, + afCoilfangElitePos[uiPos][0], afCoilfangElitePos[uiPos][1], afCoilfangElitePos[uiPos][2], afCoilfangElitePos[uiPos][3], + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 45000); - //CoilfangStrider_Timer - if(CoilfangStrider_Timer < diff) + //wowwiki says 50 seconds, bosskillers says 45 + m_uiCoilfangElite_Timer = 45000+rand()%5000; + }else m_uiCoilfangElite_Timer -= uiDiff; + + //NPC_COILFANG_STRIDER + if (m_uiCoilfangStrider_Timer < uiDiff) { - uint32 pos = rand()%3; - Creature* CoilfangStrider = NULL; - CoilfangStrider = m_creature->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if(CoilfangStrider) - { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) - CoilfangStrider->AI()->AttackStart(target); - else if(m_creature->getVictim()) - CoilfangStrider->AI()->AttackStart(m_creature->getVictim()); - } - CoilfangStrider_Timer = 60000+rand()%10000; - }else CoilfangStrider_Timer -= diff; + uint32 uiPos = urand(0,2); + + m_creature->SummonCreature(NPC_COILFANG_STRIDER, + afCoilfangStriderPos[uiPos][0], afCoilfangStriderPos[uiPos][1], afCoilfangStriderPos[uiPos][2], afCoilfangStriderPos[uiPos][3], + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + + //wowwiki says 60 seconds, bosskillers says 60-70 + m_uiCoilfangStrider_Timer = 60000+rand()%10000; + }else m_uiCoilfangStrider_Timer -= uiDiff; - //Check_Timer - if(Check_Timer < diff) + //m_uiCheck_Timer + if (m_uiCheck_Timer < uiDiff) { - //Start Phase 3 - if(pInstance && pInstance->GetData(DATA_CANSTARTPHASE3)) + //Start m_uiPhase 3 + if (m_pInstance && m_pInstance->GetData(DATA_CANSTARTPHASE3)) { - //set life 50% + DoScriptText(SAY_PHASE3, m_creature); + + //set life 50%, not correct. Must remove 5% for each generator switched off m_creature->SetHealth(m_creature->GetMaxHealth()/2); - m_creature->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); + //m_creature->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); - DoScriptText(SAY_PHASE3, m_creature); + SetCombatMovement(true); - Phase = 3; + //return to chase top aggro + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - //return to the tank - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_uiPhase = PHASE_3; } - Check_Timer = 1000; - }else Check_Timer -= diff; + m_uiCheck_Timer = 1000; + }else m_uiCheck_Timer -= uiDiff; } } }; //Enchanted Elemental //If one of them reaches Vashj he will increase her damage done by 5%. -struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI +struct MANGOS_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI { - mob_enchanted_elementalAI(Creature *c) : ScriptedAI(c) + mob_enchanted_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = c->GetInstanceData(); + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + SetCombatMovement(false); + Reset(); } - ScriptedInstance *pInstance; - uint32 move; - uint32 phase; - float x, y, z; - Creature *Vashj; + ScriptedInstance *m_pInstance; // the instance - void Reset() - { - m_creature->SetSpeed(MOVE_WALK,0.6);//walk - m_creature->SetSpeed(MOVE_RUN,0.6);//run - move = 0; - phase = 1; - Vashj = NULL; + void Reset() { } - for (int i = 0;i<8;i++)//search for nearest waypoint (up on stairs) + void MoveInLineOfSight(Unit* pWho) + { + if (m_pInstance) { - if (!x || !y || !z) - { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - else + if (Unit* pVashj = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_LADYVASHJ))) { - if (m_creature->GetDistance(ElementWPPos[i][0],ElementWPPos[i][1],ElementWPPos[i][2]) < m_creature->GetDistance(x,y,z)) + if (pVashj->IsWithinDistInMap(m_creature, ATTACK_DISTANCE)) { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; + //increase lady vashj damage + if (pVashj->isAlive() && pVashj->isInCombat()) + m_creature->CastSpell(pVashj, SPELL_SURGE, false, 0, 0, pVashj->GetGUID()); + else + m_creature->setDeathState(JUST_DIED); } } } - if (pInstance) - Vashj = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); } - void EnterCombat(Unit *who) { return; } - - void MoveInLineOfSight(Unit *who){return;} - - void UpdateAI(const uint32 diff) - { - if(!pInstance) - return; - - if (!Vashj) - { - return; - } - - if(move < diff) - { - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - if (phase == 1) - { - m_creature->GetMotionMaster()->MovePoint(0, x, y, z); - } - if (phase == 1 && m_creature->GetDistance(x,y,z) < 0.1) - { - phase = 2; - } - if (phase == 2) - { - m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - phase = 3; - } - if (phase == 3) - { - m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - if(m_creature->GetDistance(MIDDLE_X, MIDDLE_Y, MIDDLE_Z) < 3) - { - SpellEntry *spell = GET_SPELL(SPELL_SURGE); - if( spell ) - { - uint8 eff_mask=0; - for (int i=0; i<3; i++) - { - if (!spell->Effect[i]) - continue; - eff_mask|=1<<i; - } - Vashj->AddAura(new Aura(spell, eff_mask, NULL, Vashj, Vashj)); - } - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } - if(!Vashj->isInCombat() || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead()) - { - //call Unsummon() - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - move = 1000; - }else move -= diff; - } + void UpdateAI(const uint32 uiDiff) { } }; //Tainted Elemental //This mob has 7,900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3,000 nature damage and placing a posion doing 2,000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental -struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI +struct MANGOS_DLL_DECL mob_tainted_elementalAI : public ScriptedAI { - mob_tainted_elementalAI(Creature *c) : ScriptedAI(c) + mob_tainted_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = c->GetInstanceData(); + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + SetCombatMovement(false); + Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance* m_pInstance; // the instance - uint32 PoisonBolt_Timer; - uint32 Despawn_Timer; + // timers + uint32 m_uiPoisonBolt_Timer; void Reset() { - PoisonBolt_Timer = 5000+rand()%5000; - Despawn_Timer = 30000; + m_uiPoisonBolt_Timer = 5000+rand()%5000; } - void JustDied(Unit *killer) + void UpdateAI(const uint32 uiDiff) { - if(pInstance) - { - Creature *Vashj = NULL; - Vashj = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ))); - - if(Vashj) - CAST_AI(boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath(); - } - } - - void EnterCombat(Unit *who) - { - m_creature->AddThreat(who, 0.1f); - } + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - //PoisonBolt_Timer - if(PoisonBolt_Timer < diff) + //m_uiPoisonBolt_Timer + if (m_uiPoisonBolt_Timer < uiDiff) { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - - if(target && target->IsWithinDistInMap(m_creature, 30)) - DoCast(target, SPELL_POISON_BOLT); - - PoisonBolt_Timer = 5000+rand()%5000; - }else PoisonBolt_Timer -= diff; + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - //Despawn_Timer - if(Despawn_Timer < diff) - { - //call Unsummon() - m_creature->setDeathState(DEAD); + if (pTarget && pTarget->IsWithinDistInMap(m_creature, 30.0f)) + DoCast(pTarget, SPELL_POISON_BOLT); - //to prevent crashes - Despawn_Timer = 1000; - }else Despawn_Timer -= diff; + m_uiPoisonBolt_Timer = 5000+rand()%5000; + }else m_uiPoisonBolt_Timer -= uiDiff; } }; //Toxic Sporebat -//Toxic Spores: Used in Phase 3 by the Spore Bats, it creates a contaminated green patch of ground, dealing about 2775-3225 nature damage every second to anyone who stands in it. -struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI +//Toxic Spores: Used in m_uiPhase 3 by the Spore Bats, it creates a contaminated green patch of ground, dealing about 2775-3225 nature damage every second to anyone who stands in it. +struct MANGOS_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI { - mob_toxic_sporebatAI(Creature *c) : ScriptedAI(c) + mob_toxic_sporebatAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = c->GetInstanceData(); - EnterEvadeMode(); + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance* m_pInstance; - uint32 movement_timer; - uint32 ToxicSpore_Timer; - uint32 bolt_timer; - uint32 Check_Timer; + uint32 m_uiToxicSpore_Timer; + uint32 m_uiCheck_Timer; void Reset() { - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->setFaction(14); - movement_timer = 0; - ToxicSpore_Timer = 5000; - bolt_timer = 5500; - Check_Timer = 1000; - } - - void EnterCombat(Unit *who) - { - - } - - void MoveInLineOfSight(Unit *who) - { - + m_uiToxicSpore_Timer = 5000; + m_uiCheck_Timer = 1000; } - void MovementInform(uint32 type, uint32 id) + void UpdateAI(const uint32 uiDiff) { - if(type != POINT_MOTION_TYPE) + //Return since we have no target + if (!UpdateVictim()) return; - if(id == 1) - movement_timer = 0; - } - - void UpdateAI (const uint32 diff) - { - //Random movement - if (movement_timer < diff) + //m_uiToxicSpore_Timer + if (m_uiToxicSpore_Timer < uiDiff) { - uint32 rndpos = rand()%8; - m_creature->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); - movement_timer = 6000; - }else movement_timer -= diff; + //The Spores will hit you anywhere in the instance: underwater, at the elevator, at the entrance, wherever. + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_TOXIC_SPORES); - //toxic spores - if(bolt_timer < diff) - { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) - { - Creature* trig = m_creature->SummonCreature(TOXIC_SPORES_TRIGGER,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); - if(trig) - { - trig->setFaction(14); - trig->CastSpell(trig, SPELL_TOXIC_SPORES,true); - } - } - bolt_timer = 10000+rand()%5000; - } - else bolt_timer -= diff; + m_uiToxicSpore_Timer = 20000+rand()%5000; + }else m_uiToxicSpore_Timer -= uiDiff; - //Check_Timer - if(Check_Timer < diff) + //m_uiCheck_Timer + if (m_uiCheck_Timer < uiDiff) { - if(pInstance) + if (m_pInstance) { //check if vashj is death - Unit *Vashj = NULL; - Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); - if(!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) + Unit* pVashj = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_LADYVASHJ)); + if (!pVashj || !pVashj->isAlive()) { //remove m_creature->setDeathState(DEAD); @@ -833,235 +619,193 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI } } - Check_Timer = 1000; - }else Check_Timer -= diff; + m_uiCheck_Timer = 1000; + }else m_uiCheck_Timer -= uiDiff; + + DoMeleeAttackIfReady(); } }; //Coilfang Elite //It's an elite Naga mob with 170,000 HP. It does about 5000 damage on plate, and has a nasty cleave hitting for about 7500 damage -CreatureAI* GetAI_mob_coilfang_elite(Creature *_Creature) +CreatureAI* GetAI_mob_coilfang_elite(Creature* pCreature) { - SimpleAI* ai = new SimpleAI (_Creature); + SimpleAI* pAI = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 31345; //Cleave - ai->Spell[0].Cooldown = 15000; - ai->Spell[0].CooldownRandomAddition = 5000; - ai->Spell[0].First_Cast = 5000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; + pAI->Spell[0].Enabled = true; + pAI->Spell[0].Spell_Id = 31345; //Cleave + pAI->Spell[0].Cooldown = 15000; + pAI->Spell[0].CooldownRandomAddition = 5000; + pAI->Spell[0].First_Cast = 5000; + pAI->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; - ai->EnterEvadeMode(); + pAI->EnterEvadeMode(); - return ai; + return pAI; } -//Coilfang Strider +//Coilfang Strifer //It hits plate for about 8000 damage, has a Mind Blast spell doing about 3000 shadow damage, and a Psychic Scream Aura, which fears everybody in a 8 yard range of it every 2-3 seconds , for 5 seconds and increasing their movement speed by 150% during the fear. -CreatureAI* GetAI_mob_coilfang_strider(Creature *_Creature) +CreatureAI* GetAI_mob_coilfang_strider(Creature* pCreature) { - SimpleAI* ai = new SimpleAI (_Creature); + SimpleAI* pAI = new SimpleAI (pCreature); - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 41374; //Mind Blast - ai->Spell[0].Cooldown = 30000; - ai->Spell[0].CooldownRandomAddition = 10000; - ai->Spell[0].First_Cast = 8000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + pAI->Spell[0].Enabled = true; + pAI->Spell[0].Spell_Id = 41374; //Mind Blast + pAI->Spell[0].Cooldown = 30000; + pAI->Spell[0].CooldownRandomAddition = 10000; + pAI->Spell[0].First_Cast = 8000; + pAI->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; //Scream aura not implemented - ai->EnterEvadeMode(); + pAI->EnterEvadeMode(); - return ai; + return pAI; } -struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI +//can probably be removed +struct MANGOS_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI { - mob_shield_generator_channelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - uint32 Check_Timer; - bool Casted; - void Reset() + mob_shield_generator_channelAI(Creature* pCreature) : ScriptedAI(pCreature) { - Check_Timer = 0; - Casted = false; - m_creature->SetDisplayId(11686); //invisible - - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + Reset(); } - void EnterCombat(Unit *who) { return; } + ScriptedInstance *m_pInstance; // the instance - void MoveInLineOfSight(Unit *who) { return; } - - void UpdateAI (const uint32 diff) - { - if(!pInstance) - return; - - if(Check_Timer < diff) - { - Unit *Vashj = NULL; - Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); + void Reset() { } - if(Vashj && Vashj->isAlive()) - { - //start visual channel - if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER)) - { - m_creature->CastSpell(Vashj,SPELL_MAGIC_BARRIER,true); - Casted = true; - } - } - Check_Timer = 1000; - }else Check_Timer -= diff; - } + void MoveInLineOfSight(Unit* pWho) { } }; -bool ItemUse_item_tainted_core(Player *player, Item* _Item, SpellCastTargets const& targets) +//this is wrong, alternative script needed +bool ItemUse_item_tainted_core(Player* pPlayer, Item* pItem, SpellCastTargets const& sctTargets) { - ScriptedInstance *pInstance = (player->GetInstanceData()) ? (player->GetInstanceData()) : NULL; + ScriptedInstance* pInstance = ((ScriptedInstance*)pPlayer->GetInstanceData()); if(!pInstance) { - player->GetSession()->SendNotification("Instance script not initialized"); + pPlayer->GetSession()->SendNotification("ERROR: Instance script not initialized. Notify your administrator."); + error_log("ERROR: Lady Vashj Tainted Core: Instance Script Not Initialized"); return true; } - Creature *Vashj = NULL; - Vashj = (Unit::GetCreature((*player), pInstance->GetData64(DATA_LADYVASHJ))); - if(Vashj && CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase == 2) + Creature* pVashj = (Creature*)(Unit::GetUnit((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ))); + if(pVashj && ((boss_lady_vashjAI*)pVashj->AI())->m_uiPhase == 2) { - if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT) + if(sctTargets.getGOTarget() && sctTargets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT) { - uint32 identifier; - uint8 channel_identifier; - switch(targets.getGOTarget()->GetEntry()) + uint32 uiIdentifier; + uint8 uiChannelIdentifier; + switch(sctTargets.getGOTarget()->GetEntry()) { case 185052: - identifier = DATA_SHIELDGENERATOR1; - channel_identifier = 0; + uiIdentifier = DATA_SHIELDGENERATOR1; + uiChannelIdentifier = 0; break; case 185053: - identifier = DATA_SHIELDGENERATOR2; - channel_identifier = 1; + uiIdentifier = DATA_SHIELDGENERATOR2; + uiChannelIdentifier = 1; break; case 185051: - identifier = DATA_SHIELDGENERATOR3; - channel_identifier = 2; + uiIdentifier = DATA_SHIELDGENERATOR3; + uiChannelIdentifier = 2; break; case 185054: - identifier = DATA_SHIELDGENERATOR4; - channel_identifier = 3; + uiIdentifier = DATA_SHIELDGENERATOR4; + uiChannelIdentifier = 3; break; default: return true; + break; } - if(pInstance->GetData(identifier)) + if(pInstance->GetData(uiIdentifier)) { - player->GetSession()->SendNotification("Already deactivated"); + pPlayer->GetSession()->SendNotification("Already deactivated"); return true; } //get and remove channel - Unit *Channel = NULL; - Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]); - if(Channel) - { - //call Unsummon() - Channel->setDeathState(JUST_DIED); - } + if(Unit* pChannel = Unit::GetUnit((*pVashj), ((boss_lady_vashjAI*)pVashj->AI())->m_auiShieldGeneratorChannel[uiChannelIdentifier])) + pChannel->setDeathState(JUST_DIED); //calls Unsummon() - pInstance->SetData(identifier, 1); + pInstance->SetData(uiIdentifier, 1); //remove this item - player->DestroyItemCount(31088, 1, true); - return true; - } - else if( targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT ) - return false; - else if(targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) - { - player->DestroyItemCount(31088, 1, true); - player->CastSpell(targets.getUnitTarget(), 38134, true); - return true; + pPlayer->DestroyItemCount(31088, 1, true); } } return true; } -CreatureAI* GetAI_boss_lady_vashj(Creature *_Creature) +CreatureAI* GetAI_boss_lady_vashj(Creature* pCreature) { - return new boss_lady_vashjAI (_Creature); + return new boss_lady_vashjAI(pCreature); } -CreatureAI* GetAI_mob_enchanted_elemental(Creature *_Creature) +CreatureAI* GetAI_mob_enchanted_elemental(Creature* pCreature) { - return new mob_enchanted_elementalAI (_Creature); + return new mob_enchanted_elementalAI(pCreature); } -CreatureAI* GetAI_mob_tainted_elemental(Creature *_Creature) +CreatureAI* GetAI_mob_tainted_elemental(Creature* pCreature) { - return new mob_tainted_elementalAI (_Creature); + return new mob_tainted_elementalAI(pCreature); } -CreatureAI* GetAI_mob_toxic_sporebat(Creature *_Creature) +CreatureAI* GetAI_mob_toxic_sporebat(Creature* pCreature) { - return new mob_toxic_sporebatAI (_Creature); + return new mob_toxic_sporebatAI(pCreature); } -CreatureAI* GetAI_mob_shield_generator_channel(Creature *_Creature) +CreatureAI* GetAI_mob_shield_generator_channel(Creature* pCreature) { - return new mob_shield_generator_channelAI (_Creature); + return new mob_shield_generator_channelAI(pCreature); } void AddSC_boss_lady_vashj() { Script *newscript; newscript = new Script; - newscript->Name="boss_lady_vashj"; + newscript->Name = "boss_lady_vashj"; newscript->GetAI = &GetAI_boss_lady_vashj; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_enchanted_elemental"; + newscript->Name = "mob_enchanted_elemental"; newscript->GetAI = &GetAI_mob_enchanted_elemental; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_tainted_elemental"; + newscript->Name = "mob_tainted_elemental"; newscript->GetAI = &GetAI_mob_tainted_elemental; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_toxic_sporebat"; + newscript->Name = "mob_toxic_sporebat"; newscript->GetAI = &GetAI_mob_toxic_sporebat; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_coilfang_elite"; + newscript->Name = "mob_coilfang_elite"; newscript->GetAI = &GetAI_mob_coilfang_elite; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_coilfang_strider"; + newscript->Name = "mob_coilfang_strider"; newscript->GetAI = &GetAI_mob_coilfang_strider; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="mob_shield_generator_channel"; + newscript->Name = "mob_shield_generator_channel"; newscript->GetAI = &GetAI_mob_shield_generator_channel; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="item_tainted_core"; + newscript->Name = "item_tainted_core"; newscript->pItemUse = &ItemUse_item_tainted_core; newscript->RegisterSelf(); } - diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index 70190662516..625e893a4b3 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -24,46 +24,51 @@ EndScriptData */ #include "precompiled.h" #include "def_serpent_shrine.h" -// --- Spells used by Leotheras The Blind -#define SPELL_WHIRLWIND 37640 -#define SPELL_CHAOS_BLAST 37674 -#define SPELL_BERSERK 26662 -#define SPELL_INSIDIOUS_WHISPER 37676 -#define SPELL_DUAL_WIELD 42459 - -// --- Spells used in banish phase --- -#define BANISH_BEAM 38909 -#define AURA_BANISH 37833 - -// --- Spells used by Greyheart Spellbinders -#define SPELL_EARTHSHOCK 39076 -#define SPELL_MINDBLAST 37531 - -// --- Spells used by Inner Demons and creature ID -#define INNER_DEMON_ID 21857 -#define AURA_DEMONIC_ALIGNMENT 37713 -#define SPELL_SHADOWBOLT 39309 -#define SPELL_SOUL_LINK 38007 -#define SPELL_CONSUMING_MADNESS 37749 //not supported by core yet - -//Misc. -#define MODEL_DEMON 20125 -#define MODEL_NIGHTELF 20514 -#define DEMON_FORM 21875 -#define MOB_SPELLBINDER 21806 - -#define SAY_AGGRO -1548009 -#define SAY_SWITCH_TO_DEMON -1548010 -#define SAY_INNER_DEMONS -1548011 -#define SAY_DEMON_SLAY1 -1548012 -#define SAY_DEMON_SLAY2 -1548013 -#define SAY_DEMON_SLAY3 -1548014 -#define SAY_NIGHTELF_SLAY1 -1548015 -#define SAY_NIGHTELF_SLAY2 -1548016 -#define SAY_NIGHTELF_SLAY3 -1548017 -#define SAY_FINAL_FORM -1548018 -#define SAY_FREE -1548019 -#define SAY_DEATH -1548020 +enum +{ + SAY_AGGRO = -1548009, + SAY_SWITCH_TO_DEMON = -1548010, + SAY_INNER_DEMONS = -1548011, + SAY_DEMON_SLAY1 = -1548012, + SAY_DEMON_SLAY2 = -1548013, + SAY_DEMON_SLAY3 = -1548014, + SAY_NIGHTELF_SLAY1 = -1548015, + SAY_NIGHTELF_SLAY2 = -1548016, + SAY_NIGHTELF_SLAY3 = -1548017, + SAY_FINAL_FORM = -1548018, + SAY_FREE = -1548019, + SAY_DEATH = -1548020, + + SPELL_BERSERK = 26662, + + SPELL_WHIRLWIND = 37640, + SPELL_CHAOS_BLAST = 37674, + SPELL_INSIDIOUS_WHISPER = 37676, + SPELL_CONSUMING_MADNESS = 37749, + + AURA_DEMONIC_ALIGNMENT = 37713, + SPELL_SHADOWBOLT = 39309, + + FACTION_DEMON_1 = 1829, + FACTION_DEMON_2 = 1830, + FACTION_DEMON_3 = 1831, + FACTION_DEMON_4 = 1832, + FACTION_DEMON_5 = 1833, + + MODEL_DEMON = 20125, + MODEL_NIGHTELF = 20514, + + INNER_DEMON_ID = 21857, + DEMON_FORM = 21875, + + SPELL_DUAL_WIELD = 42459, + BANISH_BEAM = 38909, + AURA_BANISH = 37833, + SPELL_EARTHSHOCK = 39076, + SPELL_MINDBLAST = 37531, + SPELL_SOUL_LINK = 38007, + MOB_SPELLBINDER = 21806 +}; struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI { @@ -187,7 +192,10 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI EnrageUsed = false; InnderDemon_Count = 0; m_creature->SetSpeed( MOVE_RUN, 2.0f, true); - m_creature->SetDisplayId(MODEL_NIGHTELF); + + if(m_creature->GetDisplayId() != MODEL_NIGHTELF) + m_creature->SetDisplayId(MODEL_NIGHTELF); + m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); @@ -345,23 +353,20 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI if (victim->GetTypeId() != TYPEID_PLAYER) return; - if (DemonForm) + switch(rand()%3) { - switch(rand()%3) - { - case 0: DoScriptText(SAY_DEMON_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_DEMON_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_DEMON_SLAY3, m_creature); break; - } + case 0: DoScriptText(DemonForm ? SAY_DEMON_SLAY1 : SAY_NIGHTELF_SLAY1, m_creature); break; + case 1: DoScriptText(DemonForm ? SAY_DEMON_SLAY2 : SAY_NIGHTELF_SLAY2, m_creature); break; + case 2: DoScriptText(DemonForm ? SAY_DEMON_SLAY3 : SAY_NIGHTELF_SLAY3, m_creature); break; } - else + } + + void JustSummoned(Creature* pSummoned) + { + if (m_creature->getVictim() && pSummoned->GetEntry() == DEMON_FORM) { - switch(rand()%3) - { - case 0: DoScriptText(SAY_NIGHTELF_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_NIGHTELF_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_NIGHTELF_SLAY3, m_creature); break; - } + Demon = pSummoned->GetGUID(); + pSummoned->AI()->AttackStart(m_creature->getVictim()); } } @@ -372,10 +377,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI //despawn copy if (Demon) { - Unit *pUnit = NULL; - pUnit = Unit::GetUnit((*m_creature), Demon); - - if (pUnit) + if (Unit* pUnit = Unit::GetUnit((*m_creature), Demon)) pUnit->DealDamage(pUnit, pUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } if (pInstance) @@ -446,7 +448,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { DoCast(m_creature, SPELL_WHIRLWIND); // while whirlwinding this variable is used to countdown target's change - Whirlwind_Timer = 2000; + Whirlwind_Timer = 30000; NeedThreatReset = true; }else Whirlwind_Timer -= diff; } @@ -615,7 +617,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI void UpdateAI(const uint32 diff) { //Return since we have no target - if (!UpdateVictim() ) + if (!UpdateVictim()) return; //ChaosBlast_Timer if(m_creature->GetDistance(m_creature->getVictim()) < 30) @@ -626,9 +628,9 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI // will cast only when in range od spell if(m_creature->GetDistance(m_creature->getVictim()) < 30) { - //m_creature->CastSpell(m_creature->getVictim(),SPELL_CHAOS_BLAST,true); - int damage = 100; - m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); + m_creature->CastSpell(m_creature->getVictim(),SPELL_CHAOS_BLAST,true); + //int damage = 100; + //m_creature->CastSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); ChaosBlast_Timer = 3000; } }else ChaosBlast_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp index 27e673f7f29..6d731aab5e5 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp @@ -59,9 +59,9 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI void Reset() { - ShadowVolley_Timer = 8000 + rand()%4000; + ShadowVolley_Timer = 6000 + rand()%4000; Cleave_Timer = 7000; - ThunderClap_Timer = 16000 + rand()%4000; + ThunderClap_Timer = 14000 + rand()%4000; VoidBolt_Timer = 30000; MarkOfKazzak_Timer = 25000; Enrage_Timer = 60000; diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp index f95ff8ead5a..4906f02281a 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp @@ -59,6 +59,8 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI BerserkTimer = 720000; //12 minutes Enraged = false; Evocating = false; + + m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); } void KilledUnit(Unit *victim) diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp index f46476df98a..bbc6facb169 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp @@ -39,6 +39,7 @@ EndScriptData */ #define SPELL_OVERRUN 32636 #define SPELL_ENRAGE 33653 #define SPELL_MARK_DEATH 37128 +#define SPELL_AURA_DEATH 37131 struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI { @@ -65,6 +66,8 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI void KilledUnit(Unit* Victim) { + Victim->CastSpell(Victim,SPELL_MARK_DEATH,0); + if(rand()%5) return; @@ -74,8 +77,6 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI case 1: DoScriptText(SAY_SLAY_2, m_creature); break; case 2: DoScriptText(SAY_SLAY_3, m_creature); break; } - - DoCast(m_creature->getVictim(), SPELL_MARK_DEATH); } void JustDied(Unit* Killer) @@ -88,6 +89,17 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI DoScriptText(SAY_AGGRO, m_creature); } + void MoveInLineOfSight(Unit *who) + { + if (who && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsHostileTo(who)) + { + if (who->HasAura(SPELL_MARK_DEATH,0)) + { + who->CastSpell(who,SPELL_AURA_DEATH,1); + } + } + } + void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -149,7 +161,7 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI if (target) DoCast(target,SPELL_CHAIN_LIGHTNING); - Chain_Timer = 10000 + rand()%25000; + Chain_Timer = 7000 + rand()%20000; }else Chain_Timer -= diff; //Spell Sunder Armor |