Advertisement
biswasrohit20

game2

May 11th, 2021
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1.  
  2. import random
  3. from PlayerGenerator import GenName, GenHistory
  4.  
  5.  
  6. def diceroll(t, p):
  7. result = 0
  8. for i in range(t):
  9. result += random.randint(1, p)
  10. return result
  11.  
  12.  
  13. def GenPlayer(level):
  14. player = {}
  15. player['name'] = GenName()
  16. player['history'] = GenHistory()
  17. player['attack'] = diceroll(3,6) + diceroll(level,4)
  18. player['defense'] = diceroll(3,6) + diceroll(level,4)
  19. player['health'] = diceroll(5,6) + diceroll(level,4)
  20. player['row'] = 0
  21. player['col'] = 0
  22.  
  23. return player
  24.  
  25.  
  26. def Main():
  27.  
  28. while True:
  29. print(GenPlayer(random.randint(1,10)))
  30. choice = input("Are you satisfied with the player? (Y/N): ")
  31. if choice.upper() == "Y":
  32. break
  33. elif choice.upper() == "N":
  34. print("I'm sorry you didn't like that character. Let me try again.")
  35.  
  36.  
  37. Main()
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement