Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_test1
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
fe3afe1c
authored
Jul 10, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
468f5da5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
hh.py
hh.py
0 → 100644
View file @
fe3afe1c
class
Hero
(
odject
):
def
__init__
(
selt
,
name
):
selt
.
level
=
1
selt
.
hp
=
250
selt
.
attack
=
40
selt
.
name
=
name
def
combat
(
self
,
enemy
):
inof1
=
sejf
.
name
+
'对'
+
enemy
.
name
+
'发动了攻击'
inof2
=
'造成了'
+
str
(
self
.
attack
)
+
'点伤害'
enemy
.
hp
-=
self
.
attack
if
enemy
.
hp
>
0
:
inof3
=
enemy
.
name
+
'还剩下'
+
str
(
enemy
.
hp
)
+
'点血'
inof
=
inof1
+
inof2
+
inof3
print
(
inof
)
else
:
inof3
=
enemy
.
name
+
'已经死亡'
inof
=
inof1
+
inof2
+
inof3
print
(
inof
)
exit
()
class
Player
():
def
__init__
(
self
,
name
):
super
()
.
__init__
(
name
)
self
.
hp
=
200
self
.
attack
=
50
player
=
Player
(
"后羿"
)
print
(
""
)
print
(
""
)
print
(
""
)
\ 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