Commit 8d39caf7 by BellCodeEditor

save project

parent e42e9158
Showing with 8 additions and 7 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,6 +54,7 @@ yase = Hero("垭瑟") ...@@ -51,6 +54,7 @@ yase = Hero("垭瑟")
while True: while True:
print('-'*30) print('-'*30)
a=input("请选择技能:1攻击/2治疗") a=input("请选择技能:1攻击/2治疗")
try:
if int(a)==1: if int(a)==1:
houyi.combat(yase) houyi.combat(yase)
elif int(a)==2: elif int(a)==2:
...@@ -58,7 +62,7 @@ while True: ...@@ -58,7 +62,7 @@ while True:
elif a=="q": elif a=="q":
print('游戏结束') print('游戏结束')
break break
else: except:
print('重输!') print('重输!')
continue continue
b=random.randint(1,3) b=random.randint(1,3)
...@@ -66,6 +70,3 @@ while True: ...@@ -66,6 +70,3 @@ while True:
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