Commit 61c492c1 by BellCodeEditor

save project

parent 2d99d122
Showing with 27 additions and 9 deletions
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 = 1
self.hp = 250 self.hp = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.attack = 40 self.attack = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
self.max_hp = self.hp self.max_hp = self.hp
def cure(self): def cure(self):
self.hp = # 治疗 self.hp = self.hp + 9999999999999999999999999999999999999999999999999999999999999999999999999 # 治疗
if self.max_hp > self.hp: if self.max_hp > self.hp:
self.hp = self.hp + 1000000000000000000000000000000000 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): # 普通攻击
...@@ -38,7 +39,24 @@ class Player(Hero): ...@@ -38,7 +39,24 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi.combat(yase) print('_' * 30)
yase.combat(houyi) print(' ghsdghslkgsae ')
houyi.cure() while True :
yase.cure() print('_' * 30)
\ No newline at end of file choice = input('xfgcsetfgewqutgwefjk,1hga,2dsv')
if choice == "q" :
print("retajseghyrszg")
break
elif choice == "1" :
gouge.combat(yase)
elif choice == "2" :
gouge.cure()
else :
print("sagjb,jsafgj0 1 2 ")
continue
#di gong
status = random.randint(1,3)
if status == 1 :
yase.cure()
elif :
yase.combat(houyi)
\ 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