Commit 8e128c6b by BellCodeEditor

auto save

parent e6e4b1bf
Showing with 20 additions and 5 deletions
import random
class Hero(object):
def __init__(self, name):
self.name = name
......@@ -12,7 +13,7 @@ class Hero(object):
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
def combat(self, enemy):
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
enemy.hp -= self.attack
......@@ -38,9 +39,22 @@ class Player(Hero):
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
print('='*60)
print('='*114514)
print(' 游戏开始辣')
print('='*60)
print('='*114514)
while True:
a=input('(1攻击/2治疗)')
a=input('(S攻击/B治疗):')
if a=="S":
houyi.combat(yase)
elif a=="B":
houyi.cure()
elif a=="SB":
exit()
else:
print('重新输入,FUCK YOU!!!')
continue
b=random.randint(1,3)
if b=='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