Commit a9434fd3 by BellCodeEditor

save project

parent 1e1e48cb
Showing with 6 additions and 1 deletions
......@@ -5,6 +5,7 @@ class Hero(object):
self.hp = 350
self.attack = 90
self.name = name
self.max_hp=self.hp
def combat(self,enemy): # 攻击
enemy.hp -= self.attack
......@@ -15,7 +16,11 @@ class Hero(object):
print(info3)
else:
info3=enemy.name+'阵亡,游戏结束'
print(info3)
print(info3)
def cure(self):
self.hp=60
if self.hp>self.max_hp:
self.hp=self.max_hp
class Player(Hero):
def __init__(self,name,hero_type):
super().__init__(name,hero_type)
......
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