Commit 2c922cfb by BellCodeEditor

auto save

parent d59e5b7c
Showing with 5 additions and 23 deletions
import random
class Hero(object):
def __init__(self, name):
self.name = name
......@@ -39,25 +38,7 @@ class Player(Hero):
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
print('-'*30)
print(' 战斗开始')
while True:
choice=input('请选择英雄技能(1攻击2治疗)')
print('-'*30)
if choice=='q':
break
elif choice=='1':
houyi.combat(yase)
elif choice=='2':
houyi.cure()
else:
print('无效字符,请重新输入')
continue
num = random.randint(1,3)
b=num
if b=='1':
yase.cure()
print(enemy.name+"对"+self.name+"发起进攻,造成"+str(enemy.attack)+"点伤害,")
elif b=='2':
yase.combat(houyi)
print(enemy.name+"使用了治疗,血量增加:", 60,",目前的血量为:",enemy.hp)
houyi.combat(yase)
yase.combat(houyi)
houyi.cure()
yase.cure()
\ 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