Advertisement
Guest User

DZ_11

a guest
Dec 15th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. import random
  2.  
  3. min_health = 0
  4. max_health = 35
  5. player_health = max_health
  6. bot_health = max_health
  7.  
  8. # spell = [spell_name, damage, healing]
  9. spells = [['fireball', 10, 0], ['metabolism', 0, 8], ['silence', 0, 0], ['water', 5, 2]]
  10. name = 0
  11. damage = 1
  12. heal = 2
  13.  
  14. # Print to console
  15. print('''
  16. ==========================================
  17. ================ OPTIONS =================
  18. Spell Damage Healing''')
  19. i = 1
  20. for row in spells:
  21. print(f'\n{[i]}', end=' - ')
  22. i+=1
  23. for elem in row:
  24. print('\t', elem, end='')
  25. print(f'''
  26. =========================================
  27. ============== WIZARD DUEL ==============
  28. PLAYER vs BOT
  29. {player_health} {bot_health}
  30. =========================================''')
  31.  
  32. # Img to ASCII
  33. new_round = '''
  34. .....__.............................@......
  35. ..._##_............................._##_...
  36. ...##|_..............................###...
  37. .._##._####.........#.#........_####__##_..
  38. ...###.####...._###-...|###_..._####_##@_..
  39. ..._@###____####._.......__####__._###_....
  40. .....########._.............._########_....
  41. .._######__......................_######_..
  42. _####_.$####$................_#####-._####.
  43. _##......._###_.............-###_.......##_
  44. _##........._##@._......._.###........._##_
  45. ####........._####.......####..........####
  46. ...........................................
  47. '''
  48. win = '''
  49. ##########################################
  50. ################_||||#||||_###############
  51. ###########|||||||||||||||||||||##########
  52. ##########$|||||||||||||||||||||$#########
  53. ######|||||||||||||||||||||||||||||||#####
  54. ######|||||||||__-$$$$$$$$$$|||||||||#####
  55. ##$||||||||$|||$$$$$$$$$$$$$|||$||||||||##
  56. ###|||||||||$|||$$$$$$$$$$$@||$|||||||||##
  57. ####|||||||||$$||$$$$$$$$$|||$|||||||||###
  58. #$||||||||||||||$$$$$$$$$$$@|||||||||||||#
  59. #||||||||||||||||||$$$$$|||||||||||||||||@
  60. ###|||||||||||||||||$$$$|||||||||||||||@##
  61. ##|||||||||||||||||$$$$$||||||||||||||||$#
  62. #||||||||||||||||||$$$$$$||||||||||||||||@
  63. ####-||||||||||||$$$$$$$$$||||||||||||-###
  64. ####|||||||||||||$$$$$$$$$||||||||||||-###
  65. ####|||||||||||||$$$$$$$$$|||||||||||||###
  66. ########||||||||@@||@@@@@@@||||||||#######
  67. ########||||||||||||||||||||||||||$#######
  68. #############||||||||||||||||$############
  69. ##############||###$|||###$||#############
  70. '''
  71. battle = '''
  72. mmmmmmmmmmmmmmmmmmmmmmmNNmmmmNmmmmmmmNNNNN
  73. soydmmmmmmmmmmmmNNmmmmmmmmmmmmmmmmmmmmmNNN
  74. ddsohhdmmmmmmmNNNNmmmmmmNNmmmmmmmmmmmmmmNN
  75. mmmdddmmmmmmmmmNNNmNmmmNNNmmmNmmmmmmmmmmNN
  76. mmmmddhhhhssshhdmmmNNNNNNNmyyhmmmmmmNmmmmm
  77. mmmmhyyys+/o//++sdmmmNNNNmmsysdmmmmmNNmmmm
  78. mmmddhyhddd/+/soshhdddmmmmmddhyhmmmmmNNNNN
  79. hhyysysdNNNdhyhyyyhddddhhsysohhyddddddmmNN
  80. ddhhyyydNNNNmmdhhddmmddddysyoyyoyyyhhdmmmm
  81. mmdddhhmNNNNmddddmmmmmmmdddmmddhdmmmmmmmmm
  82. NNNmmmNMMMNddmmmNNmmmNNmmmNNNNNmmNNNNNNNNN
  83. '''
  84.  
  85. # ------------- Start -------------
  86. while True:
  87. # Player select
  88. print('\nStart Wizard Duel?\n[Y] - Yes\n[N] - No.\n[I] - Information.')
  89. select = input('Your select: ')
  90. if select == 'N' or select == 'n':
  91. break
  92. elif select == 'I' or select == 'i':
  93. print('Information:\nFireball - Damage:10, Healing:0\nMetabolism - Damage:0,Healing:8\nSilence - Damage and healing:0\nWater - Damage:5, Healing:2')
  94. elif (not select == 'Y') and (not select == 'y'):
  95. print('Error! Try again.')
  96. else:
  97. # Start new game
  98. print('==========================================')
  99. print(battle)
  100. for round in range(1, 4):
  101. choice = True
  102. while choice:
  103. player_select = input('\nSelect spell: ')
  104. if player_select > '0' and player_select <= str(len(spells)):
  105. player_select = int(player_select)
  106. player_select = player_select - 1
  107. bot_select = random.randint(0, len(spells)-1)
  108. choice = False
  109. else:
  110. print('Error! Try again.')
  111.  
  112. play_1 = spells[player_select][name] # The spell selected by the player
  113. play_2 = spells[bot_select][name] # The spell selected by the bot
  114.  
  115. # Use spell
  116. if play_1 == 'silence' and play_2 == 'silence':
  117. print(f'''
  118. ----ROUND № {round}----
  119. -----SILENCE-----
  120. ''')
  121. continue
  122. elif play_1 == 'silence':
  123. player_select = bot_select
  124. player_health += spells[bot_select][damage]
  125. elif play_2 == 'silence':
  126. bot_select = player_select
  127. bot_health += spells[player_select][damage]
  128. # Health
  129. player_health += spells[player_select][heal]
  130. player_health -= spells[bot_select][damage]
  131. bot_health += spells[bot_select][heal]
  132. bot_health -= spells[player_select][damage]
  133.  
  134. # Max & min health
  135. if player_health > max_health and bot_health > max_health:
  136. player_health = max_health
  137. bot_health = max_health
  138. elif player_health > max_health:
  139. player_health = max_health
  140. elif bot_health > max_health:
  141. bot_health = max_health
  142. print(f'''
  143. ----ROUND № {round}----{new_round}
  144. Player: {play_1}
  145. Player health: {player_health}
  146.  
  147. Bot: {play_2}
  148. Bot health: {bot_health}''')
  149. if player_health < min_health or bot_health < min_health:
  150. break
  151.  
  152. # ------------- The end -------------
  153. print('''=========================================
  154. =============== Game over ===============''')
  155. if player_health > bot_health:
  156. print('Congratulations! You win!')
  157. elif player_health < bot_health:
  158. print('Sorry... The computer wins!')
  159. else:
  160. print('Draw!')
  161. print(win, '\n=========================================')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement