Commit b4413a87 by BellCodeEditor

save project

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