Commit eec36c3c by BellCodeEditor

save project

parent 181e5a72
Showing with 9 additions and 4 deletions
......@@ -10,15 +10,20 @@ class Hero(object):
enemy.hp -= self.attack
info1 = str(self.name)+"对"+str(enemy.name)+"发起攻击,"
info2 = "造成了"+str(enemy.attack)+"点伤害!"
if self.hp>0:
if enemy.hp>0:
info3 = str(enemy.name)+"还剩"+str(enemy.hp)+"点血量!!!"
info=info1+info2+info3
print(info)
else :
info3 = "敌人阵亡,游戏胜利!!!"
info3 = str(enemy.name)+"阵亡,游戏胜利!!!"
info=info1+info2+info3
print(info)
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
while True:
xuanze=int(input("请按下“1”:"))
if xuanze==1:
yase.combat(houyi)
if houyi.hp<=0:
exit()
\ 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