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
075dce1f
authored
May 03, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c72f6e74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
diy1.py
diy1.py
View file @
075dce1f
...
@@ -51,23 +51,21 @@ houyi = Player("射手", "后羿")
...
@@ -51,23 +51,21 @@ houyi = Player("射手", "后羿")
yase
=
Hero
(
"垭瑟"
)
yase
=
Hero
(
"垭瑟"
)
print
(
30
*
'-'
)
print
(
30
*
'-'
)
print
(
' 战斗开始'
)
print
(
' 战斗开始'
)
while
True
:
while
True
:
#重复循环
print
(
"-"
*
30
)
print
(
"-"
*
30
)
#打印30个"-"
choice
=
input
(
"请选择释放英雄技能(1攻击/2治疗):"
)
choice
=
input
(
"请选择释放英雄技能(1攻击/2治疗)"
)
#选择释放英雄技能(1攻击/2治疗)
if
int
(
a
)
==
1
:
if
choice
==
"q"
:
#如果输入q
houyi
.
combat
(
yase
)
print
(
"游戏结束"
)
#打印游戏结束
elif
int
(
a
)
==
2
:
break
#结束循环
houyi
.
cure
()
elif
choice
==
"1"
:
#如果输入1
elif
a
==
"q"
:
houyi
.
combat
(
yase
)
#后羿攻击亚瑟
print
(
'游戏结束'
)
elif
choice
==
"2"
:
#如果输入2
break
houyi
.
cure
()
#后羿治疗
else
:
else
:
#否则
print
(
'重输!'
)
print
(
"请重新输入1或2"
)
#打印请重新输入1或2
continue
continue
#结束循环
b
=
random
.
randint
(
1
,
3
)
status
=
random
.
randint
(
1
,
3
)
#随机数1-3
if
b
==
3
:
if
status
==
1
:
#如果是1
yase
.
cure
()
yase
.
cure
()
#亚瑟治疗
else
:
else
:
#否则
yase
.
combat
(
houyi
)
yase
.
combat
(
houyi
)
#亚瑟攻击后羿
\ No newline at end of file
\ 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