Commit 979bc6d1 by BellCodeEditor

auto save

parent 520453ff
Showing with 12 additions and 6 deletions
......@@ -5,7 +5,10 @@ class Hero: # 英雄类
self.hp = 250
self.attack = 40
self.max_hp = self.hp
print("玩家的名称:",self.name)
print("玩家的等级",self.level)
print("玩家的血量值为:",self.hp)
print("玩家的攻击力为:",self.attack)
def combat(self, enemy): # 攻击功能
info1 = self.name+"对"+enemy.name+"发起进攻,"
......@@ -27,10 +30,13 @@ class Player(Hero): # 玩家英雄
super().__init__(name)
self.attack = 50
self.hp = 200
print("玩家的名称:",self.name)
print("玩家的等级",self.level)
print("玩家的血量值为:",self.hp)
print("玩家的攻击力为:",self.attack)
player = Player("后羿")
print("玩家的名称:",player.name)
print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack)
player = Hero("后羿")
yase = Player("亚瑟")
player.combat(yase)
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