KingZalak.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. --[[
  2. Script Name : SpawnScripts/EchoesOfTimeEpic/KingZalaktheAncient.lua
  3. Script Purpose : King Zalak the Ancient in Echoes of Time: Epic
  4. Script Author : alfa24t
  5. Script Date : 03/09/2022
  6. Boss Mechanics : Boss periodically call Royal Patriarch that can spawn in 3 different spot. If Royal P come near Zalak it cast AOE on raid and heal Zalak
  7. Buff
  8. UnholyBlessing -- 90195
  9. InnoruuksCaress -- 90130
  10. Spell
  11. Grave Sacrament III -- 90105
  12. SiphonStrength -- 90174
  13. --]]
  14. buffs = {90195, 90130}
  15. spells = {90105,90174}
  16. groupspawn = {365523, 365519, 365524, 365521, 365522} --need to remove 365520 from zone spwns
  17. adds = {365525, 365526, 133772501, 133772502, 133772503, 133772504, 133772505, 133772506, 133772507}
  18. function spawn(NPC)
  19. AddTimer(NPC, 1500, "spellbuffloop")
  20. end
  21. function respawn(NPC)
  22. spawn(NPC)
  23. end
  24. function hailed(NPC, Spawn)
  25. end
  26. function hailed_busy(NPC, Spawn)
  27. end
  28. function casted_on(NPC, Spawn, Message)
  29. end
  30. function targeted(NPC, Spawn)
  31. end
  32. function attacked(NPC, Spawn)
  33. end
  34. function aggro(NPC, Spawn)
  35. AddTimer(NPC, math.random(15000, 25000), "spellattackloop")
  36. AddTimer(NPC, 30000, "addsloop")
  37. end
  38. function spellbuffloop(NPC, Spawn) -- Loopback function for spellcasts.
  39. if IsAlive(NPC) then
  40. CastSpell(NPC, buffs[math.random(#buffs)], 3, NPC)
  41. AddTimer(NPC, math.random(15000, 25000), "spellbuffloop")
  42. end
  43. end
  44. function spellattackloop(NPC, Spawn) -- Loopback function for spellcasts.
  45. if IsAlive(NPC) then
  46. if IsInCombat(NPC) then
  47. local hated = GetMostHated(NPC)
  48. if hated ~= nil then
  49. FaceTarget(NPC, hated)
  50. CastSpell(hated, spells[math.random(#spells)], 3, NPC)
  51. end
  52. AddTimer(NPC, math.random(15000, 25000), "spellattackloop")
  53. end
  54. end
  55. end
  56. function addsloop(NPC, Spawn)
  57. zone = GetZone(NPC)
  58. if IsAlive(NPC) then
  59. if IsInCombat(NPC) then
  60. Shout(NPC, "Royal Patriarchs come aid your king!")
  61. SpawnByLocationID(zone, adds[math.random(#adds)])
  62. SpawnByLocationID(zone, adds[math.random(#adds)])
  63. SpawnByLocationID(zone, adds[math.random(#adds)])
  64. AddTimer(NPC, 30000, "addsloop")
  65. end
  66. end
  67. end
  68. function healthchanged(NPC, Spawn)
  69. end
  70. function auto_attack_tick(NPC, Spawn)
  71. end
  72. function death(NPC, Spawn)
  73. --StopTimer(NPC, "spellbuffloop")
  74. --StopTimer(NPC, "spellattackloop")
  75. --StopTimer(NPC, "addsloop")
  76. for k,v in ipairs(adds) do
  77. if IsAlive(GetSpawnByLocationID(zone, v)) then
  78. Despawn(GetSpawnByLocationID(zone, v), 1)
  79. end
  80. end
  81. end
  82. function killed(NPC, Spawn)
  83. --StopTimer(NPC, "spellbuffloop")
  84. --StopTimer(NPC, "spellattackloop")
  85. --StopTimer(NPC, "addsloop")
  86. for k,v in ipairs(adds) do
  87. if IsAlive(GetSpawnByLocationID(zone, v)) then
  88. Despawn(GetSpawnByLocationID(zone, v), 1)
  89. end
  90. end
  91. end
  92. function CombatReset(NPC)
  93. --StopTimer(NPC, "spellbuffloop")
  94. --StopTimer(NPC, "spellattackloop")
  95. --StopTimer(NPC, "addsloop")
  96. local zone = GetZone(NPC)
  97. for k,v in ipairs(adds) do
  98. if IsAlive(GetSpawnByLocationID(zone, v)) then
  99. Despawn(GetSpawnByLocationID(zone, v), 1)
  100. end
  101. end
  102. for k,v in ipairs(groupspawn) do
  103. if IsAlive(GetSpawnByLocationID(zone, v)) then
  104. Despawn(GetSpawnByLocationID(zone, v), 1)
  105. end
  106. end
  107. SpawnGroupByID(zone, 9116)
  108. Despawn(NPC)
  109. end
  110. function randomchat(NPC, Message)
  111. end