Commit 8cdb6686 by BellCodeEditor

save project

parent 1edbbbfd
Showing with 5 additions and 7 deletions
......@@ -9,7 +9,7 @@ class Hero(object):
def combat(self,enemy): # 攻击
enemy.hp = enemy.hp - self.attack
info1 = self.name + "对" + enemy.name + "发起了进攻,"
info2 = "造成了" + str(self.attack) + "点伤,"
info2 = "造成了" + str(self.attack) + "点伤,"
if enemy.hp >0:
info3 = enemy.name + "还剩下" + str(enemy.hp) + "血量"
info = info1+info2+info3
......@@ -21,12 +21,10 @@ class Hero(object):
class player(Hero):
def __init__(self,name):
super().__init__(name)
self.hp = 250
self.attack = 40
self.hp = 200
self.attack = 50
print("角色,"+self.name+"创建成功")
print("角色的,等级,血量,伤害:"+str(self.level)+" "+str(self.hp)+" "+str(self.attack))
yase = Hero("垭瑟")
houyi= player("后羿")
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