Commit 8d39caf7 by BellCodeEditor

save project

parent e42e9158
Showing with 18 additions and 17 deletions
...@@ -35,8 +35,11 @@ class Player(Hero): ...@@ -35,8 +35,11 @@ class Player(Hero):
self.attack = 50 self.attack = 50
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("玩家角色后羿创建成功,英雄类型为:射手")
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:1,200,50")
print('-'*30)
print("电脑角色垭瑟创建成功,英雄类型为:战士")
print("当前等级、血量、攻击力分别为:1,250,40")
print('-'*30) print('-'*30)
print(' 战斗开始') print(' 战斗开始')
def cure(self): def cure(self):
...@@ -51,21 +54,19 @@ yase = Hero("垭瑟") ...@@ -51,21 +54,19 @@ yase = Hero("垭瑟")
while True: while True:
print('-'*30) print('-'*30)
a=input("请选择技能:1攻击/2治疗") a=input("请选择技能:1攻击/2治疗")
if int(a)==1: try:
houyi.combat(yase) if int(a)==1:
elif int(a)==2: houyi.combat(yase)
houyi.cure() elif int(a)==2:
elif a=="q": houyi.cure()
print('游戏结束') elif a=="q":
break print('游戏结束')
else: break
print('重输!') except:
continue print('重输!')
continue
b=random.randint(1,3) b=random.randint(1,3)
if b==3: if b==3:
yase.cure() yase.cure()
else: else:
yase.combat(houyi) yase.combat(houyi)
\ No newline at end of file
\ 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