Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.34 KB | None | 0 0
  1. import time
  2. import random
  3. '''
  4. print("________________________")
  5. print("|                      |")
  6. print("________________________")
  7. print("|")
  8. print("|")
  9. print("|")
  10. print("|")
  11. print("|")
  12. print("________")
  13. print("|      |")
  14. print("|______|")
  15. print("|")
  16. print("|")
  17. print(" atherland")
  18. print("")
  19. '''
  20. playername = input("What is your name?")
  21. zone = 1
  22. movement = 0
  23. restcounter = 0
  24. searchcounter = 0
  25.  
  26. class Player:
  27.     def __init__(self, name, hp, mp, atk, xp, dodgerate, atkrate):
  28.         self.name = playername
  29.         self.hp = hp
  30.         self.mp = mp
  31.         self.atk = atk
  32.         self.xp = xp
  33.         self.dodgerate = dodgerate
  34.         self.atkrate = atkrate
  35.  
  36. class Enemy(Player):
  37.     def __init__(self, name, gold, maxhp, hp, mp, atk, xp):
  38.         self.name = name
  39.         self.gold = gold
  40.         self.maxhp = maxhp
  41.         self.hp = hp
  42.         self.mp = mp
  43.         self.atk = atk
  44.         self.xp = xp
  45. class Items:
  46.     def __init__(self, name, quantity, description, price, weight):
  47.         self.name = name
  48.         self.quantity = quantity
  49.         self.description = description
  50.         self.price = price
  51.         self.weight = weight
  52.  
  53.  
  54. Player = Player(playername, 1, 1, 1, 1, 25, 3)
  55. print(Player.name + " has been created. ")
  56.  
  57.  
  58. time.sleep(1)
  59. print("You feel weightless and uneasy. \n A windy sensation is going through \n your entire body.")
  60. time.sleep(1)
  61. print("Or atleast what you think is your body. You try to look below yourself and you have no feet or arms!")
  62. time.sleep(1)
  63. print("You struggle to comprehend what is going on, and \n in search for what your supposed to be you float towards...")
  64. time.sleep(1)
  65.  
  66. '''
  67. def raceselection():
  68.    raceinput = input("Do you float towards the TEMPLE, CAVE or FOREST?")
  69.    if raceinput == "TEMPLE":
  70.        print("You are now a high elf. High elves utlize a lot of magical power at the cost of being very frail.")
  71.        Player.hp = Player.hp + 24
  72.        Player.mp = Player.mp + 100
  73.        Player.atk = Player.atk + 50
  74.        print("You awaken from your slumber. Your room's walls are gold plated, and you rested on a flat board.")
  75.        print("Out the door, you see many elves with robes praying to some goddess.")
  76.        print("You walk out of your door and into the praying area. You are immediately greeted by a tall man.")
  77.    elif raceinput == "CAVE":
  78.        print("You are now an orc.")
  79.        Player.hp = Player.hp + 1000
  80.        Player.mp = Player.mp + 15
  81.        Player.atk = Player.atk + 50
  82.        print("cave")
  83.    elif raceinput == "FOREST":
  84.        print("You are now a human.")
  85.        Player.hp = Player.hp + 50
  86.        Player.mp = Player.mp + 25
  87.        Player.atk = Player.atk + 25
  88.    else:
  89.        print("You can't float there!")
  90.        raceselection()
  91.  
  92.  
  93. raceselection()
  94. '''
  95. def PlayerAttack():
  96.     while(Enemy.hp > 1):
  97.         time.sleep(atkrate)
  98.         Enemy.hp = Enemy.hp - Player.atk
  99.         print("You attacked the enemy for " + Player.atk + " damage (" + atkrate + ")" + "The enemy has " + Enemy.hp + " left!")
  100.         if (Enemy.hp <= 1):
  101.             print("You have defeated " + Enemy + "!")
  102.             Player.xp += Player.xp + Enemy.xp
  103.             Gold = Gold + Enemy.gold
  104.             del Enemy
  105.             movement = movement + 1
  106. def EnemyAttack():
  107.     while (PlayerAttack is true):
  108.         time.sleep(enemy.atkrate)
  109.         Player.hp = Player.hp - Enemy.atk
  110.         if (Player.hp <= 1):
  111.                     print(Enemy + " has defeated you!")
  112.                     print("You have lost the game!")
  113.                     exit.os()
  114. inventory = []
  115. def gameprompt():
  116.     global inventory
  117.     global zone
  118.     global movement
  119.     global restcounter
  120.     global searchcounter
  121.     if (movement == 5):
  122.         movement = movement - movement
  123.         zone = zone + 1
  124.         print("You have advanced to zone",zone,"!!!")
  125.         gameprompt()
  126.     if (zone == 1):
  127.         print("Welcome to the first zone! Easy enemies are here with not very good loot./fix grammar, add description of zone/")
  128.     elif (zone == 2):
  129.         print("Hey, it actually travelled to the second zone, awesome!")
  130.     elif (zone == 3):
  131.         print("Zone 3")
  132.     elif (zone == 4):
  133.         print("You are now in Zone 4")
  134.     prompt = input("Would you like to walk, search or rest?: ")
  135.  
  136.     if (prompt == "walk"):
  137.         encounterchance = random.randint(1, 3)
  138.         if (encounterchance == 2):
  139.             if (zone == 1):
  140.                 mobspawnrate = random.randint(1,3)
  141.                 if (mobspawnrate == 1):
  142.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  143.                     print("You have encountered a " + Enemy.name + "!!!")
  144.                     PlayerAttack()
  145.                     EnemyAttack()
  146.                 elif (mobspawnrate == 2):
  147.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  148.                     print("You have encountered a " + Enemy.name + "!!!")
  149.                     PlayerAttack()
  150.                     EnemyAttack()
  151.                 elif (mobspawnrate == 3):
  152.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  153.                     print("You have encountered a " + Enemy.name + "!!!")
  154.                     PlayerAttack()
  155.                     EnemyAttack()
  156.             if (zone == 2):
  157.                 mobspawnrate2 = random.randint(1,3)
  158.                 if (mobspawnrate2 == 1):
  159.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  160.                     print("You have encountered a " + Enemy.name + "!!!")
  161.                     PlayerAttack()
  162.                     EnemyAttack()
  163.                 elif (mobspawnrate2 == 2):
  164.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  165.                     print("You have encountered a " + Enemy.name + "!!!")
  166.                     PlayerAttack()
  167.                     EnemyAttack()
  168.                 elif (mobspawnrate2 == 3):
  169.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  170.                     print("You have encountered a " + Enemy.name + "!!!")
  171.                     PlayerAttack()
  172.                     EnemyAttack()
  173.             if (zone == 3):
  174.                 mobspawnrate3 = random.randint(1,3)
  175.                 if (mobspawnrate3 == 1):
  176.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  177.                     print("You have encountered a " + Enemy.name + "!!!")
  178.                     PlayerAttack()
  179.                     EnemyAttack()
  180.                 elif (mobspawnrate3 == 2):
  181.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  182.                     print("You have encountered a " + Enemy.name + "!!!")
  183.                     PlayerAttack()
  184.                     EnemyAttack()
  185.                 elif (mobspawnrate3 == 3):
  186.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  187.                     print("You have encountered a " + Enemy.name + "!!!")
  188.                     PlayerAttack()
  189.                     EnemyAttack()
  190.             if (zone == 4):
  191.                 mobspawnrate4 = random.randint(1,3)
  192.                 if (mobspawnrate4 == 1):
  193.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  194.                     print("You have encountered a " + Enemy.name + "!!!")
  195.                     PlayerAttack()
  196.                     EnemyAttack()
  197.                 elif (mobspawnrate4 == 2):
  198.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  199.                     print("You have encountered a " + Enemy.name + "!!!")
  200.                     PlayerAttack()
  201.                     EnemyAttack()
  202.                 elif (mobspawnrate4 == 3):
  203.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  204.                     print("You have encountered a " + Enemy.name + "!!!")
  205.                     PlayerAttack()
  206.                     EnemyAttack()
  207.             if (zone == 5):
  208.                 mobspawnrate3 = random.randint(1,3)
  209.                 if (mobspawnrate5 == 1):
  210.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  211.                     print("You have encountered a " + Enemy.name + "!!!")
  212.                     PlayerAttack()
  213.                     EnemyAttack()
  214.                 elif (mobspawnrate5 == 2):
  215.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  216.                     print("You have encountered a " + Enemy.name + "!!!")
  217.                     PlayerAttack()
  218.                     EnemyAttack()
  219.                 elif (mobspawnrate5 == 3):
  220.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  221.                     print("You have encountered a " + Enemy.name + "!!!")
  222.                     PlayerAttack()
  223.                     EnemyAttack()
  224.             if (zone == 6):
  225.                 mobspawnrate4 = random.randint(1,3)
  226.                 if (mobspawnrate6 == 1):
  227.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  228.                     print("You have encountered a " + Enemy.name + "!!!")
  229.                     PlayerAttack()
  230.                     EnemyAttack()
  231.                 elif (mobspawnrate6 == 2):
  232.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  233.                     print("You have encountered a " + Enemy.name + "!!!")
  234.                     PlayerAttack()
  235.                     EnemyAttack()
  236.                 elif (mobspawnrate6 == 3):
  237.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  238.                     print("You have encountered a " + Enemy.name + "!!!")
  239.                     PlayerAttack()
  240.                     EnemyAttack()
  241.             if (zone == 7):
  242.                 mobspawnrate7 = random.randint(1,3)
  243.                 if (mobspawnrate7 == 1):
  244.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  245.                     print("You have encountered a " + Enemy.name + "!!!")
  246.                     PlayerAttack()
  247.                     EnemyAttack()
  248.                 elif (mobspawnrate7 == 2):
  249.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  250.                     print("You have encountered a " + Enemy.name + "!!!")
  251.                     PlayerAttack()
  252.                     EnemyAttack()
  253.                 elif (mobspawnrate7 == 3):
  254.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  255.                     print("You have encountered a " + Enemy.name + "!!!")
  256.                     PlayerAttack()
  257.                     EnemyAttack()
  258.             if (zone == 8):
  259.                 mobspawnrate8 = random.randint(1,3)
  260.                 if (mobspawnrate8 == 1):
  261.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  262.                     print("You have encountered a " + Enemy.name + "!!!")
  263.                     PlayerAttack()
  264.                     EnemyAttack()
  265.                 elif (mobspawnrate8 == 2):
  266.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  267.                     print("You have encountered a " + Enemy.name + "!!!")
  268.                     PlayerAttack()
  269.                     EnemyAttack()
  270.                 elif (mobspawnrate8 == 3):
  271.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  272.                     print("You have encountered a " + Enemy.name + "!!!")
  273.                     PlayerAttack()
  274.                     EnemyAttack()
  275.             if (zone == 9):
  276.                 mobspawnrate9 = random.randint(1,3)
  277.                 if (mobspawnrate9 == 1):
  278.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  279.                     print("You have encountered a " + Enemy.name + "!!!")
  280.                     PlayerAttack()
  281.                     EnemyAttack()
  282.                 elif (mobspawnrate9 == 2):
  283.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  284.                     print("You have encountered a " + Enemy.name + "!!!")
  285.                     PlayerAttack()
  286.                     EnemyAttack()
  287.                 elif (mobspawnrate9 == 3):
  288.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  289.                     print("You have encountered a " + Enemy.name + "!!!")
  290.                     PlayerAttack()
  291.                     EnemyAttack()
  292.             if (zone == 10):
  293.                 mobspawnrate10 = random.randint(1,3)
  294.                 if (mobspawnrate10 == 1):
  295.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  296.                     print("You have encountered a " + Enemy.name + "!!!")
  297.                     PlayerAttack()
  298.                     EnemyAttack()
  299.                 elif (mobspawnrate10 == 2):
  300.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  301.                     print("You have encountered a " + Enemy.name + "!!!")
  302.                     PlayerAttack()
  303.                     EnemyAttack()
  304.                 elif (mobspawnrate10 == 3):
  305.                     Enemy = Enemy("Blue SlimeBall", 50, 0, 25, 15, 25, 0.500)
  306.                     print("You have encountered a " + Enemy.name + "!!!")
  307.                     PlayerAttack()
  308.                     EnemyAttack()
  309.         else:
  310.             movement = movement + 1
  311.             print("You have walked a step. You are now at ",movement," steps")
  312.             gameprompt()
  313.     elif (prompt == "search"):
  314.         if (searchcounter == 3):
  315.             print("You cannot search this area anymore! Wait until you reach the next zone!")
  316.             gameprompt()
  317.         else:
  318.             searchchance = random.randint(1, 5)
  319.             if (searchchance == 1 or 2 or 3 or 4):
  320.                 searchcounter = searchcounter + 1
  321.                 print(searchcounter)
  322.                 print("You have found something!")
  323.                 searchchance = random.randint(1,4)
  324.                 if (searchchance == 1 or 2):
  325.                     inventory.append(Items("Old Boot", 1, "An old smelly boot. It's a mystery as to who it belongs to...", 5, 50))
  326.                     print("You have found a Boot!")
  327.                     print(inventory)
  328.                 elif(searchchance == 3):
  329.                     inventory.append(Items("Shiny Boot", 1, "Looks like a boot that was lightly worn. You could still wear this.", 5, 50))
  330.                     print(inventory)
  331.                     print("You have found a Shiny Boot!")
  332.                 elif(searchchance == 4):
  333.                     inventory.append(Items("Golden Boot", 1, "It's too heavy to wear, but it looks like it could sell for a fortune!", 5, 50))
  334.                     print("You have found a Golden Boot?")
  335.                     print(inventory)
  336.             else:
  337.                 searchcounter = searchcounter + 1
  338.                 print(searchcounter)
  339.                 print("You did not find anything of value")
  340.             gameprompt()
  341.     elif (prompt == "rest"):
  342.         if (restcounter == 1):
  343.             print("Wait until you reach the next zone to rest again!")
  344.             gameprompt()
  345.         else:
  346.             # Add a MaxHP value to the player later, and the command rest will give 25% of that HP back.
  347.             Player.hp = Player.hp + (Player.hp / 5)
  348.             print("You have restored ",(Player.hp / 5)," hit points!")
  349.             restcounter = restcounter + 1
  350.             gameprompt()
  351.     elif (prompt == "examine"):
  352.         print([item.name for item in inventory])
  353.         gameprompt()
  354. gameprompt()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement