Commit c23c9911 by BellCodeEditor

save project

parent 6ab092e9
Showing with 19 additions and 3 deletions
......@@ -27,7 +27,7 @@ class Hero(object):
print(info)
exit()
def jscombat(self, enemy):
def jscombat(self, enemy): #绝杀
info1 = self.name+"对"+enemy.name+"发起绝杀,"
info2 = "绝杀造成"+str(self.attack+5)+"点伤害,"
enemy.hp=enemy.hp-self.attack-5
......@@ -41,7 +41,7 @@ class Hero(object):
print(info)
exit()
def ftcombat(self, enemy):
def ftcombat(self, enemy): #反弹
ftaaa=random.randint(25,100)
info1 = self.name+"对"+enemy.name+"反弹伤害,"
info2 = "反弹造成"+str(ftaaa)+"点伤害,"
......@@ -74,6 +74,20 @@ class Player(Hero):
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", asd,",目前的血量为:",self.hp)
def qscombat(self, enemy): #强杀
qsaaa=random.randint(25,75)
info1 = self.name+"对"+enemy.name+"发起强杀,"
info2 = "强杀造成"+str(qsaaa)+"点伤害,"
enemy.hp=enemy.hp-self.attack-5
if enemy.hp > 0:
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
info = info1+info2+info3
print(info)
else:
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
exit()
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
......@@ -81,7 +95,7 @@ print(30*"-")
print(" 战斗开始")
while True:
print(30*"-")
choice=input("请选择释放英雄技能(1攻击/2治疗):")
choice=input("请选择释放英雄技能(1攻击/2治疗/3强杀):")
if choice=="q":
print("游戏结束")
break
......@@ -89,6 +103,8 @@ while True:
houyi.combat(yase)
elif choice=="2":
houyi.cure()
elif choice=="3":
houyi.qscombat(yase)
else:
print("请重新输入")
continue
......
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