Commit 22ca7455 by BellCodeEditor

save project

parent dc285fb3
Showing with 6 additions and 5 deletions
...@@ -7,14 +7,15 @@ class Hero(object): ...@@ -7,14 +7,15 @@ class Hero(object):
self.name = name self.name = name
def combat(self,enemy): def combat(self,enemy):
info1="亚瑟对后羿发起攻击" enemy.hp-=self.attack
info2="造成"+str(object.attack)+"点伤害" info1=self.name+"对"+enemy.name+"发起攻击"
if object.hp>0: info2="造成"+str(self.attack)+"点伤害"
info3=object+"还剩下"+str(object.hp)+"点血量" if enemy.hp>0:
info3=enemy.name+"还剩下"+str(enemy.hp)+"点血量"
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
else: else:
info3=object+"阵亡,游戏结束" info3=enemy+"阵亡,游戏结束"
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
exit() exit()
......
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