Commit bef85d92 by BellCodeEditor

save project

parent 9a581ef4
Showing with 12 additions and 2 deletions
...@@ -6,8 +6,18 @@ class Hero(object): ...@@ -6,8 +6,18 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(): # 攻击 def combat(self,g): # 攻击
??? t1=self.name+'对'+g.name+'发起攻击,'
t2='造成'+str(self.attack)+'点伤害,'
t3=g.name+'还剩下'+str(g.hp-self.attack)+'血量'
t4=g.name+'阵亡,游戏结束'
if g.hp>0:
t=t1+t2+t3
print(t)
else:
t=t1+t2+t4
print(t)
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= 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