Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_1
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
09b72621
authored
Jan 02, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c619e270
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
diy1.py
diy1.py
View file @
09b72621
...
...
@@ -18,15 +18,16 @@ class Hero(object):
print
(
enemy
.
name
+
" is kill,game is stop "
)
exit
()
def
cure
(
self
):
self
.
hp
+=
60
o
=
random
.
randint
(
30
,
100
)
self
.
hp
+=
o
if
self
.
hp
>
self
.
max_hp
:
self
.
hp
=
self
.
max_hp
print
(
self
.
name
+
" cure
60 blood volume ,"
+
" at present rest "
+
str
(
self
.
hp
))
print
(
self
.
name
+
" cure
"
+
str
(
o
)
+
" blood volume , "
+
" at present rest "
+
str
(
self
.
hp
))
class
player
(
Hero
):
def
__init__
(
self
,
name
):
super
()
.
__init__
(
name
)
self
.
attack
=
2
31
self
.
hp
=
21
0
self
.
attack
=
2
0
self
.
hp
=
32
0
self
.
max_hp
=
self
.
hp
p1
=
player
(
"A"
)
p2
=
Hero
(
"B"
)
...
...
@@ -45,10 +46,10 @@ while True:
else
:
print
(
"please again input (1combot/2cure)"
)
continue
k
=
random
.
randint
(
1
,
3
)
if
k
==
"1"
:
num
=
random
.
randint
(
1
,
3
)
if
num
==
1
:
p2
.
combat
(
p1
)
elif
k
==
"2"
or
k
==
"3"
:
elif
num
==
2
or
num
==
3
:
p2
.
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