Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_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
ad145caa
authored
Jul 03, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
6a7dbf05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
diy2.py
diy2.py
View file @
ad145caa
import
random
class
Sans
:
class
Sans
:
def
__init__
(
self
,
AT
,
HP
,
HUP
,
AUP
,
name
,
MP
):
def
__init__
(
self
,
AT
,
HP
,
HUP
,
AUP
,
name
,
MP
):
self
.
Level
=
1
self
.
Level
=
1
...
@@ -32,6 +33,7 @@ class Sans:
...
@@ -32,6 +33,7 @@ class Sans:
Hero
.
Name
+
'的攻击成长点'
+
str
(
Hero
.
Attack_UpPoint
)
+
'
\n
'
)
Hero
.
Name
+
'的攻击成长点'
+
str
(
Hero
.
Attack_UpPoint
)
+
'
\n
'
)
def
cure
(
plus
):
def
cure
(
plus
):
plus
.
HitPoint
+=
40
plus
.
HitPoint
+=
40
print
(
plus
.
Name
+
'回血,现血量:'
+
str
(
plus
.
HitPoint
))
class
Sanses
(
Sans
):
class
Sanses
(
Sans
):
def
__init__
(
self
,
AT
,
HP
,
HUP
,
AUP
,
name
):
def
__init__
(
self
,
AT
,
HP
,
HUP
,
AUP
,
name
):
...
@@ -46,9 +48,11 @@ while True:
...
@@ -46,9 +48,11 @@ while True:
if
choose
==
'Outer'
:
if
choose
==
'Outer'
:
Player1
=
Outer
Player1
=
Outer
break
break
print
(
'-'
*
60
)
if
choose
==
'Mudder'
:
if
choose
==
'Mudder'
:
Player1
=
Mudder
Player1
=
Mudder
break
break
print
(
'-'
*
60
)
else
:
else
:
print
(
'请重新选择'
)
print
(
'请重新选择'
)
continue
continue
...
@@ -58,12 +62,18 @@ while True:
...
@@ -58,12 +62,18 @@ while True:
if
choose1
==
'Outer'
:
if
choose1
==
'Outer'
:
Player2
=
Outer
Player2
=
Outer
break
break
print
(
'-'
*
60
)
if
choose1
==
'Mudder'
:
if
choose1
==
'Mudder'
:
Player2
=
Mudder
Player2
=
Mudder
break
break
print
(
'-'
*
60
)
else
:
else
:
print
(
'请重新选择'
)
print
(
'请重新选择'
)
continue
continue
print
(
'-'
*
60
)
print
(
'游戏开始'
)
print
(
'-'
*
60
)
while
True
:
while
True
:
a
=
input
(
'请行动(1·治疗/2·攻击):'
)
a
=
input
(
'请行动(1·治疗/2·攻击):'
)
...
@@ -71,12 +81,16 @@ while True:
...
@@ -71,12 +81,16 @@ while True:
Player1
.
cure
()
Player1
.
cure
()
if
Player1
.
HitPoint
>=
Player1
.
Max_HP
:
if
Player1
.
HitPoint
>=
Player1
.
Max_HP
:
Player1
.
HitPoint
=
Player1
.
Max_HP
Player1
.
HitPoint
=
Player1
.
Max_HP
print
(
'-'
*
60
)
if
a
==
'2'
:
if
a
==
'2'
:
Player1
.
combat
(
Player2
)
Player1
.
combat
(
Player2
)
b
=
input
(
'请行动(1·治疗/2·攻击):'
)
print
(
'-'
*
60
)
b
=
str
(
random
.
choice
([
1
,
2
]))
if
b
==
'1'
:
if
b
==
'1'
:
Player2
.
cure
()
Player2
.
cure
()
if
Player2
.
HitPoint
>=
Player2
.
Max_HP
:
if
Player2
.
HitPoint
>=
Player2
.
Max_HP
:
Player2
.
HitPoint
=
Player2
.
Max_HP
Player2
.
HitPoint
=
Player2
.
Max_HP
if
a
==
'2'
:
print
(
'-'
*
60
)
if
b
==
'2'
:
Player2
.
combat
(
Player1
)
Player2
.
combat
(
Player1
)
print
(
'-'
*
60
)
\ 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