Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.48 KB | None | 0 0
  1. - Advanced Shooter for Mages
  2. -- Version 1.0.1 - By Heronas
  3. -- Credits for playercheck go to Leonardo
  4. init start
  5. -- Set monsters to consider when using spells/area runes
  6. local creatureNames = Monsters
  7. local FlamMonsters = {"Hydra","Earth Elemental","Slime"}
  8. local VisMonsters = {"Hydra","Slime"}
  9. local SdMonsters = {"Hydra"}
  10. local gfbMonsters = {"Hydra","Earth Elemental","Slime"}
  11.  
  12.  
  13. function has_value (tab, val)
  14. for index, value in ipairs (tab) do
  15. if value == val then
  16. return true
  17. end
  18. end
  19.  
  20. return false
  21. end
  22.  
  23. -- Spells such as beams/waves/UEs and even knight/paladin spells can be set here
  24. -- Example: {name = "exevo vis hur", amount = 3, monsters = {'Hydra'}},
  25. -- name = spell name or words, amount = monster amount, monsters = monsters to consider
  26. local spells = {
  27. {name = "exevo gran mas flam", amount = 4, monsters = FlamMonsters},
  28. {name = "exevo gran mas vis", amount = 3, monsters = VisMonsters},
  29. }
  30.  
  31. -- Area runes such as thunderstorms can be set here
  32. -- Example: {name = "thunderstorm rune", amount = 3, monsters = {'Crystal Spider'}},
  33. -- name = rune name, amount = monster amount, monsters = monsters to consider
  34. local areaRunes = {
  35. {name = "great fireball rune", amount = 2, monsters = gfbMonsters},
  36. }
  37.  
  38. -- Target runes such as SDs can be set here, for now only supports 1 targetrune
  39. -- Example: {name = "sudden death rune", amount = 3, monsters = {'Demon'}},
  40. -- name = rune name, amount = monster amount, monsters = monsters to consider
  41. local targetRunes = {
  42. {name = "sudden death rune", amount = 1, monsters = SdMonsters},
  43. }
  44.  
  45. -- Check for players, taken from Leonardo's scripts
  46. local players = {
  47. consider = getuseroption("pvp"),
  48. distance = 8,
  49. safeList = {"Bubble", "Eternal Oblivion"},
  50. floorDifference = 1
  51. }
  52.  
  53. -- Set to true to use strong strikes
  54. local strongStrike = true
  55. local maxStrike = true
  56.  
  57. -- DON'T EDIT BELOW THIS LINE IF YOU DON'T KNOW WHAT YOU'RE DOING --
  58. --------------------------------------------------------------------
  59.  
  60. -- Directions to check
  61. local shootDir = {'n', 'w', 's', 'e'}
  62.  
  63. -- Initial values for loop iteration
  64. local quitLoop = 0
  65. local exhaustTime = 0
  66. local countTries = 0
  67. local areaCountLow = 10
  68. local spellCountLow = 10
  69.  
  70. for i,j in pairs(spells) do
  71. if spellCountLow > spells[i].amount then
  72. spellCountLow = spells[i].amount
  73. end
  74. spells[i].monsters = spells[i].monsters or creatureNames
  75. end
  76.  
  77. for i,j in pairs(areaRunes) do
  78. if areaCountLow > areaRunes[i].amount then
  79. areaCountLow = areaRunes[i].amount
  80. end
  81. areaRunes[i].monsters = areaRunes[i].monsters or creatureNames
  82. end
  83.  
  84. for i,j in pairs(targetRunes) do
  85. targetRunes[i].monsters = targetRunes[i].monsters or creatureNames
  86. end
  87.  
  88. -- Prints
  89. init end
  90.  
  91. auto(50, 100)
  92. quitLoop = 0
  93.  
  94. -- Reset exhaust time if a new projectile is fired from your position to your target's position
  95. if $lastprojectile.tox == $attacked.posx and $lastprojectile.toy == $attacked.posy and $lastprojectile.fromx == $posx and $lastprojectile.fromy == $posy then
  96. exhaustTime = $timems
  97. end
  98.  
  99. if $timems >= exhaustTime then
  100. if not players.consider or paroundfloorignore(players.distance, players.floorDifference, unpack(players.safeList)) == 0 then
  101. -- Spells
  102. if maround(8) >= spellCountLow and spells[1] ~= nil and getsetting('Targeting/Creatures/Hydra/Setting1/OnlyIfTrapped') == "no" then
  103. for i=1,table.getn(spells) do
  104. if cancast(spells[i].name) then
  105. for j,_ in pairs(shootDir) do
  106. if maroundspell(spells[i].name, shootDir[j], unpack(spells[i].monsters)) >= spells[i].amount then
  107. cast(spells[i].name)
  108. quitLoop = 1
  109. end
  110. end
  111. end
  112. end
  113. end
  114.  
  115. -- Area Runes
  116. if maround(8) >= areaCountLow and areaRunes[1] ~= nil and quitLoop ~= 1 then
  117. for i=1,table.getn(areaRunes) do
  118. runeArea = getarearunetile(false, unpack(areaRunes[i].monsters))
  119. if $mppc > 30 and runeArea.amount >= areaRunes[i].amount and itemcount(areaRunes[i].name) ~= 0 then
  120. countTries = 0
  121. pausewalking(400)
  122. shootarearune(areaRunes[i].name, 2, true)
  123. wait(500)
  124. countTries = 1
  125. if $lastprojectile.time <= exhaustTime then
  126. countTries = 2
  127. end
  128. quitLoop = 1
  129. end
  130. end
  131. end
  132. end
  133.  
  134. -- Targetrunes and strikes
  135. if $attacked.id ~=0 and quitLoop == 0 then
  136. if maround(7, unpack(targetRunes[1].monsters)) >= targetRunes[1].amount and maround(7,unpack(creatureNames)) == 1 then
  137. useoncreature(targetRunes[1].name, $target)
  138. elseif (cancast("Exori max vis") and has_value(VisMonsters,$attacked.name) or has_value(FlamMonsters,$attacked.name) and cancast("Exori max flam")) and maxStrike and $attacked.dist <= 3 and math.ceil(creatureinfo($attacked.name).hp * math.min($attacked.hppc + 0.5, 100) / 100) > spellinfo("exori gran vis").mindmg then
  139. if maround(7, unpack(creatureNames)) == 1 and cancast("Exori max vis") and has_value(VisMonsters,$attacked.name) then
  140. cast("exori max vis")
  141. elseif maround(7, unpack(creatureNames)) == 1 and cancast("Exori max flam") and has_value(FlamMonsters,$attacked.name) then
  142. cast("exori max flam")
  143. end
  144. elseif (cancast("Exori gran vis") or cancast("Exori gran flam")) and strongStrike and $attacked.dist <= 3 then
  145. if maround(7, unpack(creatureNames)) == 1 and cancast("exori gran vis") and has_value(VisMonsters,$attacked.name) then
  146. cast("exori gran vis")
  147. elseif maround(7, unpack(creatureNames)) == 1 and cancast("exori gran flam") and has_value(FlamMonsters,$attacked.name) then
  148. cast("exori gran flam")
  149. end
  150. elseif $attacked.dist <= 3 then
  151. caststrike(0)
  152. end
  153. end
  154.  
  155. -- Add exhaust time, takes into account if you missfire an area rune
  156. exhaustTime = $timems + 1000 - countTries*500
  157. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement