Advertisement
Guest User

Untitled

a guest
Mar 20th, 2014
79
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. : function DmgTrack()
  10. : local bot_hp, bot_mhp = you.hp()
  11. : local dmg_inturn = 0
  12. : local huge_int = 0
  13. : local percent_hp = 0
  14. : local percent_old_hp = 0
  15. : local percent_hp_txt = "--%"
  16. : if dmg_old_hp > 0 then
  17. : if bot_hp < dmg_old_hp then
  18. : dmg_inturn = dmg_old_hp - bot_hp
  19. : percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
  20. : percent_hp = math.ceil((bot_hp*100)/bot_mhp)
  21. : percent_hp_txt = percent_hp .. "%"
  22. : if percent_hp < 30 then
  23. : percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
  24. : elseif percent_hp < 55 then
  25. : percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
  26. : elseif percent_hp < 75 then
  27. : percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
  28. : end
  29. : percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
  30. : if dmg_inturn > (bot_hp*0.25) then
  31. : huge_dmg_note(dmg_inturn)
  32. : if dmg_inturn > (bot_hp*0.45) then
  33. : crawl.mpr("<green>Mandatory exit. Think how to survive! </green>")
  34. : crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
  35. : crawl.flush_prev_message()
  36. : crawl.more()
  37. : crawl.sendkeys("S")
  38. : crawl.sendkeys("y")
  39. : else
  40. : crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
  41. : dmg_old_hp = bot_hp
  42. : crawl.flush_prev_message()
  43. : crawl.more()
  44. : crawl.more_autoclear()
  45. : end
  46. : else
  47. : if dmg_inturn > (bot_hp*0.15) then
  48. : crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow> hp: " .. percent_hp_txt)
  49. : else
  50. : crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. " hp: " .. percent_hp_txt)
  51. : end
  52. : end
  53. : crawl.flush_prev_message()
  54. : end
  55. : end
  56. : dmg_old_hp = bot_hp
  57. : end
  58.  
  59. : function huge_dmg_note(x)
  60. : crawl.take_note("Huge Dmg: " .. x .. " dmg")
  61. : end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement