Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from PlayerGenerator import GenName, GenHistory
- def diceroll(t, p):
- result = 0
- for i in range(t):
- result += random.randint(1, p)
- return result
- def GenPlayer(level):
- player = {}
- player['name'] = GenName()
- player['history'] = GenHistory()
- player['attack'] = diceroll(3,6) + diceroll(level,4)
- player['defense'] = diceroll(3,6) + diceroll(level,4)
- player['health'] = diceroll(5,6) + diceroll(level,4)
- player['row'] = 0
- player['col'] = 0
- return player
- def Main():
- while True:
- print(GenPlayer(random.randint(1,10)))
- choice = input("Are you satisfied with the player? (Y/N): ")
- if choice.upper() == "Y":
- break
- elif choice.upper() == "N":
- print("I'm sorry you didn't like that character. Let me try again.")
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement