Commit d761c2e0 by BellCodeEditor

save project

parent 2d10b90c
Showing with 20 additions and 24 deletions
def a(): class Hero:
total = [] def __init__(self,name):
while True: self.level = 1
unit=input("请输入:") self.hp = 250
if unit== 'q': self.attack = 40
break self.name = name
else:
try:
a=int(unit)
except:
print("wuejwidjwidjic")
else:
total.append(a)
print("-"*30)
return total
def sum(money):
count=0
for i in money:
count=count+i
return count
def combat(self,enemy):
enemy.hp -= self.attack
info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
if enemy.hp > 0:
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
info = info1+info2+info3
print(info)
else:
info3 = enemy.name+"挂了,game结束"
info = info1+info2+info3
print(info)
exit()
\ No newline at end of file
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