Commit 4daea37c by BellCodeEditor

save project

parent 746a8d7b
Showing with 5 additions and 0 deletions
......@@ -5,6 +5,7 @@ class Hero:
self.hp = 350
self.attack = 40
self.name = name
self.max_hp = self.hp
def combat(self,enemy): # 攻击
enemy.hp -= self.attack
info1 = self.name + '对' + enemy.name + '发起攻击,'
......@@ -14,6 +15,10 @@ class Hero:
else:
info3= enemy.name + '还剩' + str(enemy.hp) + '生命'
print(info1 + info2 + 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