Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson16_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
9f4c88a9
authored
Jun 18, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
6aab6e8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
23 deletions
diy1.py
diy1.py
View file @
9f4c88a9
...
...
@@ -6,7 +6,6 @@ class Hero(object):
self
.
attack
=
40
self
.
max_hp
=
self
.
hp
def
cure
(
self
):
# 治疗
if
self
.
hp
+
60
>
self
.
max_hp
:
print
(
self
.
name
+
"使用了治疗,血量增加:"
,
60
,
",目前的血量为:"
,
self
.
max_hp
)
...
...
@@ -45,28 +44,7 @@ yase = Hero("垭瑟")
# yase.cure()
print
(
'-'
*
30
)
print
(
' 开始'
)
import
random
while
True
:
print
(
'-'
*
30
)
a
=
input
(
'用技能(攻击1,治疗2)'
)
if
a
==
"1"
:
houyi
.
combat
(
yase
)
elif
a
==
"2"
:
houyi
.
cure
()
elif
a
==
"q"
:
print
(
"结束"
)
break
else
:
print
(
"无效,重新输"
)
continue
num
=
random
.
randint
(
1
,
3
)
if
num
==
1
:
yase
.
cure
()
else
:
yase
.
combat
(
houyi
)
input
(
'用技能(攻击1,治疗2)'
)
\ 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