Guest User

Untitled

a guest
Apr 12th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import random
  2.  
  3.  
  4. class player:
  5. def __init__(self, name, hitpoints):
  6. self.name = name
  7. self.hitpoints = 100
  8.  
  9.  
  10. self.Bigattack = random.randint(0, 75)
  11. self.Smallattack = random.randint(15, 45)
  12. self.Heal = random.randint(15, 45)
  13.  
  14.  
  15.  
  16.  
  17.  
  18. def decide(self, other):
  19. if self.hitpoints > 0:
  20.  
  21. print ("What kind of move will you make?")
  22. print ("You can make a Big, Small or heal?")
  23. xs = raw_input(">").lower()
  24.  
  25. if xs == "big":
  26. self.fight(self.Bigattack, other)
  27. elif xs == "small":
  28. self.fight(self.Smallattack, other)
  29. elif xs == "Heal":
  30. self.heal(other)
  31. else:
  32. print("{} has won you have lost!").format(other)
  33.  
  34. def fight(self, move, other):
  35. if self.hitpoints > 0:
  36. other.hitpoints -= self.move
  37. print other.hitpoints
  38. return other.decide
  39. else:
  40. print "{} loses {} wins!".format(self, other)
  41.  
  42. def heal(self, other):
  43. self.heal
  44. print self.hitpoints
  45. return other.fight()
  46.  
  47. player1 = player("Judas", 100)
  48. player2 = player("Ben", 100)
  49.  
  50.  
  51.  
  52. def whogoes():
  53. print "A random selection utility will decide who goes first"
  54. number = random.randint(0, 10)
  55.  
  56. if number >= 5:
  57. player1.decide(player2)
  58.  
  59. if number <= 4:
  60. player2.decide(player1)
  61.  
  62.  
  63. whogoes()
Advertisement
Add Comment
Please, Sign In to add comment