Commit 0b8081de by BellCodeEditor

auto save

parent a4a5d6d3
Showing with 13 additions and 3 deletions
......@@ -4,8 +4,8 @@ class Hero(object):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 40
self.max_hp =self.hp
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
......@@ -20,6 +20,14 @@ class Hero(object):
print(info)
print('你干嘛啊~~')
exit()
def cure(self):
self.hp = self.hp+60
if self.hp>self.max_hp:
self.hp=self.max_hp
print("恢复了60血量,当前的血量为:",self.hp)
class Player(Hero):
def __init__(self,hero_type,name):
......@@ -35,6 +43,7 @@ class Player(Hero):
houyi = Player("射手", "后羿")
houyi.cure()
yase = Hero("垭瑟")
while True:
print('-'*30)
......@@ -55,5 +64,5 @@ while True:
else:
yase.combat(houyi)
\ 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