Commit 744419e8 by BellCodeEditor

save project

parent 5e03b607
Showing with 26 additions and 14 deletions
# 英雄角色类 class Hero:
class Hero(object): def __init__(self,hp,attack,name):
def __init__(self, name): self.HP=hp
self.level = 1 self.Attack=attack
self.hp = 250 self.level=1
self.attack = 40 self.Name=name
self.name = name
def UpGrade(SB):
def combat(): # 攻击 SB.level+=1
??? SB.HP+=300
SB.Attack+=30
yase = Hero("垭瑟") def ComBot(A,B):
houyi= Hero("后羿") B.HP-=A.Attack
yase.combat(houyi) info1=A.Name+"对"+B.Name+"发起进攻"
\ No newline at end of file info2=",共造成"+str(A.Attack)+"点伤害"
if B.HP>0:
info3=B.Name+"还剩下"+str(B.HP)+"点生命"
else:
info3=B.Name+"死亡,游戏结束,"+A.Name+"胜利"
print(info1+info2+info3)
exit()
print(info1+info2+info3)
YaSe=Hero(5000,250,"亚瑟")
HouYi=Hero(3000,400,"后羿")
\ 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