Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_3
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
d6875591
authored
Jan 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
cffa2d31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
diy2.py
diy2.py
View file @
d6875591
...
...
@@ -5,6 +5,12 @@ class Hero: # 英雄类
self
.
hp
=
250
self
.
attack
=
40
self
.
max_hp
=
self
.
hp
def
cure
(
self
):
self
.
hp
=
self
.
hp
+
self
.
hp
*
0.3
if
self
.
hp
>
self
.
max_hp
:
self
.
hp
=
self
.
max_hp
print
(
'他治疗了'
+
self
.
hp
*
0.3
+
'滴血'
)
def
combat
(
self
,
enemy
):
# 攻击功能
...
...
@@ -28,6 +34,7 @@ class Player(Hero): # 玩家英雄
self
.
hp
=
88
self
.
attack
=
999
self
.
max_hp
=
self
.
hp
self
.
a
=
a
print
(
'角色'
+
self
.
name
+
'创建成功,类型为:'
,
self
.
a
)
print
(
'该角色伤害,等级,血量分别为:'
,
self
.
attack
,
self
.
level
,
self
.
hp
)
...
...
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