Commit 73537062 by BellCodeEditor

save project

parent 931d3990
Showing with 20 additions and 5 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 99999999999999999999999999999999 self.attack = 200
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
...@@ -36,9 +37,23 @@ class Player(Hero): ...@@ -36,9 +37,23 @@ class Player(Hero):
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
houyi = Player("射手", "后羿") houyi = Player("刺客", "百里玄策")
yase = Hero("垭瑟") yase = Hero("鲁班七号")
print("_"*35) print("_"*35)
print(" 游戏开始") print(" 游戏开始")
while True: while True:
choice input("1攻击/2治疗") a=input("1攻击/2治疗")
\ No newline at end of file
if a=="1":
houyi.combat(yase)
elif a=="2":
houyi.cure()
elif a=="q":
break
else:
print("jhgjgjg")
num=random.randint(1,3)
if num==1:
yase.combat(houyi)
else:
yase.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