Commit cdd47feb by BellCodeEditor

save project

parent 958be2f9
Showing with 3 additions and 3 deletions
...@@ -17,7 +17,7 @@ class Hero(object): ...@@ -17,7 +17,7 @@ class Hero(object):
b1=self.name+'对'+a.name+'发起进攻' b1=self.name+'对'+a.name+'发起进攻'
b2='造成'+str(self.attack)+'点伤害' b2='造成'+str(self.attack)+'点伤害'
if a.hp>0: if a.hp>0:
b3=a.name+'还剩'a.hp+'的血' b3=a.name+'还剩'+a.hp+'的血'
b=b1+b2+b3 b=b1+b2+b3
print(b) print(b)
else: else:
...@@ -25,7 +25,7 @@ class Hero(object): ...@@ -25,7 +25,7 @@ class Hero(object):
b=b1+b2+b3 b=b1+b2+b3
print(b) print(b)
class Player(Hero) class Player(Hero):
def __init__(self,name,type): def __init__(self,name,type):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
...@@ -41,4 +41,4 @@ class Player(Hero): ...@@ -41,4 +41,4 @@ class Player(Hero):
houyi=Player('后裔','射手') houyi=Player('后裔','射手')
yase=Hero('亚瑟') yase=Hero('亚瑟')
while True: while True:
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