Commit 800e5c46 by BellCodeEditor

save project

parent 509e7a89
Showing with 4 additions and 4 deletions
...@@ -7,10 +7,10 @@ class Hero(object): ...@@ -7,10 +7,10 @@ class Hero(object):
self.name = name self.name = name
def combat(self,beigongji): # 攻击 def combat(self,beigongji): # 攻击
beigongji.hp = gongji.hp - self.attack beigongji.hp = beigongji.hp - self.attack
info1 = self.name+'对'+beigongji+'发起攻击' info1 = self.name+"对"+beigongji.name+'发起攻击'
info2 ='造成'+self.attack+'点伤害' info2 ='造成'+str(self.attack)+'点伤害'
info3 =self.name+'还剩下'+self.hp-self.attack+'血量' info3 =beigongji.name+'还剩下'+str(beigongji.hp)+'血量'
info =info1+info2+info3 info =info1+info2+info3
print(info) print(info)
yase = Hero("垭瑟") yase = 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