Commit e905d4ac by BellCodeEditor

save project

parent 359d530d
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,enemy): # 攻击
a=enemy.hp-self.attack
infol1=str(enemy.name)+"发起了攻击"
infol2="造成了"+str(self.attack)+"点伤害"
if enemy.hp>0:
infol3=str(enemy.name)+"还剩"+str(enemy.hp-self.attack)+"点血量"
else:
infol3=str(enemy.name)+"阵亡"+"你赢了"
info1=infol1+infol2+infol3
print(info1)
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