Commit fcb71831 by BellCodeEditor

save project

parent 640d805f
Showing with 19 additions and 0 deletions
class Hero:
def __init__(self,name):
self.level=1
self.life=250
self.kill=40
self.name=name
def kill(self,enemy):
info1=self.name+"对"+enemy.name+"发动了攻击"
info2="造成了"+str(self.kill)+"点伤害"
if enemy.life>0:
info3=enemy.name+"还剩"+str(enemy.life)+"点血"
info=info1+info2+info3
print(info)
else:
info3=enemy.name+"被"+self.name+"击杀"
info=info1+info2+info3
print(info)
lufe=Hero("路飞")
\ 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