Commit 00bc5707 by BellCodeEditor

save project

parent 46a2eb96
Showing with 21 additions and 5 deletions
from random import *
class Hero(object):
def __init__(self, name):
self.name = name
......@@ -38,7 +39,22 @@ class Player(Hero):
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
houyi.combat(yase)
yase.combat(houyi)
houyi.cure()
yase.cure()
\ No newline at end of file
print("----------------------------\n 战斗开始\n")
while True:
print("----------------------------\n")
a = input("请选择释放英雄技能(1攻击/2治疗/q退出):")
if a == '1':
houyi.combat(yase)
elif a == '2':
houyi.cure()
elif a == 'q':
print("游戏已退出。")
break
else:
print("输入无效字符,请重新输入1或2")
continue
b = randint(1,2)
if b == 1:
yase.combat(houyi)
else:
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