Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.20 KB | None | 0 0
  1. #DungeonAdventureWizardLegendQuest v1.0
  2. #Written February 2011
  3. #   A text based single player adventure game, where the player
  4. #plays a warrior or wizard fighting their way through a
  5. #dungeon filled with zombies.
  6. from random import *
  7. from time import *
  8.  
  9. def main():
  10.     intro()
  11.     characterCreate()
  12.    
  13.  
  14. def characterCreate():
  15.     playerName = input("Enter your name: ")
  16.     playerType = input("Welcome ", playerName, ",\nChoose your character: \n1 - Warrior \n2 - Wizard")
  17.     if playerType == 1:
  18.         mainCharacter = character(warrior)
  19.         print("You have chosen to play a warrior.")
  20.     elif playerType == 2:
  21.         mainCharacter = character(wizard)
  22.         print("You have chosen to play a wizard")
  23.     print("Your adventure has now begun...")
  24.  
  25. #############################################
  26. #Not sure about the fight sequncing/new room programming. Once character and zombie
  27. #objects are done it can be refined and simplified
  28. ###############################################
  29. def newRoom():
  30.     if roomNumber == 0:
  31.         print("You are inside a room deep within the wizard's dungeon.")
  32.         print("Suddenly, a foul zombie leaps out and attacks!")
  33.     else :
  34.         print("You go down a passage into the next room.")
  35.         print("Suddenly, a foul zombie leaps out and attacks!")
  36.     fightDecision = input("What do you do? \n1 - Fight! \n2 - Run Away!")
  37.     if fightDecision == 1:
  38. ######################################################
  39. class character():
  40.     def __init__(role):
  41.         if role == warrior:     # Creates stats for a warrior player
  42.             character.health = 20
  43.             character.dexterity = 11
  44.             def playerAttack(self):    #This attack function will be referenced in the combat sequence
  45.                 dieRoll = 3*randint(1, 6)
  46.                 if dieRoll <= dexterity:
  47.                     character.damage = randint(1, 6) + 2
  48.                     roomZombie.health -= damage
  49.                     print("You chop the zombie for ", damage, "!")
  50.                 else:
  51.                     print("You miss!")
  52.         if role == wizard:      # Creates stats for a wizard player
  53.             character.health = 15
  54.             character.dexterity = 12
  55.             def playerAttack(self):        #This attack function will be referenced in the combat sequence
  56.                 dieRoll = 3*randint(1, 6)
  57.                 if dieRoll <= dexterity:
  58.                     character.damage = 2*randint(1, 6) + 1
  59.                     roomZombie.health -= damage
  60.                     print("You zap the zombie for ", damage, "!")
  61.                 else:
  62.                     print("You miss!")
  63. class zombie():     # Creates stats for a zombie with new health each time
  64.     zombie.health = 2*randint(1, 6)
  65.     zombie.dexterity = 11
  66.     def zombieAttack(self):       #This attack function will be referenced in the combat sequence
  67.         dieRoll = 3*randint(1, 6)
  68.         if dieRoll <= dexterity:
  69.             damage = randint(1, 6)
  70.             if damage < mainCharacter.armor:
  71.                 mainCharacter.health -= (damage - mainCharacter.armor)
  72.                 print("The zombie hits for ", damage)
  73.             else:
  74.                 print("The zombie's attack bounces harmlessly off your armor!")
  75.         else:
  76.             print("The zombie misses!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement