Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson16_4
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
be05edd6
authored
Mar 16, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ce201330
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
diy1.py
diy1.py
View file @
be05edd6
...
@@ -4,7 +4,7 @@ class Hero(object):
...
@@ -4,7 +4,7 @@ class Hero(object):
self
.
name
=
name
self
.
name
=
name
self
.
level
=
1
self
.
level
=
1
self
.
hp
=
250
self
.
hp
=
250
self
.
attack
=
40
self
.
attack
=
random
.
randint
(
25
,
40
)
self
.
max_hp
=
self
.
hp
self
.
max_hp
=
self
.
hp
def
cure
(
self
):
# 治疗
def
cure
(
self
):
# 治疗
...
@@ -49,18 +49,24 @@ print('-'*30)
...
@@ -49,18 +49,24 @@ print('-'*30)
print
(
' 战斗开始'
)
print
(
' 战斗开始'
)
while
True
:
while
True
:
print
(
'-'
*
30
)
print
(
'-'
*
30
)
v
=
input
(
"请选择英雄技能:1攻击2治疗"
)
v1
=
input
(
"请选择英雄1技能:1攻击2治疗"
)
if
v
==
"q"
:
v2
=
input
(
"请选择英雄2技能:1攻击2治疗"
)
if
v1
==
"q"
:
break
break
elif
v
==
"1"
:
elif
v
1
==
"1"
:
houyi
.
combat
(
yase
)
houyi
.
combat
(
yase
)
elif
v
==
"2"
:
elif
v
1
==
"2"
:
houyi
.
cure
()
houyi
.
cure
()
else
:
else
:
print
(
"请输入1或2"
)
print
(
"请输入1或2"
)
continue
continue
n
=
random
.
randint
(
1
,
3
)
if
v2
==
"q"
:
if
n
==
1
:
break
yase
.
cure
()
elif
v2
==
"1"
:
yase
.
combat
(
houyi
)
elif
v2
==
"2"
:
yase
.
cure
()
else
:
else
:
yase
.
combat
(
houyi
)
print
(
"请输入1或2"
)
continue
\ 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