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
24fab1a3
authored
Apr 29, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9a581ef4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
diy1.py
diy1.py
View file @
24fab1a3
# 英雄角色类
# 英雄角色类
class
Hero
(
object
):
class
Hero
(
object
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
level
=
1
self
.
level
=
1
self
.
hp
=
250
self
.
hp
=
250
self
.
attack
=
40
self
.
attack
=
40
self
.
name
=
name
self
.
name
=
name
def
combat
(
self
,
hen
):
hen
.
hp
-=
self
.
attack
a
=
'双方火热交战中,'
+
self
.
name
+
'把敌人爆头了,'
+
hen
.
name
+
'步步后退!'
b
=
hen
.
name
+
'可真是个老六,受到了来自八嘎呀路'
+
str
(
self
.
attack
)
+
'的伤害,是大大的伤害,快gg了!'
if
hen
.
hp
>
0
:
c
=
hen
.
name
+
'还剩八嘎呀路的'
+
str
(
hen
.
hp
)
+
'血量。'
d
=
a
+
b
+
c
print
(
d
)
else
:
c
=
hen
.
name
+
'已gg,下线了???敌人:我还会回来的'
d
=
a
+
b
+
c
print
(
d
)
exit
()
def
combat
():
# 攻击
???
yase
=
Hero
(
"垭瑟"
)
yase
=
Hero
(
"垭瑟"
)
houyi
=
Hero
(
"后羿"
)
houyi
=
Hero
(
"后羿"
)
...
...
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