Commit 6249c82a by BellCodeEditor

save project

parent bceaacbd
Showing with 17 additions and 7 deletions
class Hero: class Hero(object):
def __init__(self,name): def __init__(self,name):
self.name = name self.name = name
self.level = 1 self.level = 1
...@@ -33,10 +33,20 @@ class Hero: ...@@ -33,10 +33,20 @@ class Hero:
class Player(Hero): class Player(Hero):
def __init__(self,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
player = Player("后羿") self.max_hp = self.hp
print("玩家的血量值为为:",player.hp) self.hero_type = hero_type
print("玩家的攻击值为为:",player.attack) print("角色" + self.name + "创建成功,英雄类型为:",self.hero_type)
\ No newline at end of file print("当前等级,血量,攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player("射手","后羿")
yase = Hero("亚瑟")
print(30*'-')
print(' 战斗开始')
while True:
print("-"*30 )
choice = input("请选择释放英雄技能(1攻击/2治疗):")
\ 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