Commit 6457111b by BellCodeEditor

save project

parent f30065ee
Showing with 9 additions and 4 deletions
...@@ -8,7 +8,7 @@ class Hero(object): ...@@ -8,7 +8,7 @@ class Hero(object):
self.max_hp = self.hp self.max_hp = self.hp
def jeremy(self): def jeremy(self):
attack+=10 self.attack+=10
print(self.name+"攻击增加:", 10,",目前的攻击为:",self.attack) print(self.name+"攻击增加:", 10,",目前的攻击为:",self.attack)
def cure(self): # 治疗 def cure(self): # 治疗
self.hp+=55 self.hp+=55
...@@ -49,18 +49,20 @@ class Player(Hero): ...@@ -49,18 +49,20 @@ class Player(Hero):
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
def jeremy(self): def jeremy(self):
attack+=15 self.attack+=15
print(self.name+"攻击增加:", 15,",目前的攻击为:",self.attack) print(self.name+"攻击增加:", 15,",目前的攻击为:",self.attack)
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
while True: while True:
print("-"*30) print("-"*30)
a=input("请选择释放英雄技能(1攻击/2治疗):") a=input("请选择释放英雄技能(1攻击/2治疗/3增强攻击):")
if a=="1": if a=="1":
houyi.combat(yase) houyi.combat(yase)
elif a=="2": elif a=="2":
houyi.cure() houyi.cure()
elif a=="3":
houyi.jeremy()
elif a=="q": elif a=="q":
break break
else: else:
...@@ -69,5 +71,7 @@ while True: ...@@ -69,5 +71,7 @@ while True:
u=random.randint(1,3) u=random.randint(1,3)
if u==1: if u==1:
yase.combat(houyi) yase.combat(houyi)
else : elif u==2 :
yase.cure() yase.cure()
else:
yase.jeremy()
\ 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