Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from .Magic import Spell
- class Bcolor:
- HEADER = '\033[95m'
- OKBLUE = '\033[94m'
- OKGREEN = '\033[92m'
- WARNING = '\033[93m'
- FAIL = '\033[91m'
- ENDC = '\033[0m'
- BOLD = '\033[1m'
- UNDERLINE = '\033[4m'
- class Person:
- def __init__(self, name, hp, mp, at, df, magic, items):
- self.name = name
- self.maxhp = hp
- self.hp = hp # HP of the player changes throughout the battle
- self.maxmp = mp
- self.mp = mp
- self.al = at-10
- self.ah = at+10
- self.df = df
- self.magic = magic
- self.items = items
- self.actions = ["Attack", "Magic", "Items"]
- def gen_dm(self):
- return random.randrange(self.al, self.ah)
- def take_dm(self, dm):
- self.hp -=dm
- if self.hp < 0:
- self.hp = 0
- return self.hp
- def heal(self, dm):
- self.hp += dm
- if self.hp > self.maxhp:
- self.hp = self.maxhp
- def get_hp(self):
- return self.hp
- def get_maxhp(self):
- return self.maxhp
- def get_mp(self):
- return self.mp
- def get_maxmp(self):
- return self.maxmp
- def reduce_mp(self, cost):
- self.mp -= cost
- def choose_actions(self):
- i = 1
- print("Actions")
- for item in self.actions:
- print(" ", str(i) + ":", item)
- i += 1
- def magic_choice(self):
- print("Magic")
- i = 1
- for Spell in self.magic:
- print(" ", str(i) + ":", Spell.name, " cost : ", Spell.cost)
- i += 1
- def item_choice(self):
- print("Items")
- i = 1
- for item in self.items:
- print(" ", str(i) + ":", item["item"].name, " : ", item["item"].des, "(* " + str(item["quantity"]) + ")")
- i += 1
- def g_s(self):
- print(" _________________________ __________")
- print(Bcolor.BOLD + str(self.name) + str(self.hp) + "/" + str(self.maxhp) +" |" + Bcolor.OKGREEN + "██████████████ " + Bcolor.ENDC + "| " " |" + Bcolor.ENDC + Bcolor.BOLD + str(self.mp) + "/" + str(self.maxmp) + "|" + Bcolor.OKBLUE + "█████████ " + Bcolor.ENDC + "|")
Add Comment
Please, Sign In to add comment