Commit b3fab5f4 by BellCodeEditor

save project

parent aa89a72e
Showing with 15 additions and 15 deletions
class yingxiong:
def __init__(self,name,exp,hp,kun):
def __init__(self,name):
self.exp=1
self.name=name
self.hp=hp
self.kun=kun
def s1(self):
self.exp=self.exp+1
self.hp=self.hp+30
self.kun=self.kun+5
yase=yingxiong('亚瑟',1,200,30 )
houyi=yingxiong('后羿',1,160,35)
yase.s1()
houyi.s1()
print('亚瑟血量=',yase.hp)
print('后羿血量=',houyi.hp)
print('亚瑟攻击=',yase.kun)
print('后羿攻击=',houyi.kun)
self.hp=300
self.kun=50
def ji(self,fyb):
j=self.kun
fyb.hp=fyb.hp-j
if fyb.hp>0:
f=fyb.name+'扣'+str(j)+'血,剩'+str(fyb.hp)+'血'
else:
f=fyb.name+'嗝屁'
print(f)
yase=yingxiong('亚瑟')
fianyibo=yingxiong('范家鸡')
yase.ji(fianyibo)
\ 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