Commit 7bc50fa1 by BellCodeEditor

auto save

parent 1678b832
Showing with 7 additions and 5 deletions
...@@ -2,9 +2,9 @@ import random ...@@ -2,9 +2,9 @@ import random
class Hero: class Hero:
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.level = 1 self.level = 15
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 45
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
...@@ -31,7 +31,7 @@ class Player(Hero): ...@@ -31,7 +31,7 @@ class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 65
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)
...@@ -53,11 +53,13 @@ while True: ...@@ -53,11 +53,13 @@ while True:
houyi.combat(yase) houyi.combat(yase)
elif choice=='2': elif choice=='2':
houyi.cure() houyi.cure()
elif choice=='q':
print('退出游戏')
break
else: else:
print('请重新输入1或2') print('请重新输入1或2')
continue continue
d=random.randint(1,3) d=random.randint(1,2)
if d==1: if d==1:
yase.combat(houyi) yase.combat(houyi)
else: else:
......
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