Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson16_4
This project
Loading...
Sign in
Toggle navigation
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
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
6ab092e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
diy3.py
diy3.py
View file @
c23c9911
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment