Commit c9cbe767 by BellCodeEditor

save project

parent 92a468ca
Showing with 26 additions and 0 deletions
class Hero:
def __init__(self,name):
self.level=1
self.name=name
self.hp=250
self.attack=249
self.name=name
def combat(self,enemy):
enemy.hp-=self.attack
info1=enemy.name+"对"+self.name+"攻击但被反杀。 "
info2=self.name+"对"+enemy.name+"造成"+str(self.attack)+"点伤害"
if enemy.hp>0:
info3=" "+enemy.name+"剩"+str(enemy.hp)+"点血量(我还没死呢!)"
info=info1+info2+info3
print(info)
else:
info3=" "+enemy.name+":啊我死了"
info=info1+info2+info3
print(info)
exit()
yase=Hero("百里玄策")
houyi=Hero("鲁班七号")
yase.combat(houyi)
\ 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