Commit ca4bf8f1 by BellCodeEditor

save project

parent fc1bf962
Showing with 19 additions and 2 deletions
import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -29,8 +30,8 @@ class Hero(object): ...@@ -29,8 +30,8 @@ class Hero(object):
class Player(Hero): class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 2000
self.attack = 50 self.attack = 500
self.max_hp = self.hp self.max_hp = self.hp
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
...@@ -43,3 +44,18 @@ print(" 战斗开始") ...@@ -43,3 +44,18 @@ print(" 战斗开始")
while True: while True:
print("-"*30) print("-"*30)
a=input("请输入指令(1fire/2help):") a=input("请输入指令(1fire/2help):")
if a=="q":
print("die")
exit()
elif a=="1":
houyi.combat(yase)
elif a=="2":
houyi.cure()
else:
print("???")
continue
b=random.randint(1,10)
if b==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