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
fa148596
authored
Sep 06, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
fb097064
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
diy-test1.py
diy1.py
diy-test1.py
0 → 100644
View file @
fa148596
diy1.py
View file @
fa148596
# 英雄角色类
# 英雄角色类
class
Hero
(
object
)
:
class
Hero
:
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
hp
=
254
self
.
hp
=
254
self
.
attack
=
27
self
.
attack
=
27
self
.
name
=
name
self
.
name
=
name
Def
函数名
(
self
,
name1
)
def
combat
(
self
,
name1
):
name1
.
hp
-=
self
.
attack
info1
=
self
.
name
+
"对"
+
name1
.
name
+
"发起进攻"
Info1
=
self
.
name
+
”还剩”
+
str
(
name1
)
info2
=
"造成"
+
str
(
self
.
attack
)
+
"点伤害"
Inof2
=
”造成”
+
str
(
self
.
attack
)
+
”点伤害”
name1
.
hp
-=
self
.
attack
I
f
name1
.
hp
>
0
:
i
f
name1
.
hp
>
0
:
Info3
=
name1
.
”还剩下”
+
str
(
name1
.
hp
)
+
”血量”
info3
=
name1
.
name
+
"还剩下"
+
str
(
name1
.
hp
)
+
"血量"
Info
=
info1
+
info2
+
info
#
info
=
info1
+
info2
+
info3
P
rint
(
info
)
p
rint
(
info
)
E
lse
:
e
lse
:
Info3
=
name1
.
name
+
”阵亡,游戏结束”
info3
=
name1
.
name
+
"阵亡,游戏结束"
I
nfo
=
info1
+
info2
+
info3
i
nfo
=
info1
+
info2
+
info3
P
rint
(
info
)
p
rint
(
info
)
Tran
=
Hero
(
"Tran"
)
Tran
=
Hero
(
"Tran"
)
...
...
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