Commit 07ef77a4 by BellCodeEditor

save project

parent 1f18f9fc
Showing with 24 additions and 4 deletions
import random
class Hero: class Hero:
def __init__(self,name,hp,attack,max_hp): def __init__(self,name,hp,attack,max_hp):
self.level = 1 self.level = 1
...@@ -37,9 +38,27 @@ player = Player('后羿','射手') ...@@ -37,9 +38,27 @@ player = Player('后羿','射手')
yase = Hero('亚瑟') yase = Hero('亚瑟')
print('-'*30) print('-'*30)
print(' 战斗开始!') print(' 战斗开始!')
print('-'*30) while True:
a = input('请输入技能(1攻击/2治疗)') print('-'*30)
if a == '1': a = input('请输入技能(1攻击/2治疗)')
if a == 'q':
print('游戏结束')
break
elif a == '1':
player.combat(yase)
elif a == '2':
player.cure()
else:
print('请重新输入')
continue
enmey.choice = random.randint(1,3)
if enmey.choice == '1' :
player.cure()
else:
player.combat(yase)
...@@ -52,4 +71,4 @@ if a == '1': ...@@ -52,4 +71,4 @@ if a == '1':
#self.hp = self.hp+50 #self.hp = self.hp+50
#self.attack = self.attack #self.attack = self.attack
#yase = Hero('亚瑟',300,20) #yase = Hero('亚瑟',300,20)
#yase.upgrade() #yase.upgrade()
\ 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