Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_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
b4413a87
authored
Dec 25, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
35b2a0ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
diy.py
diy.py
View file @
b4413a87
class
ying
:
class
ying
:
def
__init__
(
self
,
name
,
hp
,
kill
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
name
=
name
self
.
hp
=
hp
self
.
hp
=
250
self
.
ex
=
1
self
.
ex
=
1
self
.
kill
=
kill
self
.
zhandouli
=
40
def
upgrade
(
self
):
#def upgrade(self):
self
.
ex
=
self
.
ex
+
1
# self.ex=self.ex + 1
self
.
hp
=
self
.
hp
+
500
# self.hp=self.hp + 500
self
.
kill
=
self
.
kill
+
50
# self.kill=self.kill + 50
ys
=
ying
(
"yase"
,
3000
,
260
)
def
combat
(
self
,
bgj
):
hy
=
ying
(
"houyi"
,
2300
,
330
)
infor1
=
self
.
name
+
"对"
+
bgj
.
name
+
"发起进攻,"
# print(ys.hp)
infor2
=
"造成"
+
str
(
self
.
zhandouli
)
+
"点伤害"
# print(hy.kill)
bgj
.
hp
-=
self
.
zhandouli
ys
.
upgrade
()
if
bgj
.
hp
>
0
:
print
(
ys
.
hp
)
infor3
=
bgj
.
name
+
"还剩下"
+
str
(
bgj
.
hp
)
+
"血量"
print
(
ys
.
kill
)
infor
=
infor1
+
infor2
+
infor3
print
(
infor
)
\ No newline at end of file
else
:
infor3
=
bgj
.
name
+
"阵亡,游戏结束"
infor
=
infor1
+
infor2
+
infor3
print
(
infor
)
exit
()
yase
=
ying
(
"亚瑟"
)
houyi
=
ying
(
"后羿"
)
yase
.
combat
(
houyi
)
\ 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