Commit c7f9e4c9 by BellCodeEditor

save project

parent fd3839bf
Showing with 3 additions and 0 deletions
...@@ -9,6 +9,8 @@ class Hero(object): ...@@ -9,6 +9,8 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
cure_hp=random.randint(40,60)
self.hp=self.hp+cure_hp
self.hp = self.hp + 60 self.hp = self.hp + 60
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp = self.max_hp self.hp = self.max_hp
...@@ -31,6 +33,7 @@ class Hero(object): ...@@ -31,6 +33,7 @@ class Hero(object):
class Player(Hero): class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 80 self.attack = 80
self.max_hp = self.hp self.max_hp = self.hp
......
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