Commit fa0da134 by BellCodeEditor

save project

parent c1f3e26f
Showing with 11 additions and 3 deletions
...@@ -7,7 +7,14 @@ class Hero(object): ...@@ -7,7 +7,14 @@ class Hero(object):
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.max_hp = self.hp self.max_hp = self.hp
self.gp = 0
self.max_gp = 100
def upgrate(self):
self.gp -= self.max_gp
self.max_gp = self.level*100
self.attack *= 1.2
self.max_hp *= 1.2
def cure(self): # 治疗 def cure(self): # 治疗
if self.hp + 60 > self.max_hp: if self.hp + 60 > self.max_hp:
self.hp = self.max_hp self.hp = self.max_hp
...@@ -36,6 +43,7 @@ class Player(Hero): ...@@ -36,6 +43,7 @@ class Player(Hero):
self.attack = 50 self.attack = 50
self.max_hp = self.hp self.max_hp = self.hp
self.hero_type = hero_type self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type) print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack) print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
...@@ -72,6 +80,6 @@ while True: ...@@ -72,6 +80,6 @@ while True:
print(' --电脑回合--') print(' --电脑回合--')
z = random.randint(1,3) z = random.randint(1,3)
if z <= 2: if z <= 2:
self.combat(houyi) yase.combat(houyi)
else: else:
self.cure() yase.cure()
\ No newline at end of file \ 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