Commit eaccb9e2 by BellCodeEditor

save project

parent 4e6bafc6
Showing with 33 additions and 0 deletions
class Here:
def __init__(self,name):
self.level = 1
self.hp = 250
self.attack = 300
self.name = name
def combat(self,enemy):
infu1 = self.name+'对'+enemy.name+'发起进攻'
infu2 = '造成'+str(self.attack)
enemy.hp -= self.attack
if enemy.hp>0:
infu3 = enemy.name+'还剩'+str(enemy.hp)+'血量'
infu = infu1+infu2+infu3
print(infu)
else:
infu3 = enemy.name +'阵亡'
infu = infu1+infu2+infu3
print(infu)
exit()
class Player(Here):
def __init__(self,name):
super().__init__(name)
self.hp = 200
self.attack = 50
self.hero_type = hero_type
print('角色'+self.name+'成功',self.hero_type)
print('等级,血量,攻击力',self.level,self.hp,self,attack)
player = Player('后裔')
yase = Here('亚瑟')
print('血量',player.hp)
print('攻击力',player.attack)
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