Commit bbd2ab37 by BellCodeEditor

auto save

parent 82bf6a86
Showing with 12 additions and 7 deletions
......@@ -3,12 +3,12 @@ class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.hp = 350
self.attack = 45
self.max_hp = self.hp
def cure(self): # 治疗
self.hp+=55
self.hp+=random.randint(40,55)
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
......@@ -35,8 +35,8 @@ class Hero(object):
class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
self.hp = 210
self.attack = 60
self.hp = 310
self.attack = 50
self.max_hp = self.hp
self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
......@@ -52,6 +52,8 @@ houyi = Player("射手", "后羿")#yase = Player("战士","垭瑟")
yase = Hero("垭瑟")#houyi = Hero("射手", "后羿")
print(" !!战斗开始!!")
print("-"*50)
c = 290
d = 250
while True:
a = input("你要使用什么技能?(1攻击/2治疗/q退出)")
if a=='1':
......@@ -65,8 +67,9 @@ while True:
print("请重新输入")
continue
#b = random.randint(1,2)
if yase.hp==150:
if yase.hp<=c:
houyi.shengji()
c -= 60
b = input("你要使用什么技能?(1攻击/2治疗/q退出)")
if b=='1':
yase.combat(houyi)
......@@ -78,7 +81,9 @@ while True:
else:
print("请重新输入")
continue
if houyi.hp<=d:
yase.shengji()
d -= 50
# houyi.combat(yase)
# yase.combat(houyi)
# houyi.cure()
......
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