Advertisement
Guest User

Untitled

a guest
May 30th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.27 KB | None | 0 0
  1. Kill = {}
  2.  
  3. MaxAttkDist = 20
  4. MinAttkDist = 15
  5. MaxMobs = 5
  6. SafeDistance = 18
  7. StopAreaAttacks = 4
  8.  
  9. Kill.NPC = function(mob)
  10.     local npc = Ao.npcs:find(mob.uid, 0)
  11.     if npc.id == NPCCode.BaalCrab then
  12.         Kill.Baal(mob)
  13.     elseif npc.id == NPCCode.Mephisto then
  14.         Kill.Mephisto(mob)
  15.     elseif npc.id == NPCCode.Andariel then
  16.         Kill.Andariel(mob)
  17.     elseif npc.id == NPCCode.Diablo then
  18.         Kill.Diablo(mob)
  19.     elseif npc.id == NPCCode.Duriel then
  20.         Kill.Duriel(mob)
  21.     end
  22.  
  23.     while npc.uid > 0 and npc.mode == NPCMode.Alive do
  24.         if Ao.npcs:countInRadius(Ao.me.x, Ao.me.y, SafeDistance) > MaxMobs then
  25.             local point = GetPointInQuadrant(npc.x, npc.y, GetLeastPopulusQuadrant(npc.x, npc.y, SafeDistance), SafeDistance)
  26.             MoveTo(point.x, point.y)
  27.         end
  28.        
  29.         if distance(Ao.me.x, Ao.me.y, npc.x, npc.y) > MaxAttkDist or distance(Ao.me.x, Ao.me.y, npc.x, npc.y) < MinAttkDist then
  30.             local point = GetPointInQuadrant(npc.x, npc.y, GetLeastPopulusQuadrant(npc.x, npc.y, SafeDistance), SafeDistance)
  31.             MoveTo(point.x, point.y)
  32.             else
  33.             if Ao.me.states:isActive(StateType.SkillDelay) then
  34.                 if Ao.npcs:countInRadius(npc.x, npc.y, 5) > 3 then
  35.                    
  36.                     CastOn("NPC", npc.uid, "FireBall", Ao:getNumber("CastSleep"))
  37.                     else
  38.                    
  39.                     CastOn("NPC", npc.uid, "FireBolt", Ao:getNumber("CastSleep"))
  40.                     end
  41.                     else
  42.  
  43.                     CastOn("NPC", npc.uid, "Meteor", Ao:getNumber("CastSleep"))
  44.             end
  45.         end
  46.     end
  47. end
  48.  
  49. Kill.AllInRadius = function(x, y, radius)
  50.     local allnpc = Ao.npcs:findAllInRadius(x, y, radius)
  51.     for i = 0, allnpc:size() - 1 do
  52.         if allnpc[i]:IsImmune(ResistType.Fire) then
  53.             Ao.npcs:remove(allnpc[i].uid)
  54.         end
  55.     end
  56.    
  57.     while Ao.npcs:countInRadius(x, y, radius) > 0 do
  58.         allnpc = Ao.npcs:findAllInRadius(x, y, radius)
  59.         for i = 0, allnpc:size() - 1 do
  60.             if allnpc[i]:IsImmune(ResistType.FIre) then
  61.             Ao.npcs:remove(allnpc[i].uid)
  62.             end
  63.         end
  64.        
  65.         if Ao.npcs:countInRadius(Ao.me.x, Ao.me.y, SafeDistance) > MaxMobs then
  66.             local point = GetPointInQuadrant(x, y, GetLeastPopulusQuadrant(x, y, SafeDistance), SafeDistance)
  67.             MoveTo(point.x, point.y)
  68.         end
  69.        
  70.         if Ao.npcs:countInRadius(x, y, radius) < StopAreaAttacks then
  71.             Kill.NPC(allnpc[0])
  72.         else
  73.             local point = GetPointInQuadrant(x, y, GetMostPopulusQuadrant(x, y, radius), MinAttkDist)
  74.             if Ao.me.states:isActive(StateType.SkillDelay) then
  75.                 CastAt(point.x, point.y, "FireBall", Ao:getNumber("CastSleep"))
  76.             else
  77.                 CastAt(point.x, point.y, "FireBolt", Ao:getNumber("CastSleep"))
  78.             end
  79.         end
  80.     end
  81. end
  82.  
  83. Kill.HeroesInRadius = function(x, y, radius)
  84.     local hero = Ao.npcs:findHeroInRadius(x, y, radius)
  85.    
  86.     while hero.uid > 0 do
  87.         if Ao.npcs:countInRadius(Ao.me.x, Ao.me.y, SafeDistance) > MaxMobs then
  88.             local point = GetPointInQuadrant(x, y, GetLeastPopulusQuadrant(x, y, SafeDistance), SafeDistance)
  89.             MoveTo(point.x, point.y)
  90.         end
  91.        
  92.         Kill.NPC(hero)
  93.         hero = Ao.npcs:findHeroInRadius(x, y, radius)
  94.     end
  95. end
  96.  
  97. Kill.Player = function(player)
  98.  
  99. end
  100.  
  101. Kill.Baal = function(mob)
  102.  
  103. end
  104.  
  105. Kill.Mephisto = function(mob)
  106.  
  107. end
  108.  
  109. Kill.Andariel = function(mob)
  110.  
  111. end
  112.  
  113. Kill.Diablo = function(mob)
  114.  
  115. end
  116.  
  117. Kill.Duriel = function(mob)
  118.  
  119. end
  120. ---------------------------------------------
  121.  
  122. -------
  123. --            FireBall Sorceress Build        
  124.  
  125.     --
  126. -- Check libs/BuildSkills.lua for skill
  127.  
  128. functions --
  129. --   FrozenArmorCheck() and
  130.  
  131. EnergyShieldCheck()   --
  132. ---------------------------------------------
  133.  
  134. -------
  135.  
  136. function AttackSequence(npc) -- UNTESTED
  137.     if not EnergyShieldCheck() then return
  138.    
  139. end
  140.  
  141.     if not FrozenArmorCheck() then return
  142.  
  143. end
  144.    
  145.     if os.clock() - Ao:getNumber('Meteor') > 1.8 then
  146.         Ao:set('MeteorTimer', os.clock())
  147.         CastOn('NPC', npc.uid, 'Meteor')
  148.         return
  149.     end
  150.    
  151.     CastOn('NPC', npc.uid, 'FireBall')
  152.    
  153. end
  154.  
  155. function Precast()
  156.     FrozenArmorCheck()
  157.     EnergyShieldCheck()
  158. end
  159.  
  160. function AttackSequencePlayer(pl)
  161.     if os.clock() - Ao:getNumber('MeteorTimer') > 1.8 then
  162.         Ao:set('MeteorTimer', os.clock())
  163.         CastOn('Player', pl.uid, 'Meteor')
  164.     end
  165.    
  166.     CastOn('NPC', npc.uid, 'FireBall')
  167.    
  168. end
  169.  
  170. function PreAttack(x, y)
  171.     if os.clock() - Ao:getNumber('MeteorTimer') > 1.8 then
  172.         Ao:set('MeteorTimer', os.clock())
  173.         CastAt(x, y, 'Meteor')
  174.     end
  175. end
  176.  
  177. function PreWalk()
  178.    
  179. end
  180.  
  181. function TownCast()
  182.     FrozenArmorCheck()
  183.     EnergyShieldCheck()
  184. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement