Commit 96a5cdf1 by BellCodeEditor

save project

parent c30e7d34
Showing with 8 additions and 2 deletions
import random import random
v=0
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -8,7 +9,7 @@ class Hero(object): ...@@ -8,7 +9,7 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
blood=random.randint(1,100) blood=random.randint(1,150)
self.hp=self.hp+blood self.hp=self.hp+blood
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp=self.max_hp self.hp=self.max_hp
...@@ -64,8 +65,10 @@ while True: ...@@ -64,8 +65,10 @@ while True:
houyi.combat(yase) houyi.combat(yase)
if l=='2': if l=='2':
houyi.cure() houyi.cure()
if l=='3': if l=='3' and i=0:
houyi.s(yase) houyi.s(yase)
i=3
print("大招冷却3秒)
if yase.hp<=0: if yase.hp<=0:
print('你赢了') print('你赢了')
break break
...@@ -77,3 +80,5 @@ while True: ...@@ -77,3 +80,5 @@ while True:
if houyi.hp<=0: if houyi.hp<=0:
print('你输了') print('你输了')
break break
if i>0:
i=i-1
\ No newline at end of file
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