Commit 6450a103 by BellCodeEditor

auto save

parent 75853047
Showing with 13 additions and 9 deletions
...@@ -2,13 +2,13 @@ import random ...@@ -2,13 +2,13 @@ import random
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.level = 1 self.level = 9999999999999999999
self.hp = 260 self.hp = 9999999999999999999999
self.attack = 40 self.attack = 99999999999999999999
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): # 治疗 def cure(self): # 治疗
self.hp+=35 self.hp+=55
if self.hp>self.max_hp: if self.hp>self.max_hp:
self.hp=self.max_hp self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
...@@ -31,8 +31,8 @@ class Hero(object): ...@@ -31,8 +31,8 @@ class Hero(object):
class Player(Hero): class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
super().__init__(name) super().__init__(name)
self.hp = 210 self.hp = 999999999999999999999999
self.attack = 60 self.attack = 999999999999999999999
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)
...@@ -55,11 +55,15 @@ while True: ...@@ -55,11 +55,15 @@ while True:
else: else:
print("重新输入") print("重新输入")
continue continue
b = random.randint(1,2) #b = random.randint(1,2)
if b==1: b = input("你要使用什么技能?(1攻击/2治疗/q退出)")
if b=='1':
yase.combat(houyi) yase.combat(houyi)
if b==2: if b=='2':
yase.cure() yase.cure()
elif a=='q':
print("退出游戏")
exit()
# b = random.randid # b = random.randid
# houyi.combat(yase) # houyi.combat(yase)
# yase.combat(houyi) # 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