Commit d3c6e04f by BellCodeEditor

save project

parent f762e986
Showing with 18 additions and 9 deletions
......@@ -8,15 +8,24 @@ class Hero:
后羿=Hero('后羿',3900,155)
#print("亚瑟攻击力为:",亚瑟.attack)
#rint("后羿攻击力为:",后羿.attack)
def upgrade(self):
亚瑟.attack=亚瑟.attack+20
亚瑟.level=亚瑟.level+1
亚瑟.hp=亚瑟.hp+200
#def upgrade(self):
#亚瑟.attack=亚瑟.attack+20
#亚瑟.level=亚瑟.level+1
#亚瑟.hp=亚瑟.hp+200
#亚瑟=Hero("亚瑟",4500,130)
#print("当前血量为:",亚瑟.hp)
亚瑟=Hero("亚瑟",4500,130)
亚瑟.upgrade()
print("等级为:",亚瑟.level)
print("血量为:",亚瑟.hp)
print("攻击力为:",亚瑟.attack)
def combat(self,enemy):
enemy-=self.attack
info1=self.name+"对"+enemy.name+"发起进攻,"
info2="造成"+self.attack+"点伤害"
if enemy.hp>0:
info3=enemy.name+"还剩下"+str(enemy.hp)+"点血量。"
info=info1+nifo2+info3
print(info)
else:
info3=self.name+"击杀了"+enemy.name+",游戏胜利。"
info=info1+info2+info3
print(info)
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