Commit 744419e8 by BellCodeEditor

save project

parent 5e03b607
Showing with 26 additions and 14 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击
???
class Hero:
def __init__(self,hp,attack,name):
self.HP=hp
self.Attack=attack
self.level=1
self.Name=name
def UpGrade(SB):
SB.level+=1
SB.HP+=300
SB.Attack+=30
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
def ComBot(A,B):
B.HP-=A.Attack
info1=A.Name+"对"+B.Name+"发起进攻"
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