Commit d4c7f1b1 by BellCodeEditor

save project

parent 2ec4afcd
Showing with 7 additions and 14 deletions
......@@ -3,15 +3,15 @@ class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = random.randint(100,200)
self.attack = random.randint(50,250)
self.max_hp = self.hp + (self.hp*0.2)
self.hp = 250
self.attack = 40
self.max_hp = self.hp
def cure(self): # 治疗
self.hp = self.hp + (self.hp*2)
self.hp = self.hp + (self.hp*0.5)
if self.hp > self.max_hp:
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:",(self.hp*1.2),",目前的血量为:",self.hp)
print(self.name+"使用了治疗,血量增加:", (self.hp*0.5),",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
......@@ -31,7 +31,7 @@ class Hero(object):
class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
self.hp = 300
self.hp = 200
self.attack = 50
self.max_hp = self.hp
self.hero_type = hero_type
......@@ -59,8 +59,7 @@ while True:
print('游戏结束')
break
else:
print('—'*30)
print('重新输入1/2:')
print('重输!')
continue
b=random.randint(1,3)
if b==3:
......@@ -68,9 +67,3 @@ while True:
else:
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