Commit b23ddf48 by BellCodeEditor

save project

parent 21315d45
Showing with 27 additions and 7 deletions
print("你有病"*100000000) print("你有病"*99999999+"你有病")
\ No newline at end of file \ No newline at end of file
...@@ -24,7 +24,6 @@ class Hero(object): ...@@ -24,7 +24,6 @@ class Hero(object):
info3 = enemy.name+"阵亡,游戏结束" info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
print('你干嘛啊~~')
exit() exit()
class Player(Hero): class Player(Hero):
...@@ -38,10 +37,31 @@ class Player(Hero): ...@@ -38,10 +37,31 @@ class Player(Hero):
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
print('-'*30) print('-'*30)
print(' 战斗开始') print(' 战斗开始')
def cure(self):
blood = random.randint(30.50)
self.hp += blood
if self.hp > self.max_hp :
self.hp = self.max_hp
print(self.name + "使用了治疗术,血量增加了"blood)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
while True:
print('-'*30)
a = input("攻击按1,治疗按2:")
\ No newline at end of file if a == "q":
print("游戏结束")
break
elif a == "1" :
houyi.combat(houyi)
elif a == "2":
houyi.cure()
else:
print("输入错误,请重新输入")
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