Commit 22df11c8 by BellCodeEditor

save project

parent 2bace8ca
Showing with 39 additions and 6 deletions
import random
class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 2000
self.attack = 70
self.attack = 77
self.max_hp = self.hp
def cure(self): # 治疗
self.hp=self.hp+170
self.hp=self.hp+100
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 170,",目前的血量为:",self.hp)
self.hp=self.hp-self.hp
print(self.name+"使用了治疗,血量增加:", 100,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
......@@ -38,4 +39,36 @@ class Player(Hero):
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
houyi.combat(yase)
\ No newline at end of file
#houyi.combat(yase)
#yase.cure()
# houyi.combat(yase)
print("-"*30)
print("战斗开始")
print("-"*30)
while True:
qqq=input("放技能(1攻击2治疗)")
if qqq=="q":
print("你怎么能退出(不要脸--)")
houyi.combat(houyi)
print("让你退出")
houyi.combat(houyi)
houyi.combat(houyi)
houyi.combat(houyi)
#print("成功退出(哈哈哈哈哈哈哈哈哈————————————————————)")
houyi.combat(houyi)
elif qqq=="1":
houyi.combat(yase)
elif qqq=="2" :
houyi.cure()
else:
print("你输什么我不懂")
houyi.combat(houyi)
continue
www=random.randint(1,3)
if www ==1 or 2:
yase.combat(houyi)
elif www==3:
yase.cure()
\ 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