Commit 91e3c160 by BellCodeEditor

save project

parent 83f0863d
Showing with 10 additions and 4 deletions
...@@ -5,6 +5,7 @@ class Hero: ...@@ -5,6 +5,7 @@ class Hero:
self.hp = 3500 self.hp = 3500
self.attack = 388 self.attack = 388
self.name = name self.name = name
self.max_hp=self.hp
def combat(self,enemy): # 攻击 def combat(self,enemy): # 攻击
info1 = self.name + '对' + enemy.name + '发起攻击,' info1 = self.name + '对' + enemy.name + '发起攻击,'
...@@ -21,6 +22,12 @@ class Hero: ...@@ -21,6 +22,12 @@ class Hero:
exit() exit()
yase = Hero("垭瑟") class Player(Hero):
houyi= Hero("后羿") def__init__(self,name):
yase.combat(houyi) super().__init__(name)
\ No newline at end of file self.hp=200
self.attack=50
Player=Player("后羿")
print("玩家的血量值为:",player.hp)
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