Commit 8a978fee by BellCodeEditor

save project

parent 8118bedb
Showing with 9 additions and 2 deletions
...@@ -8,7 +8,8 @@ class Hero(object): ...@@ -8,7 +8,8 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
self.hp=self.hp+60 sjsm=random.randint(30,60)
self.hp=self.hp+sjsm
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
...@@ -44,7 +45,7 @@ print(" 战斗开始") ...@@ -44,7 +45,7 @@ print(" 战斗开始")
while True: while True:
print("-"*20) print("-"*20)
shuru=input("请选择释放英雄技能(1攻击/2治疗)") shuru=input("请选择释放英雄技能(1攻击/2治疗)")
elif shuru=="1": if shuru=="1":
houyi.combat(yase) houyi.combat(yase)
elif shuru=="2": elif shuru=="2":
houyi.cure() houyi.cure()
...@@ -53,6 +54,12 @@ while True: ...@@ -53,6 +54,12 @@ while True:
else: else:
print("请重新输入") print("请重新输入")
continue
suiji=random.randint(1,3)
if suiji==1:
yase.cure()
else:
yase.combat(houyi)
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