From 2f34cfa66e6536bbe309bfb90c223364567c58cc Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 13 Nov 2021 11:17:51 +0800 Subject: [PATCH] auto save --- diy1.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/diy1.py b/diy1.py index 7309772..93ffb53 100644 --- a/diy1.py +++ b/diy1.py @@ -3,7 +3,7 @@ class Hero(object): def __init__(self, name): self.name = name self.level = 1 - self.hp = 250 + self.hp = 1000 self.attack = 40 self.max_hp = self.hp @@ -30,20 +30,20 @@ class Hero(object): class Player(Hero): def __init__(self,hero_type,name): super().__init__(name) - self.hp = 200 - self.attack = 55 + self.hp = 1000 + self.attack = 50 self.max_hp = self.hp self.hero_type = hero_type print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) def cure(self): # 治疗 - blood=random.randint(30,50) + blood=random.randint(40,70) self.hp+=blood if self.hp>self.max_hp: self.hp=self.max_hp print(self.name+"使用了治疗,血量增加:", blood,",目前的血量为:",self.hp) -houyi = Player("射手", "后羿") +houyi = Player("战神", "吕布") yase = Hero("垭瑟") print(30*'-') print(' 战斗开始') @@ -67,4 +67,6 @@ while True: yase.cure() else: yase.combat(houyi) + + \ No newline at end of file -- libgit2 0.25.0