Commit 15dba4ea by BellCodeEditor

save project

parent f4b2ba7f
Showing with 27 additions and 9 deletions
......@@ -6,12 +6,30 @@ class Hero:
self.attack=attack
yase = Hero("垭瑟",300,20)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase = Hero("后羿",240,23)
yase.upgrade()
print("等级为:",yase.level)
print("血量为:",yase.hp)
print("攻击力为:",yase.attack)
#def upgrade(self):
# self.level=self.level+1
# self.hp=self.hp+50
# self.attack=self.attack+4
#yase = Hero("后羿",240,23)
#yase.upgrade()
#print("等级为:",yase.level)
#print("血量为:",yase.hp)
#print("攻击力为:",yase.attack)
del combat(self,enemy):
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
enemy.hp -=selfattack
if enemy.hp > 0:
info3 = emeny.name+"还剩下"+str(enemy.hp)+"血量"
info = info1+info2+info3
print(info)
else:
info3=enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
exit()
yase = Hero("垭瑟")
houyi = Hero("后羿")
yase.combat(houhi)
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