Commit 2ccdb221 by BellCodeEditor

save project

parent 9a581ef4
Showing with 13 additions and 2 deletions
......@@ -6,8 +6,19 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,enmey): # 攻击
enmey.hp=enmey.hp-self.attack
ifo1=self.name+"对"+enmey.name+"造成攻击\n"
if enmey.hp > 0:
i=enmey.name+"还剩下"+str(enmey.hp)
ifo2=ifo1+i
print(ifo2)
else:
i=enmey.name+"已故"
ifo2=ifo1+i
print(ifo2)
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