Commit 13d13178 by BellCodeEditor

auto save

parent 4179ee1b
Showing with 0 additions and 20 deletions
# 英雄角色类
class Hero:
def __init__(self, name):
self.level = 1
self.hp = 3500
self.attack = 388
self.name = name
def qa(self,w):
w.hp-=self.attack
r=self.name+'对'+w.name+'发起攻击'
e='造成'+str(self.attack)+'真实伤害'
if w.hp < 0:
t=w.name+'阵亡'
else:
t=w.name+'还剩下'+str(w.hp)+'点生命值'
print(r+e+t)
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.qa(houyi)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment