Commit 7ff9be45 by BellCodeEditor

save project

parent 3676c523
Showing with 8 additions and 6 deletions
......@@ -27,9 +27,6 @@ class Hero: # 英雄类
ememy.hp = ememy.hp + 10
print(str(ememy.name),'回血成功!血量加10点,目前血量:',str(ememy.hp))
def pl_hp(self, ememy):
return int(ememy.hp)
class Player(Hero): # 玩家英雄
def __init__(self,name,hp,attack):
super().__init__(name)
......@@ -38,13 +35,17 @@ class Player(Hero): # 玩家英雄
print(str(self.name)+'创建成功!血量:',str(self.hp),',攻击力:',str(self.attack))
player1 = Player("后羿",220,80)
player2 = Player("亚瑟",250,50)
player1 = Player("后羿",220,15)
player2 = Player("亚瑟",250,10)
while True:
print('--------------------------------')
user_input = str(input('请选择英雄技能(1:攻击,2:回血)'))
if user_input == "1":
player1.combat(player2)
pl_hp_a = player2.hp
if pl_hp_a < 20:
player1.ziliao(player2)
else:
player2.combat(player1)
if user_input == "2":
player2.ziliao(player1)
\ 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