Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson16_2
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
b63e3e25
authored
Mar 23, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d5f40310
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
aaa.py
diy1.py
aaa.py
View file @
b63e3e25
def
cure
(
self
):
self
.
hp
+=
55
if
self
.
hp
>
self
.
max_hp
:
self
.
hp
=
self
.
max_hp
print
(
self
.
name
+
"使用了治疗,血量增加:"
,
60
,
",目前的血量为:"
,
self
.
hp
)
diy1.py
View file @
b63e3e25
...
@@ -26,7 +26,7 @@ class Hero(object):
...
@@ -26,7 +26,7 @@ class Hero(object):
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info
=
info1
+
info2
+
info3
info
=
info1
+
info2
+
info3
print
(
info
)
print
(
info
)
print
(
'
你干嘛哎呦喂
~~'
)
print
(
'
菜就多练,输不起就别玩
~~'
)
exit
()
exit
()
class
Player
(
Hero
):
class
Player
(
Hero
):
...
@@ -39,7 +39,7 @@ class Player(Hero):
...
@@ -39,7 +39,7 @@ class Player(Hero):
print
(
"角色"
+
self
.
name
+
"创建成功,英雄类型为:"
,
self
.
hero_type
)
print
(
"角色"
+
self
.
name
+
"创建成功,英雄类型为:"
,
self
.
hero_type
)
print
(
"当前等级、血量、攻击力分别为:"
,
self
.
level
,
self
.
hp
,
self
.
attack
)
print
(
"当前等级、血量、攻击力分别为:"
,
self
.
level
,
self
.
hp
,
self
.
attack
)
print
(
'-'
*
30
)
print
(
'-'
*
30
)
print
(
'
战斗
开始'
)
print
(
'
八嘎!
开始'
)
def
cure
(
self
):
def
cure
(
self
):
c
=
random
.
randint
(
35
,
50
)
c
=
random
.
randint
(
35
,
50
)
self
.
hp
+=
c
self
.
hp
+=
c
...
...
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