Commit 447c23f1 by BellCodeEditor

save project

parent 9a581ef4
Showing with 11 additions and 4 deletions
...@@ -7,8 +7,15 @@ class Hero(object): ...@@ -7,8 +7,15 @@ class Hero(object):
self.name = name self.name = name
def combat(): # 攻击 def combat(): # 攻击
??? oo1=self.name+"对"+self.enemy+"发起进攻"
oo2="造成"+str(self.attack)+"点伤害"
oo3=self.enemy+"还剩下"+str(self.hp)+"血量"
oo=(oo1+oo2+oo3)
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
yase.combat(houyi) yase.combat("后羿")
\ No newline at end of file
if self.hp>0:
print(oo)
else:
print(oo1+oo2+self.enemy+"阵亡,"+"游戏结束")
\ 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