Commit de83f2af by BellCodeEditor

save project

parent 3eb7b6a6
Showing with 3 additions and 3 deletions
...@@ -6,12 +6,12 @@ class Hero(object): ...@@ -6,12 +6,12 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(self): # 攻击 def combat(eyself): # 攻击
info1=self.name+'对'+self.name+'发起进攻,' info1=self.name+'对'+self.name+'发起进攻,'
info2='造成'+str(self.attack)+'点伤害' info2='造成'+str(self.attack)+'点伤害'
self.hp=self.hp-self.attack eyname.hp=self.hp-self.attack
if self.hp>0: if self.hp>0:
info3=self.name+str(self.hp)+'血量' info3=self.name+str(eyname.hp)+'血量'
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
else: else:
......
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