Commit da9f14dd by BellCodeEditor

save project

parent 9a581ef4
Showing with 15 additions and 3 deletions
......@@ -3,11 +3,23 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 0
self.name = name
def combat(): # 攻击
???
def combat(self,em): # 攻击
em.hp-=self.attack
#if self.attack>0 :
info1= self.name+"使用了攻击技能,"
info2="使"+em.name+"受到了"+str(self.attack)+"伤害。"
info3=em.name+"还剩"+str(em.hp)+"的血量"
info0=em.name+"已阵亡,游戏结束。"
if em.hp>0:
info=info1+info2+info3
print(info)
else:
info=info1+info2+info0
print(info)
exit()
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