Commit 193dab9f by BellCodeEditor

auto save

parent 5d05d386
Showing with 8 additions and 8 deletions
class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.max_hp = self.hp
class Hero(object): #创建英雄类
def __init__(self, name): #定义函数
self.name = name #名字
self.level = 1 #等级
self.hp = 250 #血量
self.attack = 40 #攻击力
self.max_hp = self.hp #最大血量3
def cure(self): # 治疗
self.hp=self.hp+60
......@@ -34,7 +34,7 @@ class Player(Hero):
self.max_hp = self.hp
self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
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