Advertisement
Guest User

stoneharry

a guest
Oct 16th, 2010
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.90 KB | None | 0 0
  1. ------------------------------------------------------------------------------------------------------------------------------------------------
  2. --[[
  3.     A Boss
  4.         By Stoneharry
  5.         Released at MMOwned.com
  6.        
  7.     Designed to be used in a LuaBridge version of LuaHypArc
  8.  
  9.     ----------------------------------------------------------
  10.     Documentation for when the SQL's become out of date
  11.     ----------------------------------------------------------
  12.     BOSS - Display = 25885, flags1 = 2156, rank = 3, type = 7
  13.     BOSS PET - Display = 6374, flags1 = 108
  14.     Three Other Creatures - Display = 11686, rank = 1
  15.     Destructable Object 0 type = 33, displayid = 8387, spellfocus = 100, sound4 = 8387, unknown1 = 8386, unknown2 = 1, unknown 9 = 50, unknown14 = 1, size = 1
  16.     ----------------------------------------------------------
  17.     insert  into `creature_spawns`(`id`,`entry`,`map`,`position_x`,`position_y`,`position_z`,`orientation`,`movetype`,`displayid`,`faction`,`flags`,`bytes0`,`bytes1`,`bytes2`,`emote_state`,`npc_respawn_link`,`channel_spell`,`channel_target_sqlid`,`channel_target_sqlid_creature`,`standstate`,`death_state`,`mountdisplayid`,`slot1item`,`slot2item`,`slot3item`,`CanFly`,`phase`) values (138,100000,0,-2354.9,-2462.11,561.814,2.40191,0,25885,21,524288,0,0,1,333,0,0,0,0,0,0,6374,36962,0,0,0,1);
  18.     insert  into `creature_names`(`entry`,`name`,`subname`,`info_str`,`flags1`,`type`,`family`,`rank`,`killcredit1`,`killcredit2`,`male_displayid`,`female_displayid`,`male_displayid2`,`female_displayid2`,`unknown_float1`,`unknown_float2`,`leader`,`questitem1`,`questitem2`,`questitem3`,`questitem4`,`questitem5`,`questitem6`,`waypointid`) values (100004,'Black Drake','Blackhand\'s Pet','',108,0,0,3,0,0,6374,0,0,0,1,1,0,0,0,0,0,0,0,0),(100003,'Fire Orb','','',0,0,0,1,0,0,11686,0,0,0,1,1,0,0,0,0,0,0,0,0),(100002,'Charged Orb','','',0,0,0,1,0,0,11686,0,0,0,1,1,0,0,0,0,0,0,0,0),(100001,'','','',0,0,0,1,0,0,11686,0,0,0,1,1,0,0,0,0,0,0,0,0),(100000,'\"Futile\" Blackhand','','',2156,7,0,3,0,0,25885,0,0,0,1,1,1,0,0,0,0,0,0,0);
  19.     insert  into `creature_proto`(`entry`,`minlevel`,`maxlevel`,`faction`,`minhealth`,`maxhealth`,`mana`,`scale`,`npcflags`,`attacktime`,`attacktype`,`mindamage`,`maxdamage`,`can_ranged`,`rangedattacktime`,`rangedmindamage`,`rangedmaxdamage`,`respawntime`,`armor`,`resistance1`,`resistance2`,`resistance3`,`resistance4`,`resistance5`,`resistance6`,`combat_reach`,`bounding_radius`,`auras`,`boss`,`money`,`invisibility_type`,`walk_speed`,`run_speed`,`fly_speed`,`extra_a9_flags`,`spell1`,`spell2`,`spell3`,`spell4`,`spell_flags`,`modImmunities`,`isTrainingDummy`,`guardtype`,`summonguard`) values (100002,83,83,21,55500,55500,3508353,1,0,10000,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,'0',0,0,0,2.5,8,14,0,0,0,0,0,0,0,0,0,0),(100001,83,83,21,55500,55500,3553563,1,0,10000,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,'0',0,0,0,2.5,8,14,0,0,0,0,0,0,0,0,0,0),(100000,83,83,15,8000000,9000000,98000000,2,0,2100,0,18000,25000,0,0,0,0,0,12000,25,25,25,25,25,25,1.3,4,'0',1,0,0,2.5,7.6,14,0,0,0,0,0,0,0,0,0,0),(100003,83,83,21,100000,100000,500000,1,0,10000,0,1,1,0,0,0,0,0,20000,30,30,30,30,30,30,1,1,'0',0,0,0,2.5,8,14,0,0,0,0,0,0,0,0,0,0),(100004,83,83,21,2000000,3000000,0,1,0,2400,0,12000,14000,0,0,0,0,0,11000,20,20,20,20,20,20,1.3,4,'0',1,0,0,2.5,8,14,0,0,0,0,0,0,0,0,0,0);
  20.     insert into `gameobject_names` (`entry`, `Type`, `DisplayID`, `Name`, `Category`, `CastBarText`, `UnkStr`, `spellfocus`, `sound1`, `sound2`, `sound3`, `sound4`, `sound5`, `sound6`, `sound7`, `sound8`, `sound9`, `unknown1`, `unknown2`, `unknown3`, `unknown4`, `unknown5`, `unknown6`, `unknown7`, `unknown8`, `unknown9`, `unknown10`, `unknown11`, `unknown12`, `unknown13`, `unknown14`, `Size`, `QuestItem1`, `QuestItem2`, `QuestItem3`, `QuestItem4`, `QuestItem5`, `QuestItem6`) values('1930701','33','8387','Boss Platform (DESTRUCTABLE)','','','','100','0','0','0','8387','0','0','0','0','0','8386','1','0','0','0','0','0','0','50','0','0','0','0','1','1','0','0','0','0','0','0');
  21.     ----------------------------------------------------------
  22.    
  23.     Description in chronological order:
  24.         This fight starts off on the destructable object 'Malygos Platform'.
  25.         The boss rides a black drake and has a powerful melee, but slow, melee attack.
  26.  
  27.     Phase 1
  28.         Every few seconds lines of fire will spread out from the boss which players must avoid.
  29.         The boss will mind controll players into either healing the boss or attacking other players every 30 seconds.
  30.         The boss will slow and weaken the tank every 12 seconds.
  31.         The boss will debuff 3 random players with immorlate every 15 seconds.
  32.         The boss will do a area of affect 'death and decay' on a random area every now and then.
  33.         A fireball volley will be followed by a death and decay.
  34.    
  35.     Phase 2
  36.         The boss returns to spawn point, temporarily stunning players.
  37.         Lighting strikes players and bounces between them, dealing damage.
  38.         All players are weakened and stunned every now and then.
  39.         Two players randomly switch positions every ~30 seconds.
  40.         People find it hard to see due to the screen filter.
  41.         Lightning will prove as a distraction.
  42.        
  43.     Phase 3
  44.         Exactly the same as Phase 1 but timers are changed and is generally more hard. Players also randomly teleport.
  45.  
  46.     Phase 4
  47.         The platform blows up, players are able to fly.
  48.         Two types of orb spawn:
  49.             1st spawns every 10 seconds, drags 3 players to it and then blows up dealing large AOE damage.
  50.             2nd spawns and just shoots AOE at nearby people.
  51.            
  52.     Phase 6
  53.         Orbs spawn more often
  54.         Bolts of energy are shot at players every 16 seconds
  55.         After 2 minutes the boss charges a massive attack that hits every single player for ~10-11k damage.
  56.         The platform resets.
  57.         The drake becomes a independant mob.
  58.         The fight continues.
  59.             - The drake can't die (healed by boss)
  60.             - The drake breaths fire and generally is a nuisance
  61.             - The main boss continues like phase 1 till death
  62.        
  63. ]]
  64. -------------------------------------------------------------------------------------------------------
  65. -- Variable Decleration  ------------------------------------------------------------------------------
  66. -------------------------------------------------------------------------------------------------------
  67.  
  68. local BOSS_PLATFORM_ID = 1930701    -- The destructable object ID of the boss platform
  69. local BOSS = 100000                 -- The ID of the boss
  70. local FIRE = 100001                 -- The ID for the lines of fire that spawn
  71. local ORB_ID = 100002               -- The ID for the orbs that explode, summon and blow up
  72. local FIRE_ORB = 100003             -- The ID for the fiery Orb that spawns and shoots
  73. local BOSS_MOUNT_ID = 100004        -- The ID of the boss' mount.
  74. local BOSS_MOUNT = nil              -- Variable for boss mount handling, do not touch.
  75. local zX = nil                      -- Variable for the Lines of Fire, don't touch
  76. local zY = nil                      -- Variable for the Lines of Fire, don't touch
  77. local BOSS_PLATFORM = nil           -- Don't touch
  78. local player = nil                  -- For the player mind control, don't touch
  79.  
  80. ------------------------------------------------------------------------------------------------------
  81. -- Cleans Database for Pet Bug -----------------------------------------------------------------------
  82. -- Bit Hack Fix'y but I didn't realise storing a GUID would save it to the DB when I wrote this part -
  83. ------------------------------------------------------------------------------------------------------
  84.  
  85. WorldDBQuery("DELETE FROM `creature_spawns` WHERE `entry` = '"..BOSS_MOUNT_ID.."';")        -- We need to do it when the server starts up
  86.  
  87. function CLEAN_PET_DRAGONS()
  88.     WorldDBQuery("DELETE FROM `creature_spawns` WHERE `entry` = '"..BOSS_MOUNT_ID.."';")    -- And when the function is called
  89. end
  90.  
  91. -------------------------------------------------------------------------------------------------------
  92. -- On Spawn Cosmetics ---------------------------------------------------------------------------------
  93. -------------------------------------------------------------------------------------------------------
  94.  
  95. function Boss_On_Spawn_Stoneharry(pUnit, Event)
  96.     pUnit:SetFaction(15)                                        -- Prevents people from getting owned as soon as they enter the location
  97.     pUnit:RegisterEvent("Wait_A_Second_Stoneharry", 1000, 1)    -- Give the npc a chance to load
  98. end
  99.  
  100. function Wait_A_Second_Stoneharry(pUnit)
  101.     pUnit:SetFaction(15)        -- Doesn't always register on spawn
  102.     pUnit:Unroot()              -- Incase it bugged from last encounter
  103.     pUnit:SetMovementFlags(1)   -- ^
  104.     pUnit:CastSpell(27123)      -- Mount visual
  105.     pUnit:SetMount(6374)        -- Black Drake
  106.     pUnit:EquipWeapons(36962, 0, 0) -- Two handed axe
  107.     pUnit:SetScale(1.1)         -- On drake too big as defualt scale 2
  108.     pUnit:CastSpell(76006)      -- Beam visual
  109.     pUnit:RegisterEvent("Beam_Visual_Stoneharry", 10000, 0) -- Visual Maintaining
  110. end
  111.  
  112. function Beam_Visual_Stoneharry(pUnit)
  113.     pUnit:CastSpell(76006)      -- Beam visual
  114. end
  115.  
  116. RegisterUnitEvent(BOSS, 18, "Boss_On_Spawn_Stoneharry")
  117.  
  118. -----------------------
  119.  
  120. function zzzCPEACAE_Cage_asdasd_OnUseZXC(pMisc, event)
  121.     BOSS_PLATFORM = pMisc       -- We'll call this later and blow it up
  122. end
  123.  
  124. RegisterGameObjectEvent(BOSS_PLATFORM_ID, 1, "zzzCPEACAE_Cage_asdasd_OnUseZXC")
  125.  
  126.  
  127. -------------------------------------------------------------------------------------------------------
  128. -- On Combat ------------------------------------------------------------------------------------------
  129. -------------------------------------------------------------------------------------------------------
  130.  
  131. function OnCombat_Stoneharry(pUnit, Event)
  132.     pUnit:RemoveEvents()    -- Stop the visual
  133.     pUnit:SetFaction(21)    -- Now were hostile
  134.     pUnit:SendChatMessage(14,0,"You'll find it difficult to speak, without a head!")
  135.     --pUnit:PlaySoundToSet(14622) -- It's random voice - not always this one. :(
  136.         for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  137.         SetDBCSpellVar(64157, "c_is_flags", 0x01000) -- Makes the spell a debuff - they can't get rid of it hopefully, which means tactics for in 12 seconds big damage
  138.         pUnit:CastSpellOnTarget(64157, plrs) -- Curse of doom
  139.         end
  140.     pUnit:RegisterEvent("Stoneharry_FireLines", math.random(4000, 10000), 1)
  141.     pUnit:RegisterEvent("CurseOf_Reduce_Stoneharry", 15000, 0)
  142.     pUnit:RegisterEvent("ImmorlateThingy_Stoneharry", 17000, 0)
  143.     pUnit:RegisterEvent("Heal_Boss_Player_Tehe", 30000, 0)
  144.     pUnit:RegisterEvent("death_and_decay_Stoneharry", 26000, 0)
  145.     pUnit:RegisterEvent("phase_two_FREEZE_AND_RUN_Tehe", 5000, 0)
  146. end
  147.  
  148. function death_and_decay_Stoneharry(pUnit)
  149.     local arrr = pUnit:GetRandomPlayer(0) -- Getting a random player doesn't always return successful
  150.     if arrr ~= nil then                   -- Check we did get somebody
  151.     pUnit:CastSpellOnTarget(56359, arrr)  -- Hit 'em!
  152.     end
  153.     pUnit:FullCastSpell(38836)            -- Fireball volley
  154. end
  155.  
  156. function Heal_Boss_Player_Tehe(pUnit)
  157.     player = pUnit:GetRandomPlayer(0)   -- We use this in multiple parts so we save it as a variable available through the whole script
  158.     if player ~= nil then
  159.         player:SetPlayerLock(1)         -- Stop him doing anything
  160.         pUnit:SendChatMessage(42,0,"Blackhand is mind controlling "..player:GetName().."!") -- Spam
  161.         player:CancelSpell()            -- In case he was in the middle of... something
  162.         if math.random(1,2) == 1 then
  163.         player:SetMana(pUnit:GetMana()+125) -- Give him some mana
  164.         player:FullCastSpellOnTarget(49348, pUnit)  -- Go go go, cast it
  165.         else
  166.         player:FullCastSpellOnTarget(72024, pUnit:GetRandomPlayer(0)) -- Should work, even if it returns himself
  167.         end
  168.         pUnit:RegisterEvent("Hang_On_Lets_Cast_Again", 3750, 1)
  169.         pUnit:RegisterEvent("Hang_On_Let_Spells_Finish", 7500, 1)
  170.     end
  171. end
  172.  
  173. function Hang_On_Lets_Cast_Again(pUnit) -- Repeat
  174.     if player ~= nil then
  175.         if math.random(1,2) == 1 then
  176.         player:SetMana(pUnit:GetMana()+125)
  177.         player:FullCastSpellOnTarget(49348, pUnit)
  178.         else
  179.         player:FullCastSpellOnTarget(72024, pUnit:GetRandomPlayer(0))
  180.         end
  181.     end
  182. end
  183.  
  184. function Hang_On_Let_Spells_Finish(pUnit)
  185.     if player ~= nil then   -- Make sure he hasn't DC'd or died some other horrible way
  186.     player:SetPlayerLock(0) -- Let him be free
  187.     end
  188. end
  189.  
  190. function CurseOf_Reduce_Stoneharry(pUnit)
  191.     pUnit:FullCastSpellOnTarget(29540, pUnit:GetMainTank()) -- If were in combat there is a tank
  192. end
  193.  
  194. function ImmorlateThingy_Stoneharry(pUnit) -- Repeats 3 times instantly
  195.     local i = 0     -- i = 0, duh
  196.     while i<4 do    -- While less than 4 (up to 3)
  197.     i=i+1           -- Add 1 to it
  198.     local play = pUnit:GetRandomPlayer(0)
  199.         if play ~= nil then
  200.         pUnit:CastSpellOnTarget(41958, pUnit:GetRandomPlayer(0))
  201.         end
  202.     end
  203. end
  204.  
  205. function Stoneharry_FireLines(pUnit)
  206.     pUnit:RegisterEvent("Stoneharry_FireLines", math.random(4000, 10000), 1)                        -- So that the timer is random each time
  207.     local choice = math.random(1,4)                                                                 -- We can go in 4 directions
  208.     if choice == 1 then
  209.     pUnit:SpawnCreature(FIRE, pUnit:GetX()+5, pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 21, 4500)   -- One direction
  210.     zX = pUnit:GetX()+5 -- This function won't be called again in the time it takes to finish the next part, so it's safe to use the same variables over and over
  211.     pUnit:RegisterEvent("Keep_spawning_fires_in_a_line", 750, 5)                                    -- Keep them spawning in a line
  212.     elseif choice == 2 then
  213.     pUnit:SpawnCreature(FIRE, pUnit:GetX(), pUnit:GetY()+5, pUnit:GetZ(), pUnit:GetO(), 21, 4500)   -- Direction two
  214.     zX = pUnit:GetY()+5
  215.     pUnit:RegisterEvent("zKeep_spawning_fires_in_a_line", 750, 5)
  216.     elseif choice == 3 then
  217.     pUnit:SpawnCreature(FIRE, pUnit:GetX()+5, pUnit:GetY()+5, pUnit:GetZ(), pUnit:GetO(), 21, 4500) -- And so on
  218.     zX = pUnit:GetY()+5
  219.     zY = pUnit:GetX()+5
  220.     pUnit:RegisterEvent("zzKeep_spawning_fires_in_a_line", 750, 5) 
  221.     elseif choice == 4 then
  222.     pUnit:SpawnCreature(FIRE, pUnit:GetX()-5, pUnit:GetY()-5, pUnit:GetZ(), pUnit:GetO(), 21, 4500)
  223.     zX = pUnit:GetY()-5
  224.     zY = pUnit:GetX()-5
  225.     pUnit:RegisterEvent("zzzKeep_spawning_fires_in_a_line", 750, 5)
  226.     end
  227. end
  228.  
  229. function Keep_spawning_fires_in_a_line(pUnit) -- These are the variation directions we can go, it shouldn't clash due to variable only being used once at any time
  230.     zX = zX + 5 -- left
  231.     pUnit:SpawnCreature(FIRE, zX, pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 21, 5000)  
  232. end
  233.  
  234. function zKeep_spawning_fires_in_a_line(pUnit)
  235.     zX = zX + 5 -- Right
  236.     pUnit:SpawnCreature(FIRE, pUnit:GetX(), zX, pUnit:GetZ(), pUnit:GetO(), 21, 5000)  
  237. end
  238.  
  239. function zzKeep_spawning_fires_in_a_line(pUnit)
  240.     zX = zX + 5 -- Up
  241.     zY = zY + 5 -- Up
  242.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), pUnit:GetO(), 21, 5000)
  243. end
  244.  
  245. function zzzKeep_spawning_fires_in_a_line(pUnit)
  246.     zX = zX - 5 -- Down
  247.     zY = zY - 5 -- Down
  248.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), pUnit:GetO(), 21, 5000)
  249. end
  250.  
  251. RegisterUnitEvent(BOSS, 1, "OnCombat_Stoneharry")
  252.  
  253. -------------------------------------------------------------------------------------------------------
  254. -- Phase 2 --------------------------------------------------------------------------------------------
  255. -------------------------------------------------------------------------------------------------------
  256.  
  257. function phase_two_FREEZE_AND_RUN_Tehe(pUnit)
  258.     if pUnit:GetHealthPct() < 81 then
  259.     pUnit:SendChatMessage(14, 0, "Let's see how you fight, when your blind!")
  260.     pUnit:CancelSpell()     -- Incase he was doing something
  261.     pUnit:RemoveEvents()    -- Stop doing old stuff
  262.     pUnit:CastSpell(45213)  -- Visual
  263.     SetDBCSpellVar(45922, "c_is_flags", 0x01000) -- These make the spells so that they can't be got rid of, and they appear as a debuff
  264.     SetDBCSpellVar(48864, "c_is_flags", 0x01000)
  265.         for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  266.         plrs:SetPlayerLock(0) -- Lock
  267.         plrs:CastSpell(45922) -- Temporary stun
  268.         plrs:CastSpell(48864) -- Screen visual
  269.         end
  270.     pUnit:SetCombatCapable(1) -- Stops him running like a madman trying to attack the player
  271.     pUnit:ReturnToSpawnPoint() -- Go back to where you belong
  272.     pUnit:RegisterEvent("zffzfz_movetospawnpoint_stoneharry", 500, 0)
  273.     pUnit:RegisterEvent("Lets_Get_On_With_This_Stoneharry", 8000, 1)
  274.     end
  275. end
  276.  
  277. function zffzfz_movetospawnpoint_stoneharry(pUnit, Event)
  278.     pUnit:ReturnToSpawnPoint() -- Keep him in the middle
  279. end
  280.  
  281. function Lets_Get_On_With_This_Stoneharry(pUnit)
  282.     pUnit:RemoveEvents()
  283.     pUnit:SetCombatCapable(0)   -- Be free, young one
  284.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  285.     plrs:RemoveAura(45922)      -- You can move too, children
  286.     end
  287.     pUnit:Root()                -- But you can't mr. boss
  288.     pUnit:RegisterEvent("Lightning_Stoneharry", 10000, 0)
  289.     pUnit:RegisterEvent("Shitg_Stoneharry", 18000, 0)
  290.     pUnit:RegisterEvent("messup_Stoneharry", 29000, 0)
  291.     pUnit:RegisterEvent("CastOnAllWeakButStacksAndEntertains_stoneharry", 500, 0)
  292.     pUnit:RegisterEvent("phase_three_FREEZE_AND_RUN_Tehe", 5000, 0)
  293. end
  294.  
  295. function CastOnAllWeakButStacksAndEntertains_stoneharry(pUnit)
  296.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  297.     pUnit:CastSpellOnTarget(45293, plrs) -- Lightning
  298.     end
  299. end
  300.  
  301. function Shitg_Stoneharry(pUnit)
  302.     pUnit:FullCastSpell(23310) -- Freezes time
  303. end
  304.  
  305. function Lightning_Stoneharry(pUnit)
  306.     pUnit:FullCastSpellOnTarget(64974, pUnit:GetClosestPlayer()) -- What were you?
  307. end
  308.  
  309. function messup_Stoneharry(pUnit)
  310.     local plrA = pUnit:GetRandomPlayer(0) -- Get two players
  311.     local plrB = pUnit:GetRandomPlayer(0) -- Get two players
  312.     if plrA ~= nil and plrB ~= nil then   -- Make sure we did return somebody in the fight
  313.         if plrA == plrB then -- Make sure they are not the same person
  314.             local plrB = pUnit:GetRandomPlayer(0) -- Try again
  315.             if plrA == plrB then            -- You better not be the same person
  316.             plrB = pUnit:GetClosestPlayer() -- That's it, someone more reliable
  317.             end
  318.         end
  319.         plrA:CancelSpell()
  320.         plrB:CancelSpell() -- Stop casting
  321.         plrA:SetPosition(plrB:GetX(), plrB:GetY(), plrB:GetZ(), plrB:GetO()) -- Switch players, muhahaha
  322.         plrB:SetPosition(plrA:GetX(), plrA:GetY(), plrA:GetZ(), plrA:GetO())
  323.         plrA:CastSpell(64446) -- Teleport visual
  324.         plrB:CastSpell(64446)
  325.     end
  326. end
  327.  
  328. -------------------------------------------------------------------------------------------------------
  329. -- Phase 3 --------------------------------------------------------------------------------------------
  330. -------------------------------------------------------------------------------------------------------
  331.  
  332. function phase_three_FREEZE_AND_RUN_Tehe(pUnit) -- You should understand everything used in this function by now
  333.     if pUnit:GetHealthPct() < 71 then
  334.     pUnit:SendChatMessage(14, 0, "You only delay the inevitable!")
  335.     pUnit:Unroot()
  336.     pUnit:CancelSpell()
  337.     pUnit:RemoveEvents()
  338.     pUnit:RemoveAura(45213) -- Visual
  339.         for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  340.         plrs:SetPlayerLock(0)
  341.         plrs:RemoveAura(48864) -- Screen visual
  342.         plrs:CancelSpell()
  343.         plrs:CastSpell(29166) -- We have to give them some help? Innervate
  344.         end
  345.     end
  346.     pUnit:RegisterEvent("Stoneharry_FireLines", math.random(4000, 10000), 1)
  347.     pUnit:RegisterEvent("CurseOf_Reduce_Stoneharry", 20000, 0)
  348.     pUnit:RegisterEvent("ImmorlateThingy_Stoneharry", 15000, 0)
  349.     pUnit:RegisterEvent("Heal_Boss_Player_Tehe", 20000, 0)
  350.     pUnit:RegisterEvent("death_and_decay_Stoneharry", 15000, 0)
  351.     pUnit:RegisterEvent("messup_Stoneharry", 30000, 0)
  352.     pUnit:RegisterEvent("phase_four_FREEZE_AND_RUN_Tehe", 5000, 0)
  353. end
  354.  
  355. -------------------------------------------------------------------------------------------------------
  356. -- Phase 4 --------------------------------------------------------------------------------------------
  357. -------------------------------------------------------------------------------------------------------
  358.  
  359. function phase_four_FREEZE_AND_RUN_Tehe(pUnit)
  360.     if pUnit:GetHealthPct() < 56 then
  361.     pUnit:SendChatMessage(14, 0, "Beyold... The power of the drake!")
  362.     pUnit:CastSpell(59084)
  363.     pUnit:CancelSpell()
  364.     pUnit:RemoveEvents()
  365.     pUnit:RegisterEvent("wait_one_second_for_visual_stoneharry", 2100, 1)
  366.     end
  367. end
  368.  
  369. function wait_one_second_for_visual_stoneharry(pUnit)
  370.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  371.     plrs:EnableFlight(true) -- Let the players fly
  372.     plrs:SetPlayerLock(0)
  373.     plrs:CastSpell(71986)   -- Visual
  374.     end
  375.     pUnit:SetMovementFlags(2)   -- Let the npc fly
  376.     if BOSS_PLATFORM ~= nil then
  377.     BOSS_PLATFORM:SetUInt32Value(0x0006+0x0003,0x400)   -- blows the object up, when it respawns sometimes it changes GUID for some reason
  378.     else
  379.     pUnit:GetGameObjectNearestCoords(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 1930701):SetUInt32Value(0x0006+0x0003,0x400) -- If it's still nil then the player's a tard and it deserves to error.
  380.     end
  381.     pUnit:RegisterEvent("Spawn_Orbs_That_Blow_Up_Tehe", 10000, 0)
  382.     pUnit:RegisterEvent("Static_Fire_Orb_Spawning_SToneharry", 15000, 0)
  383.     pUnit:RegisterEvent("Phase_FIve_And_Couzntng_Spellzing_Failz", 5000, 0)
  384. end
  385.  
  386. function Spawn_Orbs_That_Blow_Up_Tehe(pUnit)
  387.     local target = pUnit:GetRandomPlayer(0)
  388.     if target ~= nil then
  389.     pUnit:SpawnCreature(ORB_ID, target:GetX(), target:GetY(), target:GetZ(), target:GetO(), 21, 9500) -- Were basically spawning the npc on the player's posisiton
  390.     end
  391. end
  392.  
  393. function Static_Fire_Orb_Spawning_SToneharry(pUnit)
  394.     local target = pUnit:GetRandomPlayer(0)
  395.     if target ~= nil then
  396.     pUnit:SpawnCreature(FIRE_ORB, target:GetX(), target:GetY(), target:GetZ(), target:GetO(), 21, 0) -- 0 = a risk worth taking, since it despawns it's self it shouldn't be a permanent spawn, nothing should trigger it to become one...
  397.     end
  398. end
  399.  
  400. -------------------------------------------------------------------------------------------------------
  401. -- Phase 5 --------------------------------------------------------------------------------------------
  402. -------------------------------------------------------------------------------------------------------
  403.  
  404. function Phase_FIve_And_Couzntng_Spellzing_Failz(pUnit)
  405.     if pUnit:GetHealthPct() < 41 then
  406.     pUnit:RemoveEvents()
  407.     pUnit:SendChatMessage(14, 0, "More! We must have more!")
  408.     pUnit:RegisterEvent("Spawn_Orbs_That_Blow_Up_Tehe", 10000, 0)
  409.     pUnit:RegisterEvent("Static_Fire_Orb_Spawning_SToneharry", 10000, 0)
  410.     pUnit:RegisterEvent("PLASMA_BALL_FIRE_IN_TWENTY_RELLS", 16000, 1)
  411.     pUnit:RegisterEvent("TEST_FIRE_IN_DA_HOLE", 30000, 1)
  412.     end
  413. end
  414.  
  415. function PLASMA_BALL_FIRE_IN_TWENTY_RELLS(pUnit)
  416.     local plr = pUnit:GetRandomPlayer(0)
  417.     if plr ~= nil then
  418.     pUnit:FullCastSpellOnTarget(63689, plr)
  419.     end
  420. end
  421.  
  422. function TEST_FIRE_IN_DA_HOLE(pUnit)
  423.     pUnit:RemoveEvents()
  424.     pUnit:SetCombatCapable(1)
  425.     pUnit:Root()
  426.     pUnit:SendChatMessage(42,0,"Blackhand prepares to unleash a powerful attack!")  -- Raid message
  427.     pUnit:RegisterEvent("Boom_Headshot_Stoneharry", 5000, 1)
  428. end
  429.  
  430. function Boom_Headshot_Stoneharry(pUnit)
  431.     pUnit:Unroot()
  432.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  433.     pUnit:CastSpellOnTarget(63689, plrs)
  434.     end
  435.     pUnit:ReturnToSpawnPoint()
  436.     pUnit:RegisterEvent("Wait_Another_Five_SEconds_Then_REStz_and_Respawn_Main", 5000, 1)
  437. end
  438.  
  439. function Wait_Another_Five_SEconds_Then_REStz_and_Respawn_Main(pUnit)
  440.     pUnit:SetCombatCapable(0)
  441.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  442.     plrs:SetPosition(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO())    -- Move the players
  443.     plrs:CastSpell(64446)
  444.     plrs:EnableFlight(false)
  445.     plrs:SetPlayerLock(0)
  446.     plrs:RemoveAura(71986) -- Visual
  447.     end
  448.     if BOSS_PLATFORM ~= nil then
  449.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x400)                               -- We respawn the object
  450.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x200)
  451.     else
  452.     pUnit:GetGameObjectNearestCoords(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 1930701):RemoveFlag(0x0006+0x0003,0x400) -- If it's still nil then the player's a tard and it deserves to error.
  453.     pUnit:GetGameObjectNearestCoords(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 1930701):RemoveFlag(0x0006+0x0003,0x200)
  454.     end
  455.     pUnit:SetMount(0)   -- Remove his mount
  456.     pUnit:SendChatMessage(42,0,"Blackhound Dismounts!")
  457.     pUnit:SetMovementFlags(1) -- Were on land, fool.
  458.     pUnit:SpawnCreature(BOSS_MOUNT_ID, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 21, 0) -- Hello Magic Kitty Boss, dragon drake thing.
  459.     pUnit:RegisterEvent("Parse_A_Second_Since_we_need_tO_wait_for_variable", 2000, 1)
  460. end
  461.  
  462. function Parse_A_Second_Since_we_need_tO_wait_for_variable(pUnit)
  463.     pUnit:RegisterEvent("Check_Drake_Health_For_Ever_In_Case_it_dies", 2500, 0)
  464.     pUnit:RegisterEvent("Stoneharry_FireLines", math.random(4000, 10000), 1)
  465.     pUnit:RegisterEvent("CurseOf_Reduce_Stoneharry", 15000, 0)
  466.     pUnit:RegisterEvent("ImmorlateThingy_Stoneharry", 17000, 0)
  467.     pUnit:RegisterEvent("Heal_Boss_Player_Tehe", 30000, 0)
  468.     BOSS_MOUNT:RegisterEvent("Breath_Fire_Like_A_Noob", 12000, 1)
  469.     BOSS_MOUNT:CastSpell(26977) -- Debuffs all people for a min, making them weaker to fire
  470. end
  471.  
  472. function Breath_Fire_Like_A_Noob(pUnit)
  473.     BOSS_MOUNT:RegisterEvent("Breath_Fire_Like_A_Noob", math.random(8000,15000), 1)
  474.     BOSS_MOUNT:FullCastSpell(36921) -- Breathing fire like a noob
  475. end
  476.  
  477. function Check_Drake_Health_For_Ever_In_Case_it_dies(pUnit)
  478.     if BOSS_MOUNT:GetHealthPct() < 20 then
  479.     pUnit:SendChatMessage(14,0,"No mortal can harm my drake while I still breath!")
  480.     BOSS_MOUNT:SetHealthPct(35) -- We can't let the drake die now, can we?
  481.     BOSS_MOUNT:CastSpell(24171) -- Heal visual which doesn't appear to work
  482.     end
  483. end
  484.  
  485. -------------------------------------------------------------------------------------------------------
  486. -- The Boss' Mount ------------------------------------------------------------------------------------
  487. -------------------------------------------------------------------------------------------------------
  488.  
  489. function Boss_Mount_On_Soawned_Stoneharru(pUnit)
  490.     BOSS_MOUNT = pUnit -- Allows us to handle it
  491.     BOSS_MOUNT:SetMaxPower(100, 2) -- amount is 100, type is 2
  492.     BOSS_MOUNT:SetPowerType(2) -- type is 2 (focus)
  493. end
  494.  
  495. function BOSS_MOUJn_HAS_DIED_DUN_DUN_DUN(pUnit)
  496.     BOSS_MOUNT:RemoveEvents()
  497. end
  498.  
  499. RegisterUnitEvent(BOSS_MOUNT_ID, 18, "Boss_Mount_On_Soawned_Stoneharru")
  500. RegisterUnitEvent(BOSS_MOUNT_ID, 4, "BOSS_MOUJn_HAS_DIED_DUN_DUN_DUN")
  501.  
  502. -------------------------------------------------------------------------------------------------------
  503. -- Ressetting the Fight -------------------------------------------------------------------------------
  504. -------------------------------------------------------------------------------------------------------
  505.  
  506. function OnLeave_Stoneharry(pUnit, Event)
  507.     pUnit:RemoveEvents()
  508.     if pUnit:IsAlive() then -- You can never be sure...
  509.     pUnit:SetFaction(15)    -- Reset faction
  510.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x400) -- Reset object
  511.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x200)
  512.         for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  513.         plrs:EnableFlight(false) -- Reset players
  514.         plrs:SetPlayerLock(0)
  515.         plrs:RemoveAura(71986) -- Visual
  516.         end
  517.         if BOSS_MOUNT ~= nil then
  518.         BOSS_MOUNT:RemoveEvents() -- Reset drake
  519.         BOSS_MOUNT:Despawn(1,0)
  520.         end
  521.     pUnit:RegisterEvent("Wait_A_Second_Stoneharry", 7500, 1) -- This is like on spawn, but this time we give him a chance to return to his spawn point
  522.     CLEAN_PET_DRAGONS() -- Clean database
  523.     end
  524. end
  525.  
  526. function OnDeath_Stoneharry(pUnit, Event)
  527.     for a, plrs in pairs(pUnit:GetInRangePlayers()) do
  528.     plrs:EnableFlight(false)
  529.     plrs:SetPlayerLock(0)
  530.     plrs:RemoveAura(71986) -- Visual
  531.     end
  532.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x400)
  533.     BOSS_PLATFORM:RemoveFlag(0x0006+0x0003,0x200)
  534.     pUnit:RemoveEvents()
  535.     if BOSS_MOUNT ~= nil then
  536.         if pUnit:IsAlive() then
  537.         BOSS_MOUNT:RemoveEvents()
  538.         BOSS_MOUNT:Despawn(1,0)
  539.         else
  540.         BOSS_MOUNT:SetHealth(1) -- If he's still alive and boss dies we want him to die as well, so now he dies 1 shot (prob from debuff) so they both die at the same time
  541.         end
  542.     end
  543.     CLEAN_PET_DRAGONS()
  544. end
  545.  
  546. RegisterUnitEvent(BOSS, 2, "OnLeave_Stoneharry")
  547. RegisterUnitEvent(BOSS, 4, "OnDeath_Stoneharry")
  548.  
  549. -------------------------------------------------------------------------------------------------------
  550. -- Adds -----------------------------------------------------------------------------------------------
  551. -------------------------------------------------------------------------------------------------------
  552. -- Fire Visuals and Damage
  553. function Fire_Visuals_Stoneharry(pUnit, event)
  554.     pUnit:Root()
  555.     pUnit:SetCombatCapable(1)
  556.     pUnit:RegisterEvent("WAIT_A_SEC_SEC_SEC", 1000, 1)
  557. end
  558.  
  559. function WAIT_A_SEC_SEC_SEC(pUnit, Event)
  560.     pUnit:Root() -- On spawn doesn't always trigger properly, so we'll do it again to be safe
  561.     pUnit:SetCombatCapable(1)
  562.     pUnit:CastSpell(74713) -- Visual and damage
  563.     pUnit:RegisterEvent("zzzWAIT_A_SEC_SEC_SEC", math.random(500,1000), 5) -- To give a bit of variety
  564. end
  565.  
  566. function zzzWAIT_A_SEC_SEC_SEC(pUnit, Event)
  567.     pUnit:CastSpell(74713) -- Visual and damage
  568. end
  569.  
  570. RegisterUnitEvent(FIRE, 18, "Fire_Visuals_Stoneharry")
  571. -- The Orbs of Summon+Explode
  572. function Orb_Spawn_And_Explode(pUnit, Event)
  573.     pUnit:SetMovementFlags(2)
  574.     pUnit:SetCombatCapable(1)
  575.     pUnit:Root()
  576.     pUnit:RegisterEvent("HOLD_ON_A_SECOND_MR_ICE_SPHERE", 500, 1)
  577. end
  578.  
  579. function HOLD_ON_A_SECOND_MR_ICE_SPHERE(pUnit)
  580.     pUnit:SetMovementFlags(2)
  581.     pUnit:SetCombatCapable(1)
  582.     pUnit:Root()
  583.     pUnit:RegisterEvent("PullPlayersClose_Tehe", 1000, 3)
  584.     pUnit:RegisterEvent("Lets_Go_Boom_Tehe_Orb", 4000, 1)
  585. end
  586.  
  587. function PullPlayersClose_Tehe(pUnit)
  588.     local rand = pUnit:GetRandomPlayer(0)
  589.     if rand ~= nil then
  590.     pUnit:CastSpell(69090) -- Visual
  591.     pUnit:FullCastSpellOnTarget(41959, rand)
  592.     end
  593. end
  594.  
  595. function Lets_Go_Boom_Tehe_Orb(pUnit)
  596.     pUnit:FullCastSpell(37106)
  597. end
  598.  
  599. RegisterUnitEvent(ORB_ID, 18, "Orb_Spawn_And_Explode")
  600. -- Fire orbs
  601.  
  602. function Fire_orb_goes_lol_stoneharry(pUnit, Event)
  603.     pUnit:Root()
  604.     pUnit:SetMovementFlags(2)
  605.     --pUnit:SetFlying()
  606.     pUnit:RegisterEvent("Lots_OF_us_so_hang_on_A_Second", 500, 1)
  607. end
  608.  
  609. function Lots_OF_us_so_hang_on_A_Second(pUnit)
  610.     pUnit:SetMovementFlags(2)
  611.     pUnit:SetCombatCapable(1)
  612.     pUnit:CastSpell(55928) -- Flame Sphere Visual
  613.     pUnit:CastSpell(55891) -- Flame Sphere Spawn Effect
  614.     --pUnit:SetFlying()
  615.     pUnit:Root()
  616.     pUnit:RegisterEvent("Be_Annoying_With_The_Fire_Things_Tehe", 300, 0)
  617.     pUnit:RegisterEvent("Despawn_the_damn_orb_stoneharry", 20000, 1)
  618. end
  619.  
  620. function Be_Annoying_With_The_Fire_Things_Tehe(pUnit)
  621.     local tram = pUnit:GetClosestPlayer()
  622.     if tram ~= nil then
  623.     pUnit:CastSpellOnTarget(55927, tram)
  624.     end
  625. end
  626.  
  627. function Despawn_the_damn_orb_stoneharry(pUnit)
  628.     if pUnit:IsAlive() then
  629.     pUnit:CancelSpell()
  630.     pUnit:RemoveEvents()
  631.     pUnit:Despawn(1,0)
  632.     end
  633. end
  634.  
  635. RegisterUnitEvent(FIRE_ORB, 18, "Fire_orb_goes_lol_stoneharry")
  636.  
  637. ------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement