Commit b0cedda6 by BellCodeEditor

save project

parent b8618a37
Showing with 6 additions and 3 deletions
......@@ -6,9 +6,12 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
self.hp -=yase.attack
print(houyi.name,'被'yase.name,'减少',yase.attack,'血','还剩'houyi.hp)
def combat(self,d): # 攻击
d.hp -= self.attack
if d.hp>0:
print(d.name,'被',self.name,'减少',self.attack,'血','还剩',d.hp)
else:
print(d.name,'死亡,游戏结束了')
yase = Hero("垭瑟")
houyi= Hero("后羿")
......
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