Commit dffc6421 by BellCodeEditor

save project

parent f7dc00e8
Showing with 9 additions and 9 deletions
...@@ -39,12 +39,12 @@ class Player(Hero): ...@@ -39,12 +39,12 @@ class Player(Hero):
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
print('-'*30) print('-'*30)
print(' 战斗开始') print(' 战斗开始')
def cure(self): def cure(self):
c=random.randint(35,50) c=random.randint(-999,999)
self.hp+=c self.hp+=c
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
...@@ -52,9 +52,9 @@ while True: ...@@ -52,9 +52,9 @@ while True:
print('-'*30) print('-'*30)
a=input('请输入技能:1攻击/2回复') a=input('请输入技能:1攻击/2回复')
if int(a)==1: if int(a)==1:
yase.combat(yase) houyi.combat(yase)
elif int(a)==2: elif int(a)==2:
yase.cure() houyi.cure()
elif int(a)==q: elif int(a)==q:
break break
else: else:
...@@ -63,7 +63,7 @@ while True: ...@@ -63,7 +63,7 @@ while True:
if b==3: if b==3:
yase.cure() yase.cure()
else: else:
yase.combat(yase) yase.combat(houyi)
......
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