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
7e9f7090
authored
Jul 31, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
40f48897
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
diy1.py
diy1.py
View file @
7e9f7090
...
@@ -6,11 +6,13 @@ class Hero(object):
...
@@ -6,11 +6,13 @@ class Hero(object):
self
.
name
=
name
self
.
name
=
name
def
combat
(
self
,
enemy
):
# 攻击
def
combat
(
self
,
enemy
):
# 攻击
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发动攻
击
"
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发动攻
鸡♂
"
info2
=
"造成"
+
str
(
self
.
attack
)
info2
=
"造成"
+
str
(
self
.
attack
)
if
enemy
.
hp
>
0
:
if
enemy
.
hp
>
0
:
info3
=
enemy
.
name
+
"还剩下"
+
str
(
enemy
.
hp
)
+
"血量"
info3
=
enemy
.
name
+
"还剩下"
+
str
(
enemy
.
hp
)
+
"血量"
info
=
info1
+
info2
+
info3
info4
=
enemy
.
name
+
"说:啊♂(这是受到伤害的痛苦的悲鸣)"
info
=
info1
+
info2
+
info3
+
info4
print
(
info
)
print
(
info
)
else
:
else
:
info3
=
enemy
.
name
+
"嗝屁了,这个弟中之弟"
info3
=
enemy
.
name
+
"嗝屁了,这个弟中之弟"
...
@@ -26,8 +28,8 @@ class Player(Hero):
...
@@ -26,8 +28,8 @@ class Player(Hero):
player
=
Player
(
"VAN"
)
player
=
Player
(
"VAN"
)
print
(
"van♂家的血量为"
,
player
.
hp
)
print
(
"van♂家的血量为"
,
player
.
hp
)
print
(
"van♂家的攻
击
力为"
,
player
.
attack
)
print
(
"van♂家的攻
鸡
力为"
,
player
.
attack
)
muji
=
Hero
(
"木吉"
)
muji
=
Hero
(
"木吉"
)
print
(
"van♂家的血量为"
,
muji
.
hp
)
print
(
"木吉的血量为"
,
muji
.
hp
)
print
(
"van♂家的攻击力为"
,
muji
.
attack
)
print
(
"木吉的攻鸡力为"
,
muji
.
attack
)
\ No newline at end of file
\ 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