Commit 0c4f2fed by BellCodeEditor

save project

parent 4ae2f0d0
Showing with 29 additions and 9 deletions
import random
class Monster():
def __init__(self, name,hp,attack,attack_info,treatment):
self.level = 1
self.name = name
self.hp = hp
self.max_hp = self.hp
self.attack = attack
self.attack_info = attack_info
self.treatment = treatment
......@@ -26,10 +27,10 @@ class Monster():
exit()
def cure(self): # 治疗
self.hp = self.hp + 60
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+"饮用露珠,血量增加:", 60,",目前的血量为:",self.hp)
def meet(self,enemy):
pass
......@@ -41,9 +42,28 @@ 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'来结束游戏")
def battle(enemy):
print("你遇到了" + enemy.name)
print(" 战斗开始")
print("-" * 30)
while True
choice = input("请选择行动方式(1_攻击 /2_治疗)_")
if chocie == "exit" :
print("游戏结束")
exit()
elif choice == "1":
player.combat(enemy)
elif choice == "2":
player.cure()
else:
print("输入无效!")
continue
enemy_choice = random.randint(1,2)
if enemy_choice == "1":
enemy.combat(player)
elif enemy_choice == "2":
enemy.cure()
def battle()
print("你遇到了frogy")
print(" 战斗开始")
print("-" * 30)
choice = input("请选择行动方式(A_攻击 /B_治疗)_")
\ No newline at end of file
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