Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_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
e5d95fe7
authored
Feb 27, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
22354288
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
diy2.py
diy2.py
0 → 100644
View file @
e5d95fe7
class
HeroFamily
:
def
__init__
(
self
,
name
,
hp
,
attack
):
self
.
level
=
1
#等级
self
.
name
=
name
#名字
self
.
hp
=
hp
#血量
self
.
attack
=
attack
#攻击力
def
upgrade
():
#垭瑟升级
yase
.
level
=
yase
.
level
+
1
yase
.
hp
=
yase
.
hp
+
50
yase
.
attack
=
yase
.
attack
+
5
#后艺升级
houyi
.
level
=
houyi
.
level
+
1
houyi
.
hp
=
houyi
.
hp
+
50
houyi
.
attack
=
houyi
.
attack
+
5
#百里玄策升级
bailidi
.
level
=
bailidi
.
level
+
1
bailidi
.
hp
=
bailidi
.
hp
+
50
bailidi
.
attack
=
bailidi
.
attack
+
5
#百里守约升级
bailige
.
level
=
bailige
.
level
+
1
bailige
.
hp
=
bailige
.
hp
+
50
bailige
.
attack
=
bailige
.
attack
+
5
yase
=
HeroFamily
(
"垭瑟"
,
300
,
20
)
houyi
=
HeroFamily
(
"后艺"
,
250
,
23
)
bailidi
=
HeroFamily
(
"百里玄策"
,
225
,
30
)
bailige
=
HeroFamily
(
"百里守约"
,
245
,
25
)
upgrade
()
print
(
"垭瑟的血量为:"
,
yase
.
hp
,
",垭瑟的攻击力为:"
,
yase
.
attack
)
print
(
"后艺的血量为:"
,
houyi
.
hp
,
",后艺的攻击力为:"
,
houyi
.
attack
)
print
(
"百里玄策的血量为:"
,
bailidi
.
hp
,
",百里玄策的攻击力为:"
,
bailidi
.
attack
)
print
(
"百里守约的血量为:"
,
bailige
.
hp
,
",百里守约的攻击力为:"
,
bailige
.
attack
)
\ 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