Commit 2a2be3bd by BellCodeEditor

save project

parent f8aa1b80
Showing with 3 additions and 18 deletions
...@@ -35,11 +35,11 @@ class Player(Hero): ...@@ -35,11 +35,11 @@ class Player(Hero):
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
import random
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi.combat(yase) houyi.combat(yase)
yase.combat(houyi)
houyi.cure() houyi.cure()
yase.cure() yase.cure()
print('-' * 30) print('-' * 30)
...@@ -47,18 +47,3 @@ print("全军出击") ...@@ -47,18 +47,3 @@ print("全军出击")
print('-' * 30) print('-' * 30)
while True: while True:
choice=input('请选择技能(1攻击/2治疗)') choice=input('请选择技能(1攻击/2治疗)')
\ No newline at end of file
if choice=="q":
print("游戏结束")
break
elif choice=="1":
houyi.combat(yase)
elif choice=="2":
houyi.cure()
else:
print("重新选择技能")
continue
num=random.randint(1,3)
if num==2:
yase.cure()
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