Commit 8a84fdeb by BellCodeEditor

save project

parent afedde7e
Showing with 6 additions and 1 deletions
...@@ -11,6 +11,11 @@ class Hero(object): ...@@ -11,6 +11,11 @@ class Hero(object):
self.hp = self.hp+60 self.hp = self.hp+60
if self.hp>250: if self.hp>250:
self.hp = self.max_hp self.hp = self.max_hp
def cure2(self): # 治疗
c = random.randint(30,60)
self.hp = self.hp+c
if self.hp>250:
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp) print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击 def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻," info1 = self.name+"对"+enemy.name+"发起进攻,"
...@@ -54,7 +59,7 @@ while True: ...@@ -54,7 +59,7 @@ while True:
continue continue
b = random.randint(1,3) b = random.randint(1,3)
if b == "1": if b == "1":
yase.cure(yase) yase.cure2(yase)
elif b == "2": elif b == "2":
yase.combat(houyi) yase.combat(houyi)
elif b == "q": elif b == "q":
......
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