Commit 84e23d2f by BellCodeEditor

save project

parent 3118aa2b
Showing with 18 additions and 4 deletions
...@@ -10,7 +10,14 @@ class Hero(object): ...@@ -10,7 +10,14 @@ class Hero(object):
self.hp=self.hp+60 self.hp=self.hp+60
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):
def combat(self.enermy)
self.hp=self.hp+60
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前",self.hp):
class Player(Hero): class Player(Hero):
def __init__(self,hero_type,name): def __init__(self,hero_type,name):
...@@ -24,5 +31,13 @@ class Player(Hero): ...@@ -24,5 +31,13 @@ class Player(Hero):
houyi = Player("射手", "后羿") houyi = Player("射手", "后羿")
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi.cure() print("_"*30)
yase.cure() input(" 战斗开使")
\ No newline at end of file print("_"*30)
while True:
satute=int(input("请输录指令:1.攻击/2.治疗"))
if satute==1:
houyi.combat(yase)
else:
houyi.cure()
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