From 0a71e5a308b47622c6a5a95d938e033580b390fa Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Fri, 2 Jul 2021 16:59:36 +0800 Subject: [PATCH] save project --- diy1.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/diy1.py b/diy1.py index ddeb58e..38f0878 100644 --- a/diy1.py +++ b/diy1.py @@ -9,10 +9,11 @@ class Hero(object): self.max_hp = self.hp def cure(self): # 治疗 - self.hp = self.hp+60 + 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) + print(self.name+"使用了治疗,血量增加:",blood,",目前的血量为:",self.hp) def combat(self, enemy): # 普通攻击 info1 = self.name+"对"+enemy.name+"发起进攻," -- libgit2 0.25.0