Commit cdb76e0d by BellCodeEditor

save project

parent 9a581ef4
Showing with 7 additions and 3 deletions
......@@ -3,11 +3,15 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 400
self.name = name
def combat(): # 攻击
???
def combat(self,h):
h.hp = h.hp - h.attack
if h.hp > 0:
print(self.name + "对" + h.name + "发起攻击",h.hp)
else:
print(h.name + "血量为0,游戏结束") # 攻击
yase = Hero("垭瑟")
houyi= Hero("后羿")
......
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