Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is a Python file to practice classes for the RPG I am writing.
- # Probably going to screw this up terribly but hey it's worth a shot.
- class pInfo(object):
- """Info section for creating a character.
- I need the following info:
- Name (pName)
- Age (pAge)
- Location (pLoc)
- Class (pClass)
- Health (pHealth)
- """
- def __init__(self, pName, pAge, pLoc, pClass):
- self.pName = pName
- self.pAge = pAge
- self.pLoc = pLoc
- self.pClass = pClass
- self.pHealth = 10
- self.pMana = 3
- self.pSpeed = 5
- while True:
- pName = input("Enter your name: ")
- if all(i.isalpha() or i.isspace() for i in pName) \
- and pName != "":
- print("Nice to meet you, " + pName + "!\n")
- break
- else:
- print("That doesn't look like a valid name, you silly goose!\n"
- "Let's try that again.\n")
- while True:
- try:
- pAge = int(input("Enter your age: "))
- except ValueError:
- print("I don't believe that's a number.\n"
- "Let's try that again.\n")
- else:
- if pAge >= 10 and pAge <= 21:
- print(str(pAge) + " years old?! " + "Eager for adventure, are we?\n"
- "Hope you know how to handle a proper weapon or else you're\n"
- "going to end up as worm food sooner than you think.\n")
- break
- elif pAge > 21 and pAge <= 60:
- print("You look like a seasoned adventurer for a " + str(pAge) + " year old.\n"
- "Just don't get too cocky or else you'll end up with a steel\n"
- "necklace ear to ear. Get my drift?\n")
- break
- elif pAge > 60 and pAge <= 99:
- print("Still traveling around the world at " + str(pAge) + "?\n"
- "I'm impressed! Just remember that thieves and monsters\n"
- "won't go easy on you just because you're an old timer.\n")
- break
- else:
- print("No way you expect me to believe that.\n"
- "Let's try that again.\n")
- while True:
- print("In Aleria, there are 3 ruling kingdoms: Menith, Pajbal, and Orleaus.\n"
- "Each kingdom has its own unique background and offers different benefits.\n")
- LocMenu = ["Menith", "Pajbal", "Orleaus"]
- for i in enumerate(LocMenu, start=1):
- print(f"{i[0]} - {i[1]}")
- try:
- pLoc = int(input("Enter the number of your location: "))
- except ValueError:
- print("Was that one of the choices? I think not. Let's try again.\n")
- else:
- if pLoc == 1:
- print("Menith is a militant order with a history saturated in conflict.\n"
- "Their government is a ruled by a small council of highly decorated\n"
- "officers who have absolute authority over every issue. As a citizen\n"
- "of Menith, you were required to serve in their army at a young age\n"
- "for several years. Through your service in their military, you are\n"
- "trained in martial fighting and have a keen mind for combat tactics.\n")
- break
- elif pLoc == 2:
- print("Pajbal, widely referred to as ""The Sapphire of the Sands,""is a\n"
- "wonderous city located in the center of the Almathian Desert. Pajbal\n"
- "is home to the Aetherian Academy, a world renowned institution for\n"
- "academic research in magic. Your life in Pajbal made you curious about\n"
- "magic and you decided to apply your interest to the Academy, where you\n"
- "learned a great deal about magic. As a result, you developed the abilities\n"
- "to cast powerful spells and read ancient scriptures.")
- break
- elif pLoc == 3:
- print("Orleaus\n")
- break
- else:
- print("What did you even write? Let's try again.\n")
- while True:
- ClassMenu = ["Fighter", "Mage", "Thief"]
- for i in enumerate(ClassMenu, start=1):
- print(f"{i[0]} - {i[1]}")
- try:
- pClass = int(input("Select your class: "))
- except ValueError:
- print("That's not a class, my friend. Let's try again.\n")
- else:
- if pClass == 1:
- print("You're a fighter, not a lover!\n")
- break
- elif pClass == 2:
- print("Yer a wizard, " + pName + "! Er, I mean Mage.\n")
- break
- elif pClass == 3:
- print("Sneaky sneaky, stabby stabby.\n")
- break
- else:
- print("You can't be that because it doesn't exist. Let's try again.\n")
- player = pInfo(pName, pAge, pLoc, pClass)
- while True:
- print("Alright so let's make sure we got all the right info:")
- print("Your name is " + str(player.pName) + ".")
- print("Your age is " + str(player.pAge) + ".")
- print("Your location is " + str(LocMenu[pLoc - 1]) + ".")
- print("Your class is " + str(ClassMenu[pClass - 1]) + ".")
- try:
- verifyPlayer = input("We good? ")
- except ValueError:
- print("What you say?\n")
- else:
- if verifyPlayer == "Y":
- print("Excellent!")
- print("Your total health is " + str(player.pHealth) + ".")
- print("Your total mana is " + str(player.pMana) + ".")
- print("You have " + str(player.pSpeed) + " speed points.")
- break
- elif verifyPlayer == "N":
- print("D'oh! Well let's start over then.")
- # I want to make the user start over
- break
- else:
- print("Not a valid answer!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement