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
5ebf6adb
authored
Nov 21, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b0e7aa64
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
diy1.py
diy1.py
View file @
5ebf6adb
...
@@ -27,7 +27,11 @@ class Hero(object):
...
@@ -27,7 +27,11 @@ class Hero(object):
info
=
info1
+
info2
+
info3
info
=
info1
+
info2
+
info3
print
(
info
)
print
(
info
)
exit
()
exit
()
#def shengji(self)
def
shengji
(
self
):
self
.
level
+=
1
self
.
hp
+=
10
self
.
attack
+=
10
self
.
max_hp
+=
10
class
Player
(
Hero
):
class
Player
(
Hero
):
def
__init__
(
self
,
hero_type
,
name
):
def
__init__
(
self
,
hero_type
,
name
):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
...
@@ -56,20 +60,25 @@ while True:
...
@@ -56,20 +60,25 @@ while True:
houyi
.
cure
()
houyi
.
cure
()
elif
a
==
'q'
:
elif
a
==
'q'
:
print
(
"退出游戏"
)
print
(
"退出游戏"
)
exit
()
break
else
:
else
:
print
(
"重新输入"
)
print
(
"
请
重新输入"
)
continue
continue
#b = random.randint(1,2)
#b = random.randint(1,2)
if
yase
.
hp
==
150
:
houyi
.
shengji
()
b
=
input
(
"你要使用什么技能?(1攻击/2治疗/q退出)"
)
b
=
input
(
"你要使用什么技能?(1攻击/2治疗/q退出)"
)
if
b
==
'1'
:
if
b
==
'1'
:
yase
.
combat
(
houyi
)
yase
.
combat
(
houyi
)
if
b
==
'2'
:
el
if
b
==
'2'
:
yase
.
cure
()
yase
.
cure
()
elif
a
==
'q'
:
elif
b
==
'q'
:
print
(
"退出游戏"
)
print
(
"游戏结束"
)
exit
()
break
# b = random.randid
else
:
print
(
"请重新输入"
)
continue
# houyi.combat(yase)
# houyi.combat(yase)
# yase.combat(houyi)
# yase.combat(houyi)
# houyi.cure()
# houyi.cure()
...
...
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