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
24b8429a
authored
Mar 12, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
3b207d2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
diy.py
diy1.py
diy.py
0 → 100644
View file @
24b8429a
diy1.py
View file @
24b8429a
...
@@ -25,13 +25,13 @@ class Hero(object):
...
@@ -25,13 +25,13 @@ class Hero(object):
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info
=
info1
+
info2
+
info3
info
=
info1
+
info2
+
info3
print
(
info
)
print
(
info
)
print
(
'你
干嘛啊~~
'
)
print
(
'你
才是恐怖份子
'
)
exit
()
exit
()
class
Player
(
Hero
):
class
Player
(
Hero
):
def
__init__
(
self
,
hero_type
,
name
):
def
__init__
(
self
,
hero_type
,
name
):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
self
.
hp
=
1
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
self
.
hp
=
900000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
self
.
attack
=
50000000000000000
self
.
attack
=
50000000000000000
self
.
max_hp
=
self
.
hp
self
.
max_hp
=
self
.
hp
self
.
hero_type
=
hero_type
self
.
hero_type
=
hero_type
...
@@ -46,15 +46,15 @@ class Player(Hero):
...
@@ -46,15 +46,15 @@ class Player(Hero):
self
.
hp
=
self
.
max_hp
self
.
hp
=
self
.
max_hp
print
(
self
.
name
+
"使用了治疗,血量增加:"
,
str
(
c
),
",目前的血量为:"
,
self
.
hp
)
print
(
self
.
name
+
"使用了治疗,血量增加:"
,
str
(
c
),
",目前的血量为:"
,
self
.
hp
)
houyi
=
Player
(
"射手"
,
"后羿
"
)
apiao
=
Player
(
"恐怖"
,
"阿飘
"
)
yase
=
Hero
(
"垭瑟
"
)
abiao
=
Hero
(
"阿膘
"
)
while
True
:
while
True
:
print
(
'-'
*
30
)
print
(
'-'
*
30
)
a
=
input
(
"请选择技能:1
攻击/
2治疗"
)
a
=
input
(
"请选择技能:1
1攻击/2
2治疗"
)
if
int
(
a
)
==
1
:
if
int
(
a
)
==
1
1
:
houyi
.
combat
(
yase
)
apiao
.
combat
(
abiao
)
elif
int
(
a
)
==
2
:
elif
int
(
a
)
==
2
2
:
houyi
.
cure
()
apiao
.
cure
()
elif
a
==
"q"
:
elif
a
==
"q"
:
print
(
'游戏结束'
)
print
(
'游戏结束'
)
break
break
...
@@ -63,9 +63,9 @@ while True:
...
@@ -63,9 +63,9 @@ while True:
continue
continue
b
=
random
.
randint
(
1
,
3
)
b
=
random
.
randint
(
1
,
3
)
if
b
==
3
:
if
b
==
3
:
yase
.
cure
()
abiao
.
cure
()
else
:
else
:
yase
.
combat
(
houyi
)
abiao
.
combat
(
apiao
)
\ 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