Commit 4994250d by BellCodeEditor

save project

parent a6174e16
Showing with 5 additions and 2 deletions
...@@ -9,8 +9,10 @@ class Hero(object): ...@@ -9,8 +9,10 @@ class Hero(object):
def combat(self,duifang): # 攻击 def combat(self,duifang): # 攻击
duifang.hp-=self.attack duifang.hp-=self.attack
if duifang.hp>0: if duifang.hp>0:
print(self.name+"对"+duifang.name+"发起攻击") print(self.name+"对"+duifang.name+"发起攻击,"+duifang.name+"减少"+self.attack+"血量,"+duifang.name+"还剩"+duifang.hp+"血量")
else:
print(duifang.name+"已阵亡,游戏结束")
print("You Win")
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
yase.combat(houyi) yase.combat(houyi)
\ 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