Advertisement
FireMageLynn

Untitled

May 18th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. function _M:drawicons()
  2. local enemies = spotHostiles()
  3. -- enemies exist?
  4. if enemies and (#enemies > 0) then
  5. print("existance of enemies, amount below")
  6. print(#enemies)
  7. -- for every enemy!
  8. for eid, null in ipairs(enemies) do
  9. local enemy_actor = enemies[eid]
  10. print(enemy_actor.name)
  11. energy_need = game.energy_to_act or 1000
  12. local e_energy_have = enemy_actor.energy.value or 1
  13. local y_energy_have = game.player.energy.value or 1
  14. local e_energy_gain = game.energy_per_tick * (enemy_actor.global_speed or 1 ) * (enemy_actor.energy.mod or 1)
  15. local y_energy_gain = game.energy_per_tick * (game.player.global_speed or 1 ) * (game.player.energy.mod or 1)
  16. local e_max_speed = table.min(getSpeeds(enemy_actor))
  17. if (e_energy_have > energy_need) then
  18. e_ticks_till_move = math.ceil((energy_need - e_energy_have + energy_need*e_max_speed) / (e_energy_gain))
  19. else
  20. e_ticks_till_move = math.ceil((energy_need - e_energy_have) / (e_energy_gain))
  21. end
  22. local i = 0
  23. local position = 0
  24. for i = 1,6 do
  25. local y_ticks_till_move = math.ceil((energy_need - y_energy_have + energy_need*getSpeeds(game.player)[i]) / (y_energy_gain))
  26. -- whether or not you get a free move depends on
  27. -- a. whether they are currently moving or not
  28. -- b. ticks till move and
  29. if (y_ticks_till_move < e_ticks_till_move) and (e_energy_have >= energy_need) then
  30. images[i][1]:toScreenFull(64*position+16, 16, 64, 64, images[i][2], images[i][3], 1, 1, 1, 1)
  31. position = position + 1
  32. print("extra move of type",move_type[i])
  33. elseif (y_ticks_till_move <= e_ticks_till_move) and (e_energy_have < energy_need) then
  34. images[i][1]:toScreenFull(64*position+16, 16, 64, 64, images[i][2], images[i][3], 1, 1, 1, 1)
  35. position = position + 1
  36. print("extra move of type",move_type[i])
  37. else
  38. print("NOT GETTING extra move of type",move_type[i])
  39. end
  40. end
  41. end
  42. print("[FREEACTIONMOD] run completed")
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement