Commit d76a064c by BellCodeEditor

save project

parent e320542a
Showing with 16 additions and 5 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -41,8 +42,19 @@ class Player(Hero): ...@@ -41,8 +42,19 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
while True: while True:
k=int(input('攻击:1 治疗:2')) k=input('攻击:1 治疗:2')
if k==1: if k=='1':
houyi.combat(yase) houyi.combat(yase)
if k==2: else:
houyi.cure() if k=='2':
\ No newline at end of file houyi.cure()
else:
if k=='q':
break
else:
print('重新输入')
num=random.randint(1,3)
if num==1:
yase.cure()
if num==2 or num == 3:
yase.combat(houyi)
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