Commit 1359a703 by BellCodeEditor

save project

parent 1f73b3c5
Showing with 23 additions and 8 deletions
import random
class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.hp = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.attack = 8888888888888888888888888888888888888888888888888888888888888888888888
self.max_hp = self.hp
def cure(self): # 治疗
......@@ -29,15 +30,15 @@ class Hero(object):
class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
self.hp = 999999999999999999999999999999999999999999999999999
self.attack = 50
self.hp = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.attack =88888888888888888888888888888888888888
self.max_hp = self.hp
self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
liyunlong = Player("射手", "李云龙")
huaqiang = Hero("华强")
#houyi.combat(yase)
#yase.combat(houyi)
#houyi.cure()
......@@ -47,4 +48,18 @@ print(' 战斗开始')
while True:
print('_'*30)
choice=input('请选择技能1战斗/2治疗')
\ No newline at end of file
if choice=='q':
print('game over')
break
elif choice=='2':
huaqiang.cure()
elif choice=='1':
huaqiang.combat(liyunlong)
else:
print('输入无效,请重新输入1,2或q')
continue
w=random.randint(1,3)
if w==1:
liyunlong.combat(huaqiang)
else:
liyunlong.cure()
\ 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