Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- class player:
- def __init__(self,name):
- self.name = name
- self.health = 100
- self.mana = randint(100,200)
- self.defense = randint(10,15)
- self.attack = randint(20,25)
- self.xp = 0
- self.level = 1
- def print_stats(self):
- print("-----------")
- print("Adventurer name:",self.name)
- print("Health:",self.health)
- print("Mana:",self.mana)
- print("Defense:",self.defense)
- print("Attack:",self.attack)
- print("-----------")
- def eat_food(self,food):
- if food == "apple":
- print("You are allergic to apples and you die.")
- self.health = 0
- self.print_stats()
- print("Yo ded.")
- else:
- print("You are healed for 5, well done.")
- self.health += 5
- self.print_stats()
- print("Great job!")
- player1 = player(input("Enter name\n-->"))
- player2 = player(input("Enter name\n-->"))
Add Comment
Please, Sign In to add comment