Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_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
5d3cd39b
authored
Apr 21, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
729f8d09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
diy1.py
diy1.py
View file @
5d3cd39b
...
...
@@ -2,8 +2,8 @@
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
level
=
9999999999999999999999
self
.
hp
=
999998888777
665
self
.
attack
=
999
888777666555
self
.
hp
=
999998888777
76
self
.
attack
=
999
9888777666
self
.
name
=
name
def
combat
(
self
,
enemy
):
# 攻击
...
...
@@ -16,7 +16,14 @@ class Hero(object):
info3
=
enemy
.
name
+
'还剩下'
+
str
(
enemy
.
hp
)
+
'点生命值'
print
(
info1
+
info2
+
info3
)
lubu
=
Hero
(
"吕布"
)
houyi
=
Hero
(
"后羿"
)
class
player
(
Hero
):
def
__init__
(
self
,
name
,
Hero_type
):
super
(
player
,
self
)
.
__init__
(
name
)
self
.
hp
=
999998888777665
self
.
attack
=
999888777666
self
.
Hero_type
=
Hero_type
print
(
"角色"
+
self
.
name
+
"创建成功,英雄类型为:"
,
self
.
Hero_type
)
print
(
"当前等级,血量,攻击力分别为:"
,
self
.
level
,
self
.
hp
,
self
.
attack
)
houyi
=
Hero
(
"后羿"
)
lubu
=
player
(
"吕布"
,
"至尊终极战士"
)
lubu
.
combat
(
houyi
)
\ 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