Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class player:
- def __init__(self, name, hitpoints):
- self.name = name
- self.hitpoints = 100
- self.Bigattack = random.randint(0, 75)
- self.Smallattack = random.randint(15, 45)
- self.Heal = random.randint(15, 45)
- def decide(self, other):
- if self.hitpoints > 0:
- print ("What kind of move will you make?")
- print ("You can make a Big, Small or heal?")
- xs = raw_input(">").lower()
- if xs == "big":
- self.fight(self.Bigattack, other)
- elif xs == "small":
- self.fight(self.Smallattack, other)
- elif xs == "Heal":
- self.heal(other)
- else:
- print("{} has won you have lost!").format(other)
- def fight(self, move, other):
- if self.hitpoints > 0:
- other.hitpoints -= self.move
- print other.hitpoints
- return other.decide
- else:
- print "{} loses {} wins!".format(self, other)
- def heal(self, other):
- self.heal
- print self.hitpoints
- return other.fight()
- player1 = player("Judas", 100)
- player2 = player("Ben", 100)
- def whogoes():
- print "A random selection utility will decide who goes first"
- number = random.randint(0, 10)
- if number >= 5:
- player1.decide(player2)
- if number <= 4:
- player2.decide(player1)
- whogoes()
Advertisement
Add Comment
Please, Sign In to add comment