Commit 82bf6a86 by BellCodeEditor

save project

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