Commit 6457111b by BellCodeEditor

save project

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