Commit 09b72621 by BellCodeEditor

save project

parent c619e270
Showing with 8 additions and 7 deletions
......@@ -18,15 +18,16 @@ class Hero(object):
print(enemy.name+" is kill,game is stop ")
exit()
def cure(self):
self.hp+=60
o=random.randint(30,100)
self.hp+=o
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+" cure 60 blood volume ,"+" at present rest "+str(self.hp))
print(self.name+" cure "+str(o)+" blood volume , " +" at present rest "+str(self.hp))
class player(Hero):
def __init__(self,name):
super().__init__(name)
self.attack = 231
self.hp = 210
self.attack = 20
self.hp = 320
self.max_hp = self.hp
p1 = player("A")
p2 = Hero("B")
......@@ -45,10 +46,10 @@ while True:
else:
print("please again input (1combot/2cure)")
continue
k=random.randint(1,3)
if k =="1":
num=random.randint(1,3)
if num ==1:
p2.combat(p1)
elif k=="2" or k=="3":
elif num ==2 or num ==3:
p2.cure()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment