Guest User

Untitled

a guest
Jul 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. =begin
  2. level 1
  3.  
  4. ---------
  5. |@ >|
  6. ---------
  7.  
  8. =end
  9.  
  10. class Player
  11. def play_turn(warrior)
  12. warrior.walk!
  13. end
  14. end
  15.  
  16. =begin
  17. level 2
  18.  
  19. ---------
  20. |@ s >|
  21. ---------
  22.  
  23. =end
  24.  
  25. class Player
  26. def play_turn(warrior)
  27. warrior.feel.empty?? warrior.walk! : warrior.attack!
  28. end
  29. end
  30.  
  31. =begin
  32. level 3
  33.  
  34. ---------
  35. |@ s ss s>|
  36. ---------
  37. =end
  38.  
  39. class Player
  40. def play_turn(warrior)
  41. warrior.feel.empty? && warrior.health<10? warrior.rest! : warrior.feel.empty?? warrior.walk! : warrior.attack!
  42. end
  43. end
  44.  
  45. =begin
  46. level 4
  47.  
  48. -------
  49. |@ Sa S>|
  50. -------
  51. =end
  52.  
  53. class Player
  54.  
  55. def play_turn(warrior)
  56. @health = warrior.health unless @health
  57. under_attack=false
  58. if warrior.health<@health then under_attack=true end
  59.  
  60. if (warrior.feel.empty?) && (warrior.health<18) && (not under_attack)
  61. warrior.rest!
  62. else
  63. if warrior.feel.empty?
  64. warrior.walk!
  65. else warrior.attack! end end
  66.  
  67. @health=warrior.health
  68. end
  69. end
Add Comment
Please, Sign In to add comment