Commit 4312b566 by BellCodeEditor

auto save

parent beb166ed
Showing with 3 additions and 3 deletions
......@@ -5,11 +5,11 @@ class Hero(object):
self.level = 1
self.hp = 250
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+=55 #每次治疗时增加的血量
if self.hp>self.max_hp: #跟最大血量值属性进行比较,如果血量超过最大血量值就设为最大血量值
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",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