Commit b9a2982e by BellCodeEditor

save project

parent a287a7f8
Showing with 18 additions and 3 deletions
...@@ -11,7 +11,7 @@ class Hero(object): ...@@ -11,7 +11,7 @@ class Hero(object):
self.hp=self.hp+60 self.hp=self.hp+60
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp=self.max_hp self.hp=self.max_hp
print("现在的血量是"+self.hp) print("现在的血量是"+str(self.hp))
def combat(self, enemy): # 普通攻击 def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻," info1 = self.name+"对"+enemy.name+"发起进攻,"
...@@ -50,4 +50,20 @@ houyi = Player("射手", "后羿") ...@@ -50,4 +50,20 @@ houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
while True: while True:
print('-'*30) print('-'*30)
input("请选择释放英雄技能(1攻击/2治疗)") choise=input("请选择释放英雄技能(1攻击/2治疗)")
\ No newline at end of file if choise=="q":
print("结束")
break
elif choise=="1":
houyi.combat(yase)
elif choise=="2":
houyi.cure()
else:
print("请重新输入")
num=random.randint(1,3)
if num=="1":
yase.combat(houyi)
else:
yase.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