Commit b0bca2d8 by BellCodeEditor

save project

parent 236b0d03
Showing with 18 additions and 9 deletions
# 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~ class Hero:
dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6} def _init_(self,hp,attack,name):
j=input("你要买什么?") self.leve1=1
if j in dict: self.hp=hp
prink('巧克力'(dict[j])) self.attack=attack
self.name=name
else: #def upgrade(self):
prink() # self.leve1=self.leve1+1
\ No newline at end of file # self.hp=self.hp+50
# self.attack=attack+4
def combat(self,enemy):
enemy.hp-= self.attack
info1=self.name+"对"+enemy.name+"发起进攻,"
info2="造成"+str(self.attack)+"点伤害,"
info3=enemy.name+"剩余血量"+str(enemy.hp)+"点"
info=info1+info2+info3
print(into)
\ 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