Commit ba543e1a by BellCodeEditor

save project

parent e0e7cd51
Showing with 7 additions and 1 deletions
...@@ -7,6 +7,11 @@ class Hero(object): ...@@ -7,6 +7,11 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
def cure(self):
self.hp +=55
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加了:",55,"目前血量为:",self.hp)
def combat(self, enemy): # 普通攻击 def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻," info1 = self.name+"对"+enemy.name+"发起进攻,"
...@@ -37,5 +42,5 @@ class Player(Hero): ...@@ -37,5 +42,5 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
yase.cure()
\ 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