From 7888e2aa91125e56548cc88af18d8b245c808c81 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Wed, 23 Feb 2022 18:19:45 +0800 Subject: [PATCH] save project --- diy1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/diy1.py b/diy1.py index e5f666c..127ce5d 100644 --- a/diy1.py +++ b/diy1.py @@ -42,6 +42,12 @@ class Player(Hero): print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) + def cure(self): # 治疗 + blood=random.randint(30,50) + self.hp =self.hp +blood + if self.hp>self.max_hp: + self.hp=self.max_hp + print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) houyi = Player("射手", "后羿") yase = Hero("垭瑟") -- libgit2 0.25.0