Commit 349bb61c by BellCodeEditor

save project

parent 72002e78
Showing with 12 additions and 5 deletions
...@@ -15,14 +15,16 @@ class Hero: ...@@ -15,14 +15,16 @@ class Hero:
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
else: else:
info3=enemy+'阵亡了。' info3=enemy.name+'阵亡了。'
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
exit() exit()
def cure(self): def cure(self):
self.hp=self.hp+60 self.hp=self.hp+60
if self.hp>self.maxhp: if self.hp>self.maxhp:
self.hp=self.maxhp self.hp=self.maxhp
print(self.name+'已治疗')
...@@ -34,9 +36,14 @@ class Player(Hero): ...@@ -34,9 +36,14 @@ class Player(Hero):
self.maxhp=self.hp self.maxhp=self.hp
self.hero_type=hero_type self.hero_type=hero_type
print('角色'+self.name+'创建成功,英雄类型为:',self.hero_type) print('角色'+self.name+'创建成功,英雄类型为:',self.hero_type)
print('当前等级,血量,攻击力为:',self.level,self.hp,self.att) print('当前等级,血量,攻击力为:',self.level,self.hp,self.attack)
player=Player('后羿') player=Player('后羿','射手')
def cure(self):
bbb=random.randint(30,50)
self.hp=self.hp+bbb
if self.hp>self.maxhp:
self.hp=self.maxhp
print(self.name+'已治疗')
#print(player.attack) #print(player.attack)
...@@ -61,4 +68,4 @@ while True: ...@@ -61,4 +68,4 @@ while True:
if num==1: if num==1:
yase.cure() yase.cure()
else: else:
yas .combat(houyi) yase.combat(houyi)
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