Commit edbc7fdf by BellCodeEditor

save project

parent d6ffd7af
Showing with 10 additions and 3 deletions
...@@ -22,12 +22,19 @@ class Hero: # 英雄类 ...@@ -22,12 +22,19 @@ class Hero: # 英雄类
exit() exit()
class Player(): # 玩家英雄 def cure(self):
def __init__(self,name): self.hp = self.hp + 60
super(),if __init__(name) if self.hp < self.max_hp:
self.hp = self.max_hp
print(self.name+"使用了治疗术,血量增加:",60,",目前的血量为:",self.hp)
class Player(Hero): # 玩家英雄
def __init__(self,hero_type,name):
super(). __init__(name)
self.hp = 200 self.hp = 200
self.hp.attack = 50 self.hp.attack = 50
player = Player("后羿") player = Player("后羿")
print("玩家的血量值为:",player.hp) print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack) print("玩家的攻击力为:",player.attack)
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