Guest User

Untitled

a guest
May 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. game_over = false
  2.  
  3. def dragon_method
  4. puts " Danaerys took off with the dragons you want a direct attack or surprise attack?"
  5. puts " 1: Surprise Attack"
  6. puts " Any key: Direct Attack"
  7.  
  8. attack_choice = gets.chomp.to_i
  9. if attack_choice == 1
  10. puts "No coward can rule the Iron Throne"
  11. game_over = true
  12. puts "GAME OVER!"
  13. else
  14. puts "Good Choice!"
  15. puts "The lord commander will help you defeat them all!"
  16. puts "Oops, he betrayed you and took your place!"
  17. puts "You have been decapitaded for treason."
  18. game_over = true
  19. puts "GAME OVER!"
  20.  
  21. end
  22. end
  23.  
  24. def horse_method
  25. puts "Great!"
  26. puts "You leading now an army and a horse for battle"
  27. puts " 1: To get more allies!"
  28. puts " Any key: To march for battle now!"
  29. horse_attack = gets.chomp.to_i
  30. if horse_attack == 1
  31. puts "Congrats you'll join forces with Danaerys and conquered the iron throne"
  32. puts "LONG LIVE THE KING!"
  33. else
  34. puts "This army will not be enough"
  35. puts "You have been decapitaded for treason."
  36. game_over = true
  37. puts "GAME OVER!"
  38. end
  39. end
  40.  
  41. def play_game
  42. puts "Welcome to the Game of Thrones"
  43.  
  44. puts'<>=======() '
  45. puts'(/\___ /|\\ ()==========<>_'
  46. puts' \_/ | \\ //|\ ______/ \)'
  47. puts' \_| \\ // | \_/'
  48. puts' \|\/|\_ // /\/'
  49. puts' (oo)\ \_// /'
  50. puts' //_/\_\/ / |'
  51. puts' @@/ |=\ \ |'
  52. puts' \_=\_ \ |'
  53. puts' \==\ \|\_ '
  54. print ">> "
  55. characters = ["Mother of Dragons", "Lord Commander"]
  56. puts "Choose Your Character to conquer the Iron Throne!"
  57. puts " 1: The mother of dragons"
  58. puts " Any key: The lord commander"
  59. print ">> "
  60. character = gets.chomp.to_i - 1
  61. puts "OK #{characters[character]}, perfect lets begin!"
  62.  
  63. puts "Would you like to ride a Horse or a Dragon to get there?"
  64. print ">> "
  65. input = gets.chomp
  66. case input.downcase
  67.  
  68. when "dragon"
  69. dragon_method
  70.  
  71. when "horse"
  72. horse_method
  73. else
  74. puts "Please choose a valid option"
  75. end
  76. end
  77.  
  78. # Call the game
  79.  
  80. loop do
  81. play_game
  82. p "<>"*20
  83. p "Game Over!"
  84. game_over = true
  85. puts "Do you want to play again?"
  86. puts "1.- yes | 2.- no"
  87. response = gets.chomp
  88. if response == "1"
  89. game_over = false
  90. end
  91. puts `clear`
  92. break if ( game_over == true )
  93. end
Add Comment
Please, Sign In to add comment