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
d89f5972
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
67c3c0b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
diy2.py
diy2.py
View file @
d89f5972
...
...
@@ -27,6 +27,20 @@ class Hero(object):
print
(
info
)
exit
()
def
jscombat
(
self
,
enemy
):
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发起绝杀,"
info2
=
"绝杀造成"
+
str
(
self
.
attack
+
5
)
+
"点伤害,"
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
()
class
Player
(
Hero
):
def
__init__
(
self
,
hero_type
,
name
):
super
()
.
__init__
(
name
)
...
...
@@ -62,8 +76,10 @@ while True:
else
:
print
(
"请重新输入"
)
continue
mun
=
random
.
randint
(
1
,
3
)
if
mun
==
1
:
mun
=
random
.
randint
(
1
,
10
)
if
mun
>
0
and
mun
<
4
:
yase
.
cure
()
elif
mun
==
4
:
yase
.
jscombat
(
houyi
)
else
:
yase
.
combat
(
houyi
)
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