Commit 937e7b30 by BellCodeEditor

save project

parent 02ce4fe0
Showing with 16 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
...@@ -35,7 +36,6 @@ class Player(Hero): ...@@ -35,7 +36,6 @@ class Player(Hero):
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
print(30*'^'*3) print(30*'^'*3)
...@@ -43,4 +43,17 @@ print(' 开始战斗') ...@@ -43,4 +43,17 @@ print(' 开始战斗')
while True: while True:
print(30*'^'*3) print(30*'^'*3)
xd=input('设置战斗指令(1干就完了/2哎呀!狗一波):') xd=input('设置战斗指令(1干就完了/2哎呀!狗一波):')
if xd=='1':
\ No newline at end of file houyi.combat(yase)
elif xd=='2':
houyi.cure()
elif xd=='q':
break
else:
print('重来!')
continue
ai_xd=random.randint(1,3)
if ai_xd==1:
yase.cure()
else:
yase.combat(houyi)
\ 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