Commit e99f9d09 by BellCodeEditor

save project

parent 829f0915
Showing with 46 additions and 43 deletions
# class Hero(object): class Hero(object):
# def __init__(self, name): def __init__(self, name):
# self.level = 1 self.level = 1
# self.hp = 3500 self.hp = 3500
# self.attack = 388 self.attack = 388
# self.name = name self.name = name
# def combat(self,enemy): # 攻击 def combat(self,enemy): # 攻击
# enemy.hp -= self.attack enemy.hp -= self.attack
# info1 = self.name + '对' + enemy.name + '发起攻击,' info1 = self.name + '对' + enemy.name + '发起攻击,'
# info2 = '造成' + str(self.attack) + '真实伤害,' info2 = '造成' + str(self.attack) + '真实伤害,'
# if enemy.hp < 0: if enemy.hp < 0:
# info3 = enemy.name + '阵亡' info3 = enemy.name + '阵亡'
# else: else:
# info3 = enemy.name + '还剩下' + str(enemy.hp) + '点生命值' info3 = enemy.name + '还剩下' + str(enemy.hp) + '点生命值'
# print(info1 + info2 + info3) print(info1 + info2 + info3)
class Player(Hero):
# yase = Hero("垭瑟") def __init__(self,name):
# houyi= Hero("后羿") super().__init__(name)
# yase.combat(houyi) self.hp = 200
# class Player(Hero): self.attack = 50
# def __init__(self,name): self.hero_type = hero_type
# super().__init__(name) print(self.name,self.hero_type)
# self.hp = 200 print(self.level,self.hp,self.attack)
# self.attack = 50 # Player = player("后羿")
# player = player("后羿")
# print("hp",player.hp) # print("hp",player.hp)
# print("attack",player.attack) # print("attack",player.attack)
class Dog: yase = Hero("垭瑟")
def __init__(self): houyi= Hero("后羿")
self.f = 1 yase.combat(houyi)
self.e = 3500
self.h = 388
self.eN = 2
self.s = "white"
def run(self)
print()
class hy(Dog):
def __init__(self):
super().__init__()
self.s = "black"
coco = hy()
print(coco.skin)
# class Dog:
# def __init__(self):
# self.f = 1
# self.e = 3500
# self.h = 388
# self.eN = 2
# self.s = "white"
# def run(self):
# print()
# class hy(Dog):
# def __init__(self):
# super().__init__()
# self.s = "black"
# coco = hy()
# print(coco.skin)
...@@ -49,5 +51,6 @@ print(coco.skin) ...@@ -49,5 +51,6 @@ print(coco.skin)
super().__init__()
self.skin = "black" # super().__init__()
# self.skin = "black"
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