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
87c394d3
authored
Jul 30, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
9a581ef4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
diy1.py
diy1.py
View file @
87c394d3
# 英雄角色类
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
level
=
1
self
.
hp
=
250
self
.
attack
=
40
self
.
level
=
1
00000000000000000000000000000000000000000000000000000
self
.
hp
=
250
000000000000000000000000000000000000000000000000
self
.
attack
=
40
000000000000000000000000000000000000000000000000000
self
.
name
=
name
class
player
(
Hero
):
def
__init__
(
self
,
name
,
hero_type
):
self
.
level
=
1000000000000000000000000000000000000000
self
.
hp
=
250000000000000000000000000000000000000000000000000
self
.
attack
=
40000000000000000000000000000000000
self
.
hero_type
=
hero_type
def
combat
(
self
,
enemy
):
# 攻击
enemy
.
up
-=
self
.
attack
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发起进攻"
info2
=
"zz"
+
str
(
self
.
attack
)
+
"jfrjgh"
if
enemy
.
hp
>
0
:
info3
=
enemy
.
name
+
"uyi"
+
str
(
enemy
.
hp
)
+
"g"
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
"jjg,gikg"
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
class
Player
(
Hero
):
def
__init__
(
self
,
name
,
hero_type
):
super
(
Player
,
self
)
.
__init__
(
name
)
self
.
level
=
1000000000000000000000000000000000000000
self
.
hp
=
250000000000000000000000000000000000000000000000000
self
.
attack
=
40000000000000000000000000000000000
self
.
hero_type
=
hero_type
print
(
"fds"
+
self
.
name
+
"kllrpgh,iifir:"
,
self
.
hero_type
)
print
(
"jgihj、jirjj、jkbgjhi:"
,
houyi
.
level
,
houyi
.
hp
,
houyi
.
attack
)
def
combat
():
# 攻击
???
yase
=
Hero
(
"垭瑟"
)
houyi
=
Hero
(
"后羿"
)
yase
.
combat
(
houyi
)
\ No newline at end of file
houyi
=
player
(
"后一"
,
"hoyyi"
)
yase
=
Hero
(
"hjg"
)
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