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
0f488b4f
authored
Nov 12, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
f3052865
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
42 deletions
1
diy1.py
1
View file @
0f488b4f
...
...
@@ -53,9 +53,7 @@ while True:
a=input("请选择技能:1攻击/2治疗")
if int(a)==1:
houyi.combat(yase)
if int(a)==3:
houyi.combat(yase)
houyi.cure()
elif int(a)==2:
houyi.cure()
elif a=="q":
...
...
diy1.py
View file @
0f488b4f
import
random
s
=
0
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
level
=
1
self
.
hp
=
500
0
self
.
hp
=
25
0
self
.
attack
=
40
self
.
max_hp
=
self
.
hp
...
...
@@ -49,50 +48,14 @@ class Player(Hero):
houyi
=
Player
(
"射手"
,
"后羿"
)
yase
=
Hero
(
"垭瑟"
)
self
.
hp
=
200
self
.
attack
=
50
while
True
:
print
(
'-'
*
30
)
a
=
input
(
"请选择技能:1攻击/2治疗
/3反人类/4反人类*10/5赚钱/6升级
"
)
a
=
input
(
"请选择技能:1攻击/2治疗"
)
if
int
(
a
)
==
1
:
houyi
.
combat
(
yase
)
s
=
s
+
0.5
print
(
s
)
if
int
(
a
)
==
3
:
if
s
>=
1
:
houyi
.
combat
(
yase
)
houyi
.
cure
()
s
=
s
-
1
print
(
s
)
if
int
(
a
)
==
4
:
if
s
>=
5
:
for
i
in
range
(
10
):
houyi
.
combat
(
yase
)
houyi
.
cure
()
s
=
s
-
5
print
(
s
)
else
:
print
(
"没钱了"
)
print
(
s
)
if
int
(
a
)
==
5
:
s
=
s
+
3
print
(
s
)
if
int
(
a
)
==
6
:
if
s
>=
5
:
self
.
hp
=
self
.
hp
+
50
self
.
attack
=
self
.
attack
+
10
s
=
s
-
5
print
(
s
)
else
:
print
(
"没钱了"
)
print
(
s
)
elif
int
(
a
)
==
2
:
houyi
.
cure
()
s
=
s
+
0.5
print
(
s
)
elif
a
==
"q"
:
print
(
'游戏结束'
)
break
...
...
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