Commit f9c943bf by BellCodeEditor

save project

parent fd814013
Showing with 4 additions and 12 deletions
...@@ -12,23 +12,15 @@ class Hero: # 英雄类 ...@@ -12,23 +12,15 @@ class Hero: # 英雄类
info2 = "造成"+str(self.attack)+"点伤害," info2 = "造成"+str(self.attack)+"点伤害,"
enemy.hp -= self.attack enemy.hp -= self.attack
if enemy.hp > 0: if enemy.hp > 0:
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量" info3 = enemy.name+'sheng'+str(enemy.name)+'xue'
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
else: else:
info3 = enemy.name+"阵亡,游戏结束" info3 = enemy.name+'s'
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
exit() exit()
houyi = Hero("后羿")
class Player(Hero): # 玩家英雄
def __init__(self,name):
super().__init__(name)
self.hp = 200
self.attack = 50
self.hero_type = hero_type
print("角色" + self.name + "创建成功,英雄类型为为:",self.hero_type)
print("当前等级、血量、攻击力为:",player.attack)
player = Player("后羿","射手")
yese = Hero("亚瑟") yese = Hero("亚瑟")
yase.combat(houyi)
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