Advertisement
WIEDERBELEBUNG

/r/beginnerprojects Turn based game

Dec 1st, 2015
1,599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.25 KB | None | 0 0
  1. # Reddit-Link: https://www.reddit.com/r/beginnerprojects/comments/1aw0iq/project_turn_based_pokemon_style_game/
  2.  
  3. # All of this is not even close to be finished.
  4.  
  5. from random import randint
  6.  
  7. print""
  8. print" .,;#@ Turn Based Game @#;,."
  9. print""
  10.  
  11. print"How it works:" # Game Introduction follows
  12. print"There are 3 Moves you got: Punch, Kick and Heal"
  13. print"Punch deals moderate damage (18 - 25)"
  14. print"Kick can deal high or low damage (10 - 35)"
  15. print"Heal heals you for 18 - 25"
  16. print""
  17. print"Both, the computer and you, have 100 HP, if you reach 0 you loose"
  18. print"This game is turn based"
  19. print""
  20. print"-----------------------------------------------------------------"
  21. print""
  22.  
  23.  
  24. hpc = 100 # HP computer
  25. hpu = 100 # HP user
  26.  
  27. turn = 1 # responible for the turn, the user always starts
  28.  
  29. # declaring functions of the 'moves' you can do
  30. def punch(x):
  31.     indiefresse = randint(18,25)
  32.     x -=indiefresse
  33.     print"Punch dealt ",indiefresse," damage."
  34.    
  35. def kick(y):
  36.     aufsmaul = randint(10,35)
  37.     y -= aufsmaul
  38.     print"Kick dealt ",aufsmaul," damage."
  39.    
  40. def heal(z):
  41.     glueckauf = randint(18,25)
  42.     z += glueckauf
  43.     print"Heal healed for ",glueckauf," HP."
  44.  
  45. while hpu != 0 or hpc != 0: # here starts the fighting
  46.    
  47.    
  48.    
  49.     while turn == 1: # users turn
  50.         print"Du hast ",hpu," Lebenspunkte!"
  51.         action = input("Welche Aktion moechtest du ausfuehren? Punch = 1, Kick = 2 und Heal = 3. Geb die Nummer ein: ")
  52.        
  53.         if action == 1:
  54.             punch(hpc)
  55.             print"Your Enemy has ",hpc," HP left."
  56.             print ""
  57.            
  58.         elif action == 2:
  59.             kick(hpc)
  60.             print"Your Enemy has ",hpc," HP left."
  61.             print ""
  62.            
  63.         elif action == 3:
  64.             heal(hpu)
  65.             print"You have ",hpu," HP left."
  66.             print ""
  67.            
  68.         else:
  69.             print"Please stay with the Number 1 for Punch, 2 for Kick and 3 for Heal ..."
  70.        
  71.         turn += 1
  72.        
  73.        
  74.     while turn == 2:
  75.         narf = randint(1,11)
  76.        
  77.         if hpc <= 35:
  78.            
  79.             if narf < 4:
  80.                 print "The enemys ",punch(hpu)
  81.                 print ""
  82.                
  83.             elif narf < 7:
  84.                 print "The enemys ",kick(hpu)
  85.                 print ""
  86.                
  87.             else:
  88.                 heal(hpc)
  89.                 print"The Computers HP increased to",hpu," HP."
  90.                 print ""
  91.        
  92.         else:
  93.            
  94.            
  95.             if narf < 5:
  96.                 print "The enemys ",punch(hpu)
  97.                 print ""
  98.                                
  99.                            
  100.             elif narf < 9:
  101.                 print "The enemys ",kick(hpu)
  102.                 print ""
  103.                
  104.             else:                  
  105.                 heal(hpc)
  106.                 print"The Computers HP increased to",hpu," HP."
  107.                 print ""
  108.                
  109.         turn -= 1
  110.    
  111.    
  112.  
  113.    
  114.    
  115. else: # here we declare what happens, when the hp of someone drops to zero
  116.     if hpu == 0:
  117.         print"You lost!"
  118.     elif hpc == 0:
  119.         print"You won!"
  120.     else:
  121.         print"Something went wrong, this is for debugging"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement