Commit 1f8026d4 by BellCodeEditor

save project

parent 2f63ea27
Showing with 3 additions and 11 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -39,7 +38,7 @@ class Player(Hero): ...@@ -39,7 +38,7 @@ class Player(Hero):
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") #yase = Hero("垭瑟")
#houyi.combat(yase) #houyi.combat(yase)
#yase.combat(houyi) #yase.combat(houyi)
#houyi.cure() #houyi.cure()
...@@ -49,15 +48,7 @@ print(" 战斗开始") ...@@ -49,15 +48,7 @@ print(" 战斗开始")
while True: while True:
print('-'*30) print('-'*30)
a=input("1攻击,2治疗:") a=input("1攻击,2治疗:")
if a=='q':
exit()
if a=='1': if a=='1':
houyi.combat(yase) houyi.combat(yase)
if a=="2": else:
houyi.cure() houyi.cure()
\ No newline at end of file
b=random.randint(1,3)
if b=="1":
yase.cure()
elif b=="2":
yase.combat(yase)
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