Commit 4c887240 by BellCodeEditor

auto save

parent 554eb379
Showing with 4 additions and 4 deletions
...@@ -3,19 +3,19 @@ class Hero(object): ...@@ -3,19 +3,19 @@ class Hero(object):
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 250 self.attack = 50
self.name = name self.name = name
def combat(self,name1): # 攻击 def combat(self,name1): # 攻击
name1.hp-=self.attack name1.hp-=self.attack
xx1=self.name+"对"+name1.name+"发起了进攻" xx1=self.name+"对"+name1.name+"发起了进攻"
xx2="造成了"+str(self.attack)+"点伤害" xx2="造成了"+str(self.attack)+"点伤害"
if name1.hp >0: if name1.hp>0:
xx3=name1.name+"还剩下"+str(name1.hp)+"血量" xx3=name1.name+"还剩下"+str(name1.hp)+"生命"
xx=xx1+xx2+xx3 xx=xx1+xx2+xx3
print(xx) print(xx)
else: else:
xx3=name1.name+"阵亡,游戏结束" xx3=name1.name+"已阵亡"
xx=xx1+xx2+xx3 xx=xx1+xx2+xx3
print(xx) print(xx)
exit() exit()
......
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