Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #DungeonAdventureWizardLegendQuest v1.0
- #Written February 2011
- # A text based single player adventure game, where the player
- #plays a warrior or wizard fighting their way through a
- #dungeon filled with zombies.
- from random import *
- from time import *
- def main():
- intro()
- characterCreate()
- def characterCreate():
- playerName = input("Enter your name: ")
- playerType = input("Welcome ", playerName, ",\nChoose your character: \n1 - Warrior \n2 - Wizard")
- if playerType == 1:
- mainCharacter = character(warrior)
- print("You have chosen to play a warrior.")
- elif playerType == 2:
- mainCharacter = character(wizard)
- print("You have chosen to play a wizard")
- print("Your adventure has now begun...")
- #############################################
- #Not sure about the fight sequncing/new room programming. Once character and zombie
- #objects are done it can be refined and simplified
- ###############################################
- def newRoom():
- if roomNumber == 0:
- print("You are inside a room deep within the wizard's dungeon.")
- print("Suddenly, a foul zombie leaps out and attacks!")
- else :
- print("You go down a passage into the next room.")
- print("Suddenly, a foul zombie leaps out and attacks!")
- fightDecision = input("What do you do? \n1 - Fight! \n2 - Run Away!")
- if fightDecision == 1:
- ######################################################
- class character():
- def __init__(role):
- if role == warrior: # Creates stats for a warrior player
- character.health = 20
- character.dexterity = 11
- def playerAttack(self): #This attack function will be referenced in the combat sequence
- dieRoll = 3*randint(1, 6)
- if dieRoll <= dexterity:
- character.damage = randint(1, 6) + 2
- roomZombie.health -= damage
- print("You chop the zombie for ", damage, "!")
- else:
- print("You miss!")
- if role == wizard: # Creates stats for a wizard player
- character.health = 15
- character.dexterity = 12
- def playerAttack(self): #This attack function will be referenced in the combat sequence
- dieRoll = 3*randint(1, 6)
- if dieRoll <= dexterity:
- character.damage = 2*randint(1, 6) + 1
- roomZombie.health -= damage
- print("You zap the zombie for ", damage, "!")
- else:
- print("You miss!")
- class zombie(): # Creates stats for a zombie with new health each time
- zombie.health = 2*randint(1, 6)
- zombie.dexterity = 11
- def zombieAttack(self): #This attack function will be referenced in the combat sequence
- dieRoll = 3*randint(1, 6)
- if dieRoll <= dexterity:
- damage = randint(1, 6)
- if damage < mainCharacter.armor:
- mainCharacter.health -= (damage - mainCharacter.armor)
- print("The zombie hits for ", damage)
- else:
- print("The zombie's attack bounces harmlessly off your armor!")
- else:
- print("The zombie misses!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement