diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-08-16 18:35:54 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-08-16 18:35:54 +0200 |
commit | 74689b1d93c2150130907b6baac861bfbcc47dd3 (patch) | |
tree | a6495bab0aefe322c890bb3d0d54433f11ce1f06 | |
parent | 01178f595809dc6f7d043e6cc5c7e7975c466e09 (diff) | |
parent | 99a3df6e205594a87b07b47b03f247ea212bc96b (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
-rw-r--r-- | sql/updates/world/2013_08_16_00_world_drak_tharon_keep.sql | 14 | ||||
-rw-r--r-- | sql/updates/world/2013_08_16_01_world_sai.sql | 120 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp | 343 |
4 files changed, 304 insertions, 176 deletions
diff --git a/sql/updates/world/2013_08_16_00_world_drak_tharon_keep.sql b/sql/updates/world/2013_08_16_00_world_drak_tharon_keep.sql new file mode 100644 index 00000000000..f05e14c1ca3 --- /dev/null +++ b/sql/updates/world/2013_08_16_00_world_drak_tharon_keep.sql @@ -0,0 +1,14 @@ +DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (49527, 49518, 49528, 49544, 49537, 49548); +INSERT INTO `spelldifficulty_dbc` (`id`, `spellid0`, `spellid1`) VALUES +(49527, 49527, 59972), +(49518, 49518, 59971), +(49528, 49528, 59973), +(49544, 49544, 59965), +(49537, 49537, 59963), +(49548, 49548, 59969); + +UPDATE `creature_template` SET `AIName` = 'NullAI' WHERE `entry` = 30413; + +DELETE FROM `spell_script_names` WHERE `spell_id` = 53242; +INSERT INTO `spell_script_names`(`spell_id`, `ScriptName`) VALUES +(53242, 'spell_tharon_ja_clear_gift_of_tharon_ja'); diff --git a/sql/updates/world/2013_08_16_01_world_sai.sql b/sql/updates/world/2013_08_16_01_world_sai.sql new file mode 100644 index 00000000000..643eeaa9dd6 --- /dev/null +++ b/sql/updates/world/2013_08_16_01_world_sai.sql @@ -0,0 +1,120 @@ +-- Digging Through Bones (10922) +SET @LETOLL := 22458; +SET @RESEARCHER := 22464; +SET @B_SIFTER := 22466; +SET @SG_TRIGGER := 22457; +SET @RESEARCHER1 := 78837; + +-- Faulty spawn, it needs to be spawned by a script. +DELETE FROM `creature` WHERE `guid`=85488; + +DELETE FROM `creature_text` WHERE `entry`=@LETOLL; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@LETOLL,0,0,"'Aright, listen up! Form a circle around me and move out!",12,0,100,0,0,0,''), +(@LETOLL,1,0,"Aright, $R, just keep us safe from harm while we work. We'll pay you when we return.",12,0,100,0,0,0,''), +(@LETOLL,2,0,"The dig site is just north of here.",12,0,100,0,0,0,''), +(@LETOLL,3,0,"We're here! Start diggin'!",12,0,100,0,0,0,''), +(@LETOLL,4,0,"I think there's somethin' buried here, beneath the sand!",12,0,100,396,0,0,''), +(@LETOLL,5,0,"Almost got it!",12,0,100,396,0,0,''), +(@LETOLL,6,0,"By Brann's brittle bananas! What is it?! It... It looks like a drum.",12,0,100,396,0,0,''), +(@LETOLL,7,0,"Have ye gone mad? You expect me to leave behind a drum without first beatin' on it? Not this son of Ironforge! No sir!",12,0,100,0,0,0,''), +(@LETOLL,8,0,"Shut yer yaps! I'm gonna bang on this drum and that's that!",12,0,100,0,0,0,''), +(@LETOLL,9,0,"IN YOUR FACE! I told you there was somethin' here!",12,0,100,0,0,0,''), +(@LETOLL,10,0,"Don't just stand there! Help him out!",12,0,100,0,0,0,''), +(@LETOLL,11,0,"You've been a tremendous help, $R! Let's get out of here before more of those things show up! I'll let Dwarfowitz know you did the job asked of ya' admirably.",12,0,100,0,0,0,''); + +DELETE FROM `creature_text` WHERE `entry`=@RESEARCHER; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@RESEARCHER,0,0,"Wow... a drum.",12,0,100,0,0,0,''), +(@RESEARCHER,1,0,"This discovery will surely rock the foundation of modern archaeology.",12,0,100,0,0,0,''), +(@RESEARCHER,2,0,"Yea, great. Can we leave now? This desert is giving me hives.",12,0,100,0,0,0,''), +(@RESEARCHER,3,0,"This reminds me of that one time where you made us search Silithus for evidence of sand gnomes.",12,0,100,0,0,0,''), +(@RESEARCHER,4,0,"Or that time when you told us that you'd discovered the cure for the plague of the 20th century. What is that even? 20th century?",12,0,100,0,0,0,''), +(@RESEARCHER,5,0,"I don't think it can top the one time where he told us that he'd heard that Arthas's cousin's skeleton was frozen beneath a glacier in Winterspring. I'll never forgive you for that one, Letoll. I mean honestly... Arthas's cousin?",12,0,100,0,0,0,''), +(@RESEARCHER,6,0,"I dunno. It can't possibly beat the time he tried to convince us that we're all actually a figment of some being's imagination and that they only use us for their own personal amusement. That went over well during dinner with the family.",12,0,100,0,0,0,''), +(@RESEARCHER,7,0,"Say, do you guys hear that?",12,0,100,0,0,0,''); + +DELETE FROM `waypoints` WHERE `entry` IN (@LETOLL,@RESEARCHER,@LETOLL*100); +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@LETOLL,0,-3728.1,5385.5,-3.41,''), +(@LETOLL,1,-3735.9,5392.8,-4.8,''), +(@LETOLL,2,-3729.7,5381,-4.9,''), +(@LETOLL,3,-3704.6, 5372.74, -9.33,''), +(@LETOLL,4,-3704.8,5374.7,-8.9,''), +(@LETOLL,5,-3623.2,5403.2,-11.5,''), +(@LETOLL,6,-3554.6,5455.2,-11.3,''), +(@LETOLL,7,-3557.7,5468.9,-8.1,''), +(@LETOLL,8,-3548.9,5458.3,-12.3,''), +(@RESEARCHER,0,-3725.1,5381.9,-4.4,''), +(@RESEARCHER,1,-3735.7,5390.7,-5.7,''), +(@RESEARCHER,2,-3728.4,5384.1,-3.4,''), +(@RESEARCHER,3,-3703.1,5371.4,-10.1,''), +(@RESEARCHER,4,-3619.6,5400.8,-12.1,''), +(@RESEARCHER,5,-3554.2,5451.1,-11.8,''), +(@RESEARCHER,6,-3563.1,5462.8,-6.5,''), +(@RESEARCHER,7,-3551.1,5454,-11.9,''); + + +UPDATE `creature_template` SET `AIname`='SmartAI' WHERE `entry` IN (@LETOLL,@RESEARCHER,@B_SIFTER); +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (@LETOLL,-@RESEARCHER1,@B_SIFTER); +DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid` IN (@LETOLL*100+2,@LETOLL*100+1,@LETOLL*100,@RESEARCHER*100); +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 +(@LETOLL,0,0,1,19,0,100,0,10922,0,0,0,53,0,@LETOLL,0,0,0,0,1,0,0,0,0,0,0,0,'On quest accept - Start WP'), +(@LETOLL,0,1,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Say line 0'), +(@LETOLL,0,2,3,40,0,100,0,1,@LETOLL,0,0,54,10000,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Pause WP'), +(@LETOLL,0,3,10,61,0,100,0,0,0,0,0,80,@LETOLL*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Start Timed Event'), +(@LETOLL,0,4,5,40,0,100,0,7,@LETOLL,0,0,17,233,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Set emote digging'), +(@LETOLL,0,5,0,61,0,100,0,0,0,0,0,45,0,2,0,0,0,0,10,78837,@RESEARCHER,0,0,0,0,0,'On Link - Set Data'), +(@LETOLL,0,6,7,40,0,100,0,8,@LETOLL,0,0,17,467,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Set emote digging'), +(@LETOLL,0,7,8,61,0,100,0,0,0,0,0,45,0,3,0,0,0,0,10,78837,@RESEARCHER,0,0,0,0,0,'On Link - Set Data'), +(@LETOLL,0,8,0,61,0,100,0,0,0,0,0,80,@LETOLL*100+1,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Start Timed Event'), +(@LETOLL,0,9,0,40,0,100,0,6,@LETOLL,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Say line 3'), +(@LETOLL,0,10,0,61,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Set npc flag'), +(@LETOLL,0,11,0,40,0,100,0,7,@LETOLL,0,0,54,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Pause WP'), +-- +(-@RESEARCHER1,0,0,0,38,0,100,0,0,1,0,0,53,0,@RESEARCHER,0,0,0,0,1,0,0,0,0,0,0,0,'On Data - Start WP'), +(-@RESEARCHER1,0,1,2,40,0,100,0,5,@RESEARCHER,0,0,54,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,' On Data - Start WP'), +(-@RESEARCHER1,0,2,0,61,0,100,0,0,0,0,0,17,233,0,0,0,0,0,1,0,0,0,0,0,0,0,'On link - Start digging'), +(-@RESEARCHER1,0,3,4,40,0,100,0,6,@RESEARCHER,0,0,54,3000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Pause WP'), +(-@RESEARCHER1,0,4,0,61,0,100,0,0,0,0,0,17,233,0,0,0,0,0,1,0,0,0,0,0,0,0,'On link - Start digging'), +(-@RESEARCHER1,0,5,6,40,0,100,0,7,@RESEARCHER,0,0,54,35500,0,0,0,0,0,1,0,0,0,0,0,0,0,'On WP reached - Pause WP'), +(-@RESEARCHER1,0,6,0,61,0,100,0,0,0,0,0,80,@RESEARCHER*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'ON WP reached - Start Timed Event'), +(-@RESEARCHER1,0,7,0,11,0,100,0,0,0,0,0,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Respawn - Set Emote State none'), +-- +(@LETOLL*100,9,0,0,0,0,100,0,3000,3000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 1'), +(@LETOLL*100,9,1,0,0,0,100,0,7000,7000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 2'), +(@LETOLL*100,9,2,0,0,0,100,0,500,500,0,0,45,0,1,0,0,0,0,10,78837,@RESEARCHER,0,0,0,0,0,'On Script - Set Data'), +-- +(@LETOLL*100+1,9,0,0,0,0,100,0,0,0,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 4'), +(@LETOLL*100+1,9,1,0,0,0,100,0,2000,2000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 5'), +(@LETOLL*100+1,9,2,0,0,0,100,0,5000,5000,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 6'), +-- +(@RESEARCHER*100,9,0,0,0,0,100,0,5000,5000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 0'), +(@RESEARCHER*100,9,1,0,0,0,100,0,0,0,0,0,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Set emote state none'), +(@RESEARCHER*100,9,2,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 1'), +(@RESEARCHER*100,9,3,0,0,0,100,0,7000,7000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 2'), +-- +(@LETOLL*100+1,9,3,0,0,0,100,0,0,0,0,0,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Set emote state none'), +(@LETOLL*100+1,9,4,0,0,0,100,0,22000,22000,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 7'), +-- +(@RESEARCHER*100,9,4,0,0,0,100,0,12000,12000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 3'), +(@RESEARCHER*100,9,5,0,0,0,100,0,6000,6000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 4'), +(@RESEARCHER*100,9,6,0,0,0,100,0,6000,6000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 5'), +(@RESEARCHER*100,9,7,0,0,0,100,0,17000,17000,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 6'), +-- +(@LETOLL*100+1,9,5,0,0,0,100,0,34000,34000,0,0,1,8,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 8'), +-- +(@RESEARCHER*100,9,8,0,0,0,100,0,6000,6000,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 7'), +(@RESEARCHER*100,9,9,0,0,0,100,0,15000,15000,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Despawn'), +-- +(@LETOLL*100+1,9,6,0,0,0,100,0,7000,7000,0,0,1,9,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 9'), +(@LETOLL*100+1,9,7,0,0,0,100,0,500,500,0,0,12,@B_SIFTER,1,60000,0,0,0,8,0,0,0,-3550,5456.1,-12.3,0,'On Script - Summon worm'), +(@LETOLL*100+1,9,8,0,0,0,100,0,8000,8000,0,0,1,10,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 10'), +(@LETOLL*100+1,9,9,0,0,0,100,0,8000,8000,0,0,1,11,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Say line 11'), +(@LETOLL*100+1,9,10,0,0,0,100,0,6000,6000,0,0,15,10922,0,0,0,0,0,18,20,0,0,0,0,0,0,'On Script - Give quest credit'), +(@LETOLL*100+1,9,11,0,0,0,100,0,3000,3000,0,0,81,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Restore npcflags'), +(@LETOLL*100+1,9,12,0,0,0,100,0,1000,1000,0,0,78,0,0,0,0,0,0,1,0,0,0,0,0,0,0,' On Script - Stop Script'), +(@LETOLL*100+1,9,13,0,0,0,100,0,16000,16000,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On Script - Despawn'), +-- +(@B_SIFTER,0,0,0,0,0,100,0,2000,6000,12000,17000,11,31747,0,0,0,0,0,2,0,0,0,0,0,0,0,'- IC - Cast Poison'), +(@B_SIFTER,0,1,0,0,0,100,0,5000,25000,35000,40000,11,32738,0,0,0,0,0,2,0,0,0,0,0,0,0,'- IC - Cast Bore'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 67417ca809b..b7c713dd49c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6507,7 +6507,8 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 /*damage*/, Aura* triggeredByAura // Blood of the North // Reaping // Death Rune Mastery - if (dummySpell->SpellIconID == 3041 || dummySpell->SpellIconID == 22 || dummySpell->SpellIconID == 2622) + /// @todo move those to spell scripts + if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622) { *handled = true; // Convert recently used Blood Rune to Death Rune diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index e090f3db7c0..efca060b67c 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -17,29 +17,48 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "drak_tharon_keep.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "Player.h" +#include "drak_tharon_keep.h" + +/* + * Known Issues: Spell 49356 and 53463 will be interrupted for an unknown reason + */ enum Spells { - //skeletal spells (phase 1) + // Skeletal Spells (phase 1) SPELL_CURSE_OF_LIFE = 49527, - H_SPELL_CURSE_OF_LIFE = 59972, SPELL_RAIN_OF_FIRE = 49518, - H_SPELL_RAIN_OF_FIRE = 59971, SPELL_SHADOW_VOLLEY = 49528, - H_SPELL_SHADOW_VOLLEY = 59973, - SPELL_DECAY_FLESH = 49356, //casted at end of phase 1, starts phase 2 - //flesh spells (phase 2) + SPELL_DECAY_FLESH = 49356, // casted at end of phase 1, starts phase 2 + // Flesh Spells (phase 2) SPELL_GIFT_OF_THARON_JA = 52509, + SPELL_CLEAR_GIFT_OF_THARON_JA = 53242, SPELL_EYE_BEAM = 49544, - H_SPELL_EYE_BEAM = 59965, SPELL_LIGHTNING_BREATH = 49537, - H_SPELL_LIGHTNING_BREATH = 59963, SPELL_POISON_CLOUD = 49548, - H_SPELL_POISON_CLOUD = 59969, - SPELL_RETURN_FLESH = 53463, //Channeled spell ending phase two and returning to phase 1. This ability will stun the party for 6 seconds. + SPELL_RETURN_FLESH = 53463, // Channeled spell ending phase two and returning to phase 1. This ability will stun the party for 6 seconds. SPELL_ACHIEVEMENT_CHECK = 61863, + SPELL_FLESH_VISUAL = 52582, + SPELL_DUMMY = 49551 +}; + +enum Events +{ + EVENT_CURSE_OF_LIFE = 1, + EVENT_RAIN_OF_FIRE, + EVENT_SHADOW_VOLLEY, + + EVENT_EYE_BEAM, + EVENT_LIGHTNING_BREATH, + EVENT_POISON_CLOUD, + + EVENT_DECAY_FLESH, + EVENT_GOING_FLESH, + EVENT_RETURN_FLESH, + EVENT_GOING_SKELETAL }; enum Yells @@ -50,204 +69,178 @@ enum Yells SAY_SKELETON = 3, SAY_DEATH = 4 }; + enum Models { - MODEL_FLESH = 27073, - MODEL_SKELETON = 27511 -}; -enum CombatPhase -{ - SKELETAL, - GOING_FLESH, - FLESH, - GOING_SKELETAL + MODEL_FLESH = 27073 }; class boss_tharon_ja : public CreatureScript { -public: - boss_tharon_ja() : CreatureScript("boss_tharon_ja") { } + public: + boss_tharon_ja() : CreatureScript("boss_tharon_ja") { } - struct boss_tharon_jaAI : public ScriptedAI - { - boss_tharon_jaAI(Creature* creature) : ScriptedAI(creature) + struct boss_tharon_jaAI : public BossAI { - instance = creature->GetInstanceScript(); - } - - uint32 uiPhaseTimer; - uint32 uiCurseOfLifeTimer; - uint32 uiRainOfFireTimer; - uint32 uiShadowVolleyTimer; - uint32 uiEyeBeamTimer; - uint32 uiLightningBreathTimer; - uint32 uiPoisonCloudTimer; + boss_tharon_jaAI(Creature* creature) : BossAI(creature, DATA_THARON_JA) { } - CombatPhase Phase; - - InstanceScript* instance; - - void Reset() OVERRIDE - { - uiPhaseTimer = 20*IN_MILLISECONDS; - uiCurseOfLifeTimer = 1*IN_MILLISECONDS; - uiRainOfFireTimer = urand(14*IN_MILLISECONDS, 18*IN_MILLISECONDS); - uiShadowVolleyTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - Phase = SKELETAL; - me->SetDisplayId(me->GetNativeDisplayId()); - instance->SetBossState(DATA_THARON_JA, NOT_STARTED); - } + void Reset() OVERRIDE + { + _Reset(); + me->RestoreDisplayId(); + } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_AGGRO); - instance->SetBossState(DATA_THARON_JA, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + Talk(SAY_AGGRO); + _EnterCombat(); - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + events.ScheduleEvent(EVENT_DECAY_FLESH, 20000); + events.ScheduleEvent(EVENT_CURSE_OF_LIFE, 1000); + events.ScheduleEvent(EVENT_RAIN_OF_FIRE, urand(14000, 18000)); + events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(8000, 10000)); + } - switch (Phase) + void KilledUnit(Unit* who) OVERRIDE { - case SKELETAL: - if (uiCurseOfLifeTimer < diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_CURSE_OF_LIFE); - uiCurseOfLifeTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else uiCurseOfLifeTimer -= diff; + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - if (uiShadowVolleyTimer < diff) - { - DoCastVictim(SPELL_SHADOW_VOLLEY); - uiShadowVolleyTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else uiShadowVolleyTimer -= diff; + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); - if (uiRainOfFireTimer < diff) - { - DoCastAOE(SPELL_RAIN_OF_FIRE); - uiRainOfFireTimer = urand(14*IN_MILLISECONDS, 18*IN_MILLISECONDS); - } else uiRainOfFireTimer -= diff; + Talk(SAY_DEATH); + DoCastAOE(SPELL_CLEAR_GIFT_OF_THARON_JA, true); + DoCastAOE(SPELL_ACHIEVEMENT_CHECK, true); + } - if (uiPhaseTimer < diff) - { - DoCast(SPELL_DECAY_FLESH); - Phase = GOING_FLESH; - uiPhaseTimer = 6*IN_MILLISECONDS; - } else uiPhaseTimer -= diff; - - DoMeleeAttackIfReady(); - break; - case GOING_FLESH: - if (uiPhaseTimer < diff) - { - Talk(SAY_FLESH); - me->SetDisplayId(MODEL_FLESH); - - std::list<Unit*> playerList; - SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); - for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) - { - Unit* temp = (*itr); - me->AddAura(SPELL_GIFT_OF_THARON_JA, temp); - temp->SetDisplayId(MODEL_SKELETON); - } - uiPhaseTimer = 20*IN_MILLISECONDS; - uiLightningBreathTimer = urand(3*IN_MILLISECONDS, 4*IN_MILLISECONDS); - uiEyeBeamTimer = urand(4*IN_MILLISECONDS, 8*IN_MILLISECONDS); - uiPoisonCloudTimer = urand(6*IN_MILLISECONDS, 7*IN_MILLISECONDS); - Phase = FLESH; - } else uiPhaseTimer -= diff; - break; - case FLESH: - if (uiLightningBreathTimer < diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_LIGHTNING_BREATH); - uiLightningBreathTimer = urand(6*IN_MILLISECONDS, 7*IN_MILLISECONDS); - } else uiLightningBreathTimer -= diff; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - if (uiEyeBeamTimer < diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_EYE_BEAM); - uiEyeBeamTimer = urand(4*IN_MILLISECONDS, 6*IN_MILLISECONDS); - } else uiEyeBeamTimer -= diff; + events.Update(diff); - if (uiPoisonCloudTimer < diff) - { - DoCastAOE(SPELL_POISON_CLOUD); - uiPoisonCloudTimer = urand(10*IN_MILLISECONDS, 12*IN_MILLISECONDS); - } else uiPoisonCloudTimer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uiPhaseTimer < diff) - { - DoCast(SPELL_RETURN_FLESH); - Phase = GOING_SKELETAL; - uiPhaseTimer = 6*IN_MILLISECONDS; - } else uiPhaseTimer -= diff; - DoMeleeAttackIfReady(); - break; - case GOING_SKELETAL: - if (uiPhaseTimer < diff) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) { - Talk(SAY_SKELETON); - me->DeMorph(); - Phase = SKELETAL; - uiPhaseTimer = 20*IN_MILLISECONDS; - uiCurseOfLifeTimer = 1*IN_MILLISECONDS; - uiRainOfFireTimer = urand(14*IN_MILLISECONDS, 18*IN_MILLISECONDS); - uiShadowVolleyTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - - std::list<Unit*> playerList; - SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); - for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) - { - Unit* temp = (*itr); - if (temp->HasAura(SPELL_GIFT_OF_THARON_JA)) - temp->RemoveAura(SPELL_GIFT_OF_THARON_JA); - temp->DeMorph(); - } - } else uiPhaseTimer -= diff; - break; + case EVENT_CURSE_OF_LIFE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_CURSE_OF_LIFE); + events.ScheduleEvent(EVENT_CURSE_OF_LIFE, urand(10000, 15000)); + return; + case EVENT_SHADOW_VOLLEY: + DoCastVictim(SPELL_SHADOW_VOLLEY); + events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(8000, 10000)); + return; + case EVENT_RAIN_OF_FIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_RAIN_OF_FIRE); + events.ScheduleEvent(EVENT_RAIN_OF_FIRE, urand(14000, 18000)); + return; + case EVENT_LIGHTNING_BREATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_LIGHTNING_BREATH); + events.ScheduleEvent(EVENT_LIGHTNING_BREATH, urand(6000, 7000)); + return; + case EVENT_EYE_BEAM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_EYE_BEAM); + events.ScheduleEvent(EVENT_EYE_BEAM, urand(4000, 6000)); + return; + case EVENT_POISON_CLOUD: + DoCastAOE(SPELL_POISON_CLOUD); + events.ScheduleEvent(EVENT_POISON_CLOUD, urand(10000, 12000)); + return; + case EVENT_DECAY_FLESH: + DoCastAOE(SPELL_DECAY_FLESH); + events.ScheduleEvent(EVENT_GOING_FLESH, 6000); + return; + case EVENT_GOING_FLESH: + Talk(SAY_FLESH); + me->SetDisplayId(MODEL_FLESH); + DoCastAOE(SPELL_GIFT_OF_THARON_JA, true); + DoCast(me, SPELL_FLESH_VISUAL, true); + DoCast(me, SPELL_DUMMY, true); + + events.Reset(); + events.ScheduleEvent(EVENT_RETURN_FLESH, 20000); + events.ScheduleEvent(EVENT_LIGHTNING_BREATH, urand(3000, 4000)); + events.ScheduleEvent(EVENT_EYE_BEAM, urand(4000, 8000)); + events.ScheduleEvent(EVENT_POISON_CLOUD, urand(6000, 7000)); + break; + case EVENT_RETURN_FLESH: + DoCastAOE(SPELL_RETURN_FLESH); + events.ScheduleEvent(EVENT_GOING_SKELETAL, 6000); + return; + case EVENT_GOING_SKELETAL: + Talk(SAY_SKELETON); + me->RestoreDisplayId(); + DoCastAOE(SPELL_CLEAR_GIFT_OF_THARON_JA, true); + + events.Reset(); + events.ScheduleEvent(EVENT_DECAY_FLESH, 20000); + events.ScheduleEvent(EVENT_CURSE_OF_LIFE, 1000); + events.ScheduleEvent(EVENT_RAIN_OF_FIRE, urand(14000, 18000)); + events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(8000, 10000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } - } + }; - void KilledUnit(Unit* /*victim*/) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - Talk(SAY_KILL); + return GetDrakTharonKeepAI<boss_tharon_jaAI>(creature); } +}; + +class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScriptLoader +{ + public: + spell_tharon_ja_clear_gift_of_tharon_ja() : SpellScriptLoader("spell_tharon_ja_clear_gift_of_tharon_ja") { } - void JustDied(Unit* /*killer*/) OVERRIDE + class spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript : public SpellScript { - Talk(SAY_DEATH); + PrepareSpellScript(spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript); - if (instance) + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - // clean morph on players - Map::PlayerList const &PlayerList = instance->instance->GetPlayers(); - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - player->DeMorph(); + if (!sSpellMgr->GetSpellInfo(SPELL_GIFT_OF_THARON_JA)) + return false; + return true; + } - DoCast(me, SPELL_ACHIEVEMENT_CHECK); + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->RemoveAura(SPELL_GIFT_OF_THARON_JA); + } - instance->SetBossState(DATA_THARON_JA, DONE); + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - } - }; + }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return GetDrakTharonKeepAI<boss_tharon_jaAI>(creature); - } + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript(); + } }; void AddSC_boss_tharon_ja() { - new boss_tharon_ja; + new boss_tharon_ja(); + new spell_tharon_ja_clear_gift_of_tharon_ja(); } |