Commit 210db1f1 by BellCodeEditor

save project

parent b5531e60
Showing with 9 additions and 1 deletions
...@@ -29,12 +29,20 @@ class Hero(): # 英雄类 ...@@ -29,12 +29,20 @@ class Hero(): # 英雄类
class Player(Hero): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self,name,Hero_type): def __init__(self,name,Hero_type):
super(player,self)__init__(name) super(player,Hero)__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
self.Hero_type = Hero_type self.Hero_type = Hero_type
print("角色"+self.name+"创建成功,英雄类型为:",self.Hero_type) print("角色"+self.name+"创建成功,英雄类型为:",self.Hero_type)
def cure():
print("当前等级,血量,攻击力分别为:",self.level,self.attack) print("当前等级,血量,攻击力分别为:",self.level,self.attack)
def cure(self):
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)
......
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