Advertisement
Dieselkaine

shitty battle sim2

Jul 1st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.28 KB | None | 0 0
  1. ### shitty battle simulator ###
  2. import random
  3. import time
  4.  
  5. playerHealth = 50
  6. compHealth = 50
  7.  
  8. def battleIntro():
  9.     print ("You enter the arena to the cheers of the crowds. ")
  10.     print ("Across fomr you stands your opponent. ")
  11.     print ("Only one you will leave this place alive. ")
  12.     print ("Prepare to fight!" )
  13.     print()
  14.    
  15. def battlePlayer():
  16.     global compHealth
  17.     global playerHealth
  18.     missChance = 2
  19.     while playerHealth >  0 and compHealth > 0:
  20.         print ("Do you wish to attack")
  21.         #input ("enter")
  22.  
  23.         miss = random.randint (1, 4)
  24.        
  25.         if (missChance) == (miss):
  26.             print ("You swing wildly and miss your opponent. ")
  27.             print()
  28.         else:
  29.             print ("You strike your opponent doing damage. ")
  30.             print()
  31.             compHealth = compHealth - 5
  32.         break
  33.            
  34. def battleComp():
  35.     global playerHealth
  36.     global compHealth
  37.     missChance = 2
  38.     while playerHealth >  0 and compHealth > 0:
  39.         print ("Your opponent charges at you. ")
  40.         #time.sleep(2)
  41.  
  42.         miss = random.randint (1, 4)
  43.        
  44.         if (missChance) == (miss):
  45.             print ("You dodge his attack. ")
  46.             print()
  47.         else:
  48.             print ("He manages to strike you doing damage. ")
  49.             print()
  50.             playerHealth = playerHealth - 5
  51.         break
  52.        
  53. def battleResult():
  54.     global comphealth
  55.     global playerHealth
  56.     if compHealth == 0:
  57.         print ("Your hands are slick with his blood. ")
  58.         print ("You have slayen your opponent." )
  59.         print()
  60.        
  61.     elif playerHealth == 0:
  62.         print ("Your opponent stands over you and drives his sword into your chest. ")
  63.         print ("You have died! ")
  64.         print()
  65.        
  66. def battleLoop():
  67.     while playerHealth >  0 and compHealth > 0:
  68.         battlePlayer()
  69.         battleComp()
  70.     #if playerHealth < 0 or compHealth < 0:
  71.         #battleResult()
  72.    
  73. playAgain = "yes"  
  74. while playAgain == "yes" or playAgain == "y":
  75.     playerHealth = playerHealth + 50
  76.     compHealth = compHealth + 50
  77.     battleIntro()
  78.     #battlePlayer()
  79.     #battleComp()
  80.     battleLoop()
  81.     battleResult()
  82.  
  83.     print ("Do you want to play again?")
  84.     playAgain = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement