Commit 8a0689fd by BellCodeEditor

save project

parent d79e649c
Showing with 8 additions and 7 deletions
...@@ -5,7 +5,7 @@ class Hero: ...@@ -5,7 +5,7 @@ class Hero:
self.level=1 self.level=1
self.Name=name self.Name=name
self.howCure=howCure self.howCure=howCure
self.MaxHp=hp self.MaxHP=hp
def UpGrade(SB): def UpGrade(SB):
SB.level+=1 SB.level+=1
...@@ -25,14 +25,14 @@ class Hero: ...@@ -25,14 +25,14 @@ class Hero:
print(info1+info2+info3) print(info1+info2+info3)
def cure(self): def cure(self):
self.HP += 60 self.HP += self.howCure
if self.HP>self.MaxHP: if self.HP>self.MaxHP:
self.HP=MaxHP self.HP=MaxHP
print(self.Name,"使用了治疗术,当前血量",self.HP)
class Player(Hero): class Player(Hero):
def __init__(self,hp,attack,name,type,howCure): def __init__(self,hp,attack,name,type,howCure):
super().__init__(hp,attack,name) super().__init__(hp,attack,name,howCure)
self.type = type self.type = type
self.howCure = howCure
print("玩家创建成功 姓名:",self.Name) print("玩家创建成功 姓名:",self.Name)
print("玩家创建成功 血量:",self.HP) print("玩家创建成功 血量:",self.HP)
print("玩家创建成功 攻击力:",self.Attack) print("玩家创建成功 攻击力:",self.Attack)
...@@ -42,6 +42,7 @@ class Player(Hero): ...@@ -42,6 +42,7 @@ class Player(Hero):
player = Player(5000,250,"亚瑟","战士",300) player = Player(5000,250,"亚瑟","战士",300)
computer = Hero(3000,400,"后羿","射手",200) computer = Hero(3000,400,"后羿",200)
player.ComBot(computer) player.ComBot(computer)
\ No newline at end of file computer.cure()
\ No newline at end of file
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