Commit 3676c523 by BellCodeEditor

save project

parent cf284f16
Showing with 9 additions and 3 deletions
import random
class Hero: # 英雄类
def __init__(self, name): # 实例属性
self.name = name
......@@ -23,7 +25,10 @@ class Hero: # 英雄类
def ziliao(self, ememy):
ememy.hp = ememy.hp + 10
print(ememy,'回血成功!血量加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):
......@@ -40,5 +45,6 @@ while True:
user_input = str(input('请选择英雄技能(1:攻击,2:回血)'))
if user_input == "1":
player1.combat(player2)
if user_input == "2":
pass
\ No newline at end of file
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