Commit 5d3cd39b by BellCodeEditor

auto save

parent 729f8d09
Showing with 13 additions and 5 deletions
......@@ -2,8 +2,8 @@
class Hero(object):
def __init__(self, name):
self.level = 9999999999999999999999
self.hp = 999998888777665
self.attack = 999888777666555
self.hp = 99999888877776
self.attack = 9999888777666
self.name = name
def combat(self,enemy): # 攻击
......@@ -16,7 +16,14 @@ class Hero(object):
info3 = enemy.name + '还剩下' + str(enemy.hp) + '点生命值'
print(info1 + info2 + info3)
lubu = Hero("吕布")
houyi= Hero("后羿")
class player(Hero):
def __init__(self,name,Hero_type):
super(player,self).__init__(name)
self.hp=999998888777665
self.attack=999888777666
self.Hero_type=Hero_type
print("角色"+self.name+"创建成功,英雄类型为:",self.Hero_type)
print("当前等级,血量,攻击力分别为:",self.level,self.hp,self.attack)
houyi = Hero("后羿")
lubu= player("吕布","至尊终极战士")
lubu.combat(houyi)
\ 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