Commit 06edd465 by BellCodeEditor

save project

parent 9a581ef4
Showing with 15 additions and 3 deletions
......@@ -3,11 +3,23 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 100
self.name = name
def combat(): # 攻击
???
def combat(gj,bgj): # 攻击
bgj.hp=bgj.hp-gj.attack
#xxx攻击了xxx
info1=str(gj.name)+"攻击了"+str(bgj.name)+"。"
#受到了多少 伤害
info2="打出了"+str(gj.attack)+"伤害,"
#剩余多少血量
info3=str(bgj.name)+"还剩"+str(bgj.hp)+"。"
info=info1+info2+info3
if bgj.hp>0:
print(info)
else:
print(bgj.name+"死了。")
print(bgj.name+"家开席了。")
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