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
cdd47feb
authored
Feb 07, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
958be2f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
diy1.py
diy1.py
View file @
cdd47feb
...
@@ -17,7 +17,7 @@ class Hero(object):
...
@@ -17,7 +17,7 @@ class Hero(object):
b1
=
self
.
name
+
'对'
+
a
.
name
+
'发起进攻'
b1
=
self
.
name
+
'对'
+
a
.
name
+
'发起进攻'
b2
=
'造成'
+
str
(
self
.
attack
)
+
'点伤害'
b2
=
'造成'
+
str
(
self
.
attack
)
+
'点伤害'
if
a
.
hp
>
0
:
if
a
.
hp
>
0
:
b3
=
a
.
name
+
'还剩'
a
.
hp
+
'的血'
b3
=
a
.
name
+
'还剩'
+
a
.
hp
+
'的血'
b
=
b1
+
b2
+
b3
b
=
b1
+
b2
+
b3
print
(
b
)
print
(
b
)
else
:
else
:
...
@@ -25,7 +25,7 @@ class Hero(object):
...
@@ -25,7 +25,7 @@ class Hero(object):
b
=
b1
+
b2
+
b3
b
=
b1
+
b2
+
b3
print
(
b
)
print
(
b
)
class
Player
(
Hero
)
:
class
Player
(
Hero
)
:
def
__init__
(
self
,
name
,
type
):
def
__init__
(
self
,
name
,
type
):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
self
.
hp
=
200
self
.
hp
=
200
...
@@ -41,4 +41,4 @@ class Player(Hero):
...
@@ -41,4 +41,4 @@ class Player(Hero):
houyi
=
Player
(
'后裔'
,
'射手'
)
houyi
=
Player
(
'后裔'
,
'射手'
)
yase
=
Hero
(
'亚瑟'
)
yase
=
Hero
(
'亚瑟'
)
while
True
:
while
True
:
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