Commit 173dee13 by BellCodeEditor

save project

parent 6b3d5c1e
Showing with 9 additions and 3 deletions
......@@ -9,11 +9,14 @@ class Hero(object):
self.max_hp = self.hp
def cure(self): # 治疗
self.hp+=random.randint(35,45)
blood = random.randint(35,45)
self.hp = self.hp + blood
if self.hp > self.max_hp:
self.hp = self.max_hp
print(self.name +"使用了治疗,血量增加:", 60,","+self.name+"的血量为:",self.hp)
print(self.name +"使用了治疗,血量增加:", blood,","+self.name+"的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
......@@ -25,8 +28,11 @@ class Hero(object):
print(info)
else:
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
info = info1+info2
print(info)
print(30*'-')
print(info3)
print(30*'-')
exit()
class Player(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