Commit 388defee by BellCodeEditor

save project

parent 2d817bfa
Showing with 19 additions and 3 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -39,9 +40,24 @@ class Player(Hero): ...@@ -39,9 +40,24 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi.combat(yase)
yase.combat(houyi)
print("-" * 30) print("-" * 30)
print(" 游戏开始") print(" 游戏开始")
print("-" * 30) print("-" * 30)
input("1:攻击 2:回血")
while True:
a=input("1:攻击 2:回血")
c=random.randint(1,3)
if a=="q":
break
if a=="1":
houyi.combat(yase)
if a=="2":
houyi.cure()
if a != "q" and a != "1" and a != "2":
input("请重输")
continue
if c=="1" or c=="2":
yase.combat(houyi)
if c=="3":
yase.cure()
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