Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_3
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
67966cb5
authored
Sep 08, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
7032163d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
diy2.py
diy3.py
diy2.py
View file @
67966cb5
...
...
@@ -85,15 +85,7 @@ while True:
player2
.
sj
()
elif
user_input
==
"3"
:
player1
.
wk
()
if
random
.
randint
(
0
,
2
)
==
0
:
if
player2
.
level
>=
5
:
player2
.
wk
()
else
:
player2
.
cure
()
elif
random
.
randint
(
0
,
2
)
==
1
:
player2
.
combat
(
player1
)
else
:
player2
.
sj
()
player2
.
combat
(
player1
)
elif
user_input
==
"4"
:
player1
.
sj
()
if
random
.
randint
(
0
,
2
)
==
0
:
...
...
diy3.py
View file @
67966cb5
class
\ No newline at end of file
import
random
name_log
=
[]
hp_log
=
[]
class
yx
:
def
__init__
(
self
,
name
,
hp
,
lv
):
self
.
name
=
name
self
.
lv
=
lv
self
.
hp
=
hp
self
.
att
=
random
.
randint
(
1
,
200
)
print
(
'角色'
,
str
(
self
.
name
),
'创建成功!血量:'
,
str
(
self
.
hp
),
'攻击力:'
,
str
(
self
.
att
),
'等级:'
,
str
(
self
.
lv
))
def
combat
(
self
,
name
):
name
.
hp
=
name
.
hp
-
self
.
att
print
(
str
(
self
.
name
),
'向'
,
str
(
name
.
name
),
'使用了'
,
str
(
self
.
att
),
'点伤害,'
,
str
(
name
.
name
),
'还剩'
,
str
(
name
.
hp
),
'点血量'
)
a
=
yx
(
'a'
,
200
,
1
)
b
=
yx
(
'b'
,
2000
,
1
)
a
.
combat
(
b
)
\ No newline at end of file
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