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
ecc2bfb6
authored
Dec 11, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
6a412a51
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
diy1.py
diy1.py
View file @
ecc2bfb6
import
random
cure_cishu_player
=
3
cure_cishu_hero
=
3
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
name
=
name
...
...
@@ -41,7 +44,22 @@ print('-'*30)
print
(
' Fight!'
)
print
(
'-'
*
30
)
while
True
:
choice
=
in
t
(
input
(
'请输入(攻击———1 治疗术——2):'
)
)
choice
=
in
put
(
'请输入(攻击———1 治疗术——2 退出——q):'
)
print
(
'-'
*
30
)
if
choice
==
'1'
:
houyi
.
combat
(
yase
)
elif
choice
==
'2'
and
cure_cishu_player
>
0
:
houyi
.
cure
()
print
(
'治疗还可用'
,
cure_cishu_player
-
1
,
'次'
)
elif
choice
==
'q'
:
print
(
'已退出!'
)
break
else
:
print
(
'Please try again!'
)
continue
num
=
random
.
randint
(
1
,
2
)
if
num
==
1
:
yase
.
combat
(
houyi
)
elif
num
==
2
and
cure_cishu_hero
>
0
:
yase
.
cure
()
\ 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