Commit 2def927b by BellCodeEditor

save project

parent dd9332c0
Showing with 15 additions and 2 deletions
...@@ -6,12 +6,25 @@ class Hero(object): ...@@ -6,12 +6,25 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
player("射手" "后羿" ) player("射手" "后羿" )
print(' 开始战斗) print(' 开始战斗')
print("-"*30) print("-"*30)
while True: while True:
print("-"*30) print("-"*30)
choice=input("请选择出招方式:1/攻击,2/治疗") choice=input("请选择出招方式:1/攻击,2/治疗")
if choice =="q":
print("游戏结束")
break
elif choice =="1":
houyi.combat(yase)
elif choice =="2":
houyi.cure()
else:
num=random,randint(1,3)
if num==1:
yase.combat(houyi)
if num==2:
yase.cure()
continue
def cure(self): # 治疗 def cure(self): # 治疗
self.hp+=60 self.hp+=60
if self.hp>self.max_hp: if self.hp>self.max_hp:
......
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