Commit b4413a87 by BellCodeEditor

save project

parent 35b2a0ab
Showing with 24 additions and 16 deletions
class ying:
def __init__(self,name,hp,kill):
def __init__(self,name):
self.name=name
self.hp=hp
self.hp=250
self.ex=1
self.kill=kill
def upgrade(self):
self.ex=self.ex + 1
self.hp=self.hp + 500
self.kill=self.kill + 50
ys=ying("yase",3000,260)
hy=ying("houyi",2300,330)
# print(ys.hp)
# print(hy.kill)
ys.upgrade()
print(ys.hp)
print(ys.kill)
\ No newline at end of file
self.zhandouli=40
#def upgrade(self):
# self.ex=self.ex + 1
# self.hp=self.hp + 500
# self.kill=self.kill + 50
def combat(self,bgj):
infor1=self.name+"对"+bgj.name+"发起进攻,"
infor2="造成"+str(self.zhandouli)+"点伤害"
bgj.hp-=self.zhandouli
if bgj.hp>0:
infor3=bgj.name+"还剩下"+str(bgj.hp)+"血量"
infor=infor1+infor2+infor3
print(infor)
else:
infor3=bgj.name+"阵亡,游戏结束"
infor=infor1+infor2+infor3
print(infor)
exit()
yase=ying("亚瑟")
houyi=ying("后羿")
yase.combat(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