Commit 8a90a6d3 by BellCodeEditor

save project

parent 9a581ef4
Showing with 10 additions and 2 deletions
......@@ -6,8 +6,16 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,hou): # 攻击
hou.hp-=self.attack
if hou.hp>0:
a=self.name+"对"+hou.name+"造成了"+str(self.attack)+"点攻击\n"
b=hou.name+"还剩下"+str(hou.hp)+"点血量\n"
print(a+b)
else :
a=self.name+"对"+hou.name+"造成了"+str(self.attack)+"点攻击\n"
b=hou.name+"死了"
print(a+b)
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