Commit 4ae2f0d0 by BellCodeEditor

save project

parent e47cb26d
Showing with 50 additions and 0 deletions
class Monster():
def __init__(self, name,hp,attack,attack_info,treatment):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
self.attack_info = attack_info
self.treatment = treatment
def combat(self,enemy): # 攻击
enemy.hp -= self.attack
if enemy.hp > 0:
info_1 = self.name + "对" + enemy.name + self.attack_info + ","
info_2 = "造成了" + str(self.attack) + "点伤害,"
info_3 = enemy.name + "还剩下" + str(enemy.hp) + "点血量"
info = info_1 + info_2 + info_3
print(info + "\n" + "-"*20)
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)
exit()
def cure(self): # 治疗
self.hp = self.hp + 60
if self.hp > self.max_hp :
self.hp = self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
def meet(self,enemy):
pass
name = input("取个响亮的名字吧_")
print("你是_" + name + "\n" + "-"*30)
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)
def battle()
print("你遇到了frogy")
print(" 战斗开始")
print("-" * 30)
choice = input("请选择行动方式(A_攻击 /B_治疗)_")
\ 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