Commit 7e9f7090 by BellCodeEditor

save project

parent 40f48897
Showing with 8 additions and 6 deletions
...@@ -6,11 +6,13 @@ class Hero(object): ...@@ -6,11 +6,13 @@ class Hero(object):
self.name = name self.name = name
def combat(self,enemy): # 攻击 def combat(self,enemy): # 攻击
info1=self.name+"对"+enemy.name+"发动攻" info1=self.name+"对"+enemy.name+"发动攻鸡♂"
info2="造成"+str(self.attack) info2="造成"+str(self.attack)
if enemy.hp>0: if enemy.hp>0:
info3=enemy.name+"还剩下"+str(enemy.hp)+"血量" info3=enemy.name+"还剩下"+str(enemy.hp)+"血量"
info=info1+info2+info3 info4=enemy.name+"说:啊♂(这是受到伤害的痛苦的悲鸣)"
info=info1+info2+info3+info4
print(info) print(info)
else: else:
info3=enemy.name+"嗝屁了,这个弟中之弟" info3=enemy.name+"嗝屁了,这个弟中之弟"
...@@ -26,8 +28,8 @@ class Player(Hero): ...@@ -26,8 +28,8 @@ class Player(Hero):
player=Player("VAN") player=Player("VAN")
print("van♂家的血量为",player.hp) print("van♂家的血量为",player.hp)
print("van♂家的攻力为",player.attack) print("van♂家的攻力为",player.attack)
muji=Hero("木吉") muji=Hero("木吉")
print("van♂家的血量为",muji.hp) print("木吉的血量为",muji.hp)
print("van♂家的攻击力为",muji.attack) print("木吉的攻鸡力为",muji.attack)
\ No newline at end of file \ No newline at end of file
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