Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_1
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
b689e487
authored
Dec 06, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c9c84ecb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
diy.py
diy.py
View file @
b689e487
class
hero
:
class
ren
:
def
__init__
(
self
):
def
__init__
(
self
,
name
,
hp
,
aat
,
s
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
300
self
.
level
=
8
self
.
attack
=
2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
self
.
HP
=
hp
self
.
attact
=
aat
self
.
speed
=
s
self
.
show
=
True
print
(
"成功创建人:"
,
self
.
name
)
print
(
self
.
name
,
"的血量是:"
,
self
.
HP
,
"
\n
攻击力是:"
,
self
.
attact
)
def
jiasu
(
self
):
self
.
speed
+=
1
print
(
"你的速度增加了1"
)
print
(
"当前你的速度是:"
,
self
.
speed
)
def
wuli
(
self
):
self
.
attact
+=
10
print
(
"你的武力增加了10"
)
print
(
"当前你的武力是:"
,
self
.
attact
)
def
huixie
(
self
):
self
.
HP
+=
1
print
(
"你的生命增加了1"
)
print
(
"当前你的生命是:"
,
self
.
HP
)
def
duomaomao
(
self
):
self
.
show
=
False
print
(
"窝藏起来了,你看不见我"
)
fangfang
=
ren
(
"放放"
,
100
,
100000
,
100
)
fangfang
.
jiasu
()
fangfang
.
wuli
()
fangfang
.
duomaomao
()
fangfang
.
huixie
()
\ 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