Commit d79e649c by BellCodeEditor

save project

parent ef8c9b34
Showing with 14 additions and 4 deletions
class Hero:
def __init__(self,hp,attack,name):
def __init__(self,hp,attack,name,howCure):
self.HP=hp
self.Attack=attack
self.level=1
self.Name=name
self.howCure=howCure
self.MaxHp=hp
def UpGrade(SB):
SB.level+=1
......@@ -22,17 +24,24 @@ class Hero:
exit()
print(info1+info2+info3)
def cure(self):
self.HP += 60
if self.HP>self.MaxHP:
self.HP=MaxHP
class Player(Hero):
def __init__(self,hp,attack,name,type):
def __init__(self,hp,attack,name,type,howCure):
super().__init__(hp,attack,name)
self.type = type
self.howCure = howCure
print("玩家创建成功 姓名:",self.Name)
print("玩家创建成功 血量:",self.HP)
print("玩家创建成功 攻击力:",self.Attack)
print("玩家创建成功 职业:",self.type)
print("玩家创建成功 治疗量:",self.howCure)
player = Player(5000,250,"亚瑟","战士")
computer = Hero(3000,400,"后羿","射手")
player = Player(5000,250,"亚瑟","战士",300)
computer = Hero(3000,400,"后羿","射手",200)
player.ComBot(computer)
\ 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