Commit aa33c490 by BellCodeEditor

save project

parent 02959fd9
Showing with 8 additions and 9 deletions
......@@ -8,9 +8,9 @@ class Hero(object):
self.max_hp = self.hp
def cure(self):
self.hp+=55
if self.hp>self.max_hp:
self.hp=self.max_hp
self.hp = self.hp + 60
if self.hp > self.max_hp:
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:",60,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
......@@ -25,7 +25,6 @@ class Hero(object):
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
print('你干嘛啊~~')
exit()
class Player(Hero):
......@@ -39,11 +38,11 @@ class Player(Hero):
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
def cure(self):
c=random.randint(35,50)
self.hp+=c
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
blood = random.randint(35,50)
self.hp += self.hp + blood
if self.hp > self.max_hp:
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:",blood,",目前的血量为:",self.hp)
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
......
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