Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_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
0eca85e1
authored
Apr 04, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d1ddf930
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
diy2.py
diy2.py
View file @
0eca85e1
class
Hero
():
class
Hero
():
def
__init__
(
self
,
level
,
hp
,
defense
,
attck
):
def
__init__
(
self
,
name
):
self
.
level
=
level
self
.
level
=
level
self
.
hp
=
hp
self
.
hp
=
250
self
.
defense
=
defense
self
.
defense
=
250
self
.
attck
=
attck
self
.
attck
=
250
self
.
name
=
name
yase
=
yase
#def a(self,enemy):
#self.level=self.level+50
#self.hp=self.hp+500
#self.defense=self.defense+70
# self.attck=self.attck+70
def
a
(
self
):
#Hoshiguma = Hero(1,1602,154,221)
self
.
level
=
self
.
level
+
50
#Chen.a()
self
.
hp
=
self
.
hp
+
500
while
true
:
self
.
defense
=
self
.
defense
+
70
def
combat
(
self
,
enemy
):
self
.
attck
=
self
.
attck
+
70
enemy
.
hp
-=
self
.
attck
Chen
=
Hero
(
1
,
1229
,
257
,
249
)
info1
=
self
.
name
+
"的的"
+
enemy
.
name
+
"分工"
Hoshiguma
=
Hero
(
1
,
1602
,
154
,
221
)
info2
=
"造成"
+
str
(
self
.
attack
)
+
"点伤害"
Chen
.
a
()
if
enemy
.
hp
>
0
:
\ No newline at end of file
info3
=
enemy
.
name
+
"还剩下"
+
str
(
enemy
.
hp
)
+
"血量"
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
yase
=
Hero
(
亚瑟
)
houyi
=
Hero
(
后羿
)
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