Commit 41ee3882 by BellCodeEditor

save project

parent 9a581ef4
Showing with 11 additions and 2 deletions
# 英雄角色类 # 英雄角色类
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
...@@ -6,8 +7,16 @@ class Hero(object): ...@@ -6,8 +7,16 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(): # 攻击 def combat(self,enemy):
??? houyi.hp-=yase.attack
info1=yase.name+"对"+houyi.name+"发动攻击"
info2="造成了"+str(yase.attack)+"点伤害"
if houyi.hp>0:
info3=houyi.name+"还剩下"+str(houyi.hp)+"点血量"
else:
info3=houyi.name+"已阵亡"
info=info1+info2+info3
print(info)
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= 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