Commit fe3afe1c by BellCodeEditor

save project

parent 468f5da5
Showing with 32 additions and 0 deletions
class Hero(odject):
def __init__(selt,name):
selt.level = 1
selt.hp = 250
selt.attack = 40
selt.name = name
def combat(self,enemy):
inof1 = sejf.name+'对'+enemy.name+'发动了攻击'
inof2 = '造成了'+str(self.attack)+'点伤害'
enemy.hp -= self.attack
if enemy.hp > 0:
inof3=enemy.name+'还剩下'+str(enemy.hp)+'点血'
inof=inof1+inof2+inof3
print(inof)
else:
inof3=enemy.name+'已经死亡'
inof=inof1+inof2+inof3
print(inof)
exit()
class Player():
def __init__(self,name):
super().__init__(name)
self.hp=200
self.attack=50
player = Player("后羿")
print("")
print("")
print("")
\ 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