Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / lesson16_4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit c23c9911 authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

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