Commit 80d792b3 by BellCodeEditor

save project

parent 0c4f2fed
Showing with 12 additions and 11 deletions
......@@ -17,20 +17,20 @@ class Monster():
info_2 = "造成了" + str(self.attack) + "点伤害,"
info_3 = enemy.name + "还剩下" + str(enemy.hp) + "点血量"
info = info_1 + info_2 + info_3
print(info + "\n" + "-"*20)
print(info)
else:
info_1 = self.name + "对" + enemy.name + self.attack_info + ","
info_2 = "造成了" + str(self.attack) + "点伤害,"
info_3 = enemy.name + "阵亡了"
info = info_1 + info_2 + info_3
print(info + "\n" + "-"*20)
print(info)
exit()
def cure(self): # 治疗
self.hp = self.hp + self.treatment
if self.hp > self.max_hp :
self.hp = self.max_hp
print(self.name+"饮用露珠,血量增加:", 60,",目前的血量为:",self.hp)
print(self.name+"饮用露珠,血量增加:",self.treatment,",目前的血量为:",self.hp, "\n" , "-"*30)
def meet(self,enemy):
pass
......@@ -41,16 +41,16 @@ player = Monster(name,20,3,"挥动拳头",4)
flowey = Monster("flowey",10,2,"射出'友谊颗粒'",2)
frogey = Monster("frogey",8,3,"用舌头弹了一下",3)
print("角色创建成功-" + player.name)
print("角色属性:" + str(player.hp) + " " + str(player.attack) + " " + str(player.treatment) + "(血量 攻击力 治疗值)" + "\n" + "-"*30)
print("输入'exit'来结束游戏")
print("角色属性:" + str(player.hp) + " " + str(player.attack) + " " + str(player.treatment) + "(血量 攻击力 治疗值)")
print("输入'exit'来结束游戏" + "\n" + "-"*30)
def battle(enemy):
print("你遇到了" + enemy.name)
print(" 战斗开始")
print("-" * 30)
while True
while True:
choice = input("请选择行动方式(1_攻击 /2_治疗)_")
if chocie == "exit" :
if choice == "exit" :
print("游戏结束")
exit()
elif choice == "1":
......@@ -58,12 +58,12 @@ def battle(enemy):
elif choice == "2":
player.cure()
else:
print("输入无效!")
print("输入无效!"+ "\n" + "-"*30)
continue
enemy_choice = random.randint(1,2)
if enemy_choice == "1":
a_choice = random.randint(1,2)
if a_choice == 1:
enemy.combat(player)
elif enemy_choice == "2":
elif a_choice == 2:
enemy.cure()
battle(flowey)
\ 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