Advertisement
Guest User

Untitled

a guest
Apr 14th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. : local dmg_old_hp = 0
  2.  
  3. <
  4. function ready()
  5. DmgTrack()
  6. end
  7. >
  8.  
  9.  
  10. : function DmgTrack()
  11. : local bot_hp, bot_mhp = you.hp()
  12. : local dmg_inturn = 0
  13. : local huge_int = 0
  14. : local percent_hp = 0
  15. : local percent_old_hp = 0
  16. : local percent_hp_txt = "--%"
  17. : if dmg_old_hp > 0 then
  18. : if bot_hp < dmg_old_hp then
  19. : dmg_inturn = dmg_old_hp - bot_hp
  20. : percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
  21. : percent_hp = math.ceil((bot_hp*100)/bot_mhp)
  22. : percent_hp_txt = percent_hp .. "%"
  23. : if percent_hp < 30 then
  24. : percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
  25. : elseif percent_hp < 55 then
  26. : percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
  27. : elseif percent_hp < 75 then
  28. : percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
  29. : end
  30. : percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
  31. : if dmg_inturn > (bot_hp*0.25) then
  32. : huge_dmg_note(dmg_inturn)
  33. : if dmg_inturn > (bot_hp*0.45) then
  34. : crawl.mpr("<green>Mandatory exit. Think how to survive! </green>")
  35. : crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
  36. : crawl.flush_prev_message()
  37. : crawl.more()
  38. : crawl.sendkeys("S")
  39. : crawl.sendkeys("y")
  40. : else
  41. : crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
  42. : dmg_old_hp = bot_hp
  43. : crawl.flush_prev_message()
  44. : crawl.more()
  45. : crawl.more_autoclear()
  46. : end
  47. : else
  48. : if dmg_inturn > (bot_hp*0.15) then
  49. : crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow> hp: " .. percent_hp_txt)
  50. : else
  51. : crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. " hp: " .. percent_hp_txt)
  52. : end
  53. : end
  54. : crawl.flush_prev_message()
  55. : end
  56. : end
  57. : dmg_old_hp = bot_hp
  58. : end
  59.  
  60. : function huge_dmg_note(x)
  61. : crawl.take_note("Huge Dmg: " .. x .. " dmg")
  62. : end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement