Commit 063822bd by BellCodeEditor

save project

parent 1016414e
Showing with 4 additions and 4 deletions
...@@ -6,15 +6,15 @@ class Hero(object): ...@@ -6,15 +6,15 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(self): # 攻击 def combat(self,encomy): # 攻击
encomy.hp-=self.attack encomy.hp-=self.attack
info1=encomy.name+'对'+self.name+'发起了攻击' info1=encomy.name+'对'+self.name+'发起了攻击'
info2='造成了'+str(encomy.hp)+'伤害' info2='造成了'+str(encomy.attack)+'伤害'
if encomy.he>0: if encomy.hp>0:
info3='还剩'+str(encomy.hp)+'血量' info3='还剩'+str(encomy.hp)+'血量'
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
elif: else:
info3=encomy.name+'很抱歉,你死了' info3=encomy.name+'很抱歉,你死了'
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
......
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