Commit 71ad00ac by BellCodeEditor

auto save

parent 65dcbe68
Showing with 8 additions and 2 deletions
......@@ -6,10 +6,16 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
def combat(self,a): # 攻击
a.hp = a.hp-self.attack
if a.hp>0:
info3 = a.name+'还剩'+str(a.hp)+'滴血'
else:
info3 = a.name+'已阵亡'
info1 = self.name+'攻击'+a.name+','
info2 =
info2 = '对'+a.name+'造成'+str(self.attack)+'点伤害'
info = info1+info2+info3
print(info)
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