diff --git a/resources/buttons.json b/resources/buttons.json index c383737..d4d0b28 100644 --- a/resources/buttons.json +++ b/resources/buttons.json @@ -270,6 +270,29 @@ "path": "resources/images/buttons/relationship_list_arrow_r_unavailable.png" } } + }, + "#general_info_tab_button": + { + "prototype": "#image_button", + "images": + { + "normal_image": + { + "path": "resources/images/buttons/general_info.png" + }, + "hovered_image": + { + "path": "resources/images/buttons/general_info_hover.png" + }, + "selected_image": + { + "path": "resources/images/buttons/general_info_hover.png" + }, + "disabled_image": + { + "path": "resources/images/buttons/general_info_selected.png" + } + } } } diff --git a/resources/defaults.json b/resources/defaults.json index d4b26f3..b72d268 100644 --- a/resources/defaults.json +++ b/resources/defaults.json @@ -3,6 +3,7 @@ "colours": { "normal_bg": "#655934", "hovered_bg": "#1E1809", + "dark_bg": "#2e2919", "disabled_bg": "#5C5850", "selected_bg": "#655934", "active_bg": "#655934", @@ -29,5 +30,17 @@ "border_width": "12", "shadow_width": "0" } + }, + "#left_fac_button": { + "misc": { + "text_horiz_alignment_padding": "0", + "text_vert_alignment_padding": "0" + } + }, + "#right_fac_button": { + "misc": { + "text_horiz_alignment_padding": "0", + "text_vert_alignment_padding": "0" + } } } \ No newline at end of file diff --git a/resources/images/buttons/general_info.png b/resources/images/buttons/general_info.png new file mode 100644 index 0000000..d5e5cc1 Binary files /dev/null and b/resources/images/buttons/general_info.png differ diff --git a/resources/images/buttons/general_info_hover.png b/resources/images/buttons/general_info_hover.png new file mode 100644 index 0000000..16112df Binary files /dev/null and b/resources/images/buttons/general_info_hover.png differ diff --git a/resources/images/buttons/general_info_selected.png b/resources/images/buttons/general_info_selected.png new file mode 100644 index 0000000..e30d0ee Binary files /dev/null and b/resources/images/buttons/general_info_selected.png differ diff --git a/resources/text_boxes.json b/resources/text_boxes.json index 49a3072..8821688 100644 --- a/resources/text_boxes.json +++ b/resources/text_boxes.json @@ -105,5 +105,47 @@ "text_horiz_alignment": "center", "text_vert_alignment": "center" } + }, + "#page_number": { + "colours": { + "dark_bg": "#00000000", + "normal_text": "#000000" + }, + "font": { + "name": "notosans", + "regular_path": "resources/fonts/NotoSans-Medium.ttf", + "size": "15" + }, + "misc": { + "border_width": "0", + "shadow_width": "0", + "padding": "0,0", + "text_horiz_alignment": "center", + "text_vert_alignment": "center" + } + }, + "#facet_select_display": { + "colours": { + "dark_bg": "#00000000", + "active_bg": "#00000000", + "normal_text": "#000000", + "text_shadow": "#00000000", + "normal_border": "#776045", + "hovered_border": "#291B0F", + "disabled_border": "#706B64", + "selected_border": "#776045", + "active_border": "#776045" + }, + "font": { + "name": "notosans", + "regular_path": "resources/fonts/NotoSans-Medium.ttf", + "size": "15" + }, + "misc": { + "border_width": "0", + "shadow_width": "0", + "padding": "5,0", + "text_horiz_alignment": "center" + } } } \ No newline at end of file diff --git a/scripts/cat/appearance_utility.py b/scripts/cat/appearance_utility.py deleted file mode 100644 index 9148573..0000000 --- a/scripts/cat/appearance_utility.py +++ /dev/null @@ -1,164 +0,0 @@ -import random -from .pelts import * -from scripts.cat.sprites import Sprites -import scripts.global_vars as global_vars - -# ---------------------------------------------------------------------------- # -# init functions # -# ---------------------------------------------------------------------------- # - - -def randomize_eyes(cat): - cat.eye_colour2 = None - - cat.eye_colour = choice(list(global_vars.eye_colors.keys())) - - cat.eye_colour2 = None - hit = randint(0, 6) - if hit == 0: - cat.eye_colour2 = choice(list(global_vars.eye_colors.keys())) - - -def randomize_pelt(cat, change_fur_length=True): - # ------------------------------------------------------------------------------------------------------------# - # PELT - # ------------------------------------------------------------------------------------------------------------# - - # Determine pelt. - chosen_pelt = choice(list(global_vars.pelt_options.keys())) - - # Tortie chance - torbie = random.getrandbits(2) == 1 - - chosen_tortie_base = cat.tortiebase - if torbie: - # If it is tortie, the chosen pelt above becomes the base pelt. - chosen_tortie_base = chosen_pelt - if chosen_tortie_base in ["SingleColour"]: - chosen_tortie_base = "Single" - chosen_tortie_base = chosen_tortie_base.lower() - chosen_pelt = "Tortie" - - # ------------------------------------------------------------------------------------------------------------# - # PELT COLOUR - # ------------------------------------------------------------------------------------------------------------# - - chosen_pelt_color = choice(list(global_vars.colors.keys())) - - # ------------------------------------------------------------------------------------------------------------# - # PELT LENGTH - # ------------------------------------------------------------------------------------------------------------# - - if change_fur_length: - chosen_pelt_length = random.choice(["long", "short"]) - else: - chosen_pelt_length = cat.pelt.length - - # ------------------------------------------------------------------------------------------------------------# - # PELT WHITE - # ------------------------------------------------------------------------------------------------------------# - - chosen_white = random.randint(1, 100) <= 40 - - # Adjustments to pelt chosen based on if the pelt has white in it or not. - - cat.pelt = choose_pelt(chosen_pelt_color, chosen_white, chosen_pelt, chosen_pelt_length) - cat.tortiebase = chosen_tortie_base # This will be none if the cat isn't a tortie. - -def randomize_sprite(cat): - cat.current_poses = { - 'newborn': "1", - 'kitten': choice(["1", "2", "3"]), - 'adolescent': choice(["1", "2", "3"]), - 'senior': choice(["1", "2", "3"]), - 'adult': choice(["1", "2", "3"]), - } - - cat.not_working = bool(random.getrandbits(1)) - cat.paralyzed = bool(random.getrandbits(1)) - - # Set sprite numbers. - for x in cat.cat_sprites: - cat.cat_sprites[x] = global_vars.poses[cat.pelt.length][x][cat.current_poses[x]] - - if cat.pelt is not None: - if cat.pelt.length != 'long': - cat.cat_sprites['adult'] = randint(6, 8) - else: - cat.cat_sprites['adult'] = randint(0, 2) - - cat.reverse = choice([True, False]) - - # skin chances - cat.skin = choice(list(global_vars.skin_colors.keys())) - - -def randomize_platform(cat): - cat.platform = choice(list(global_vars.platforms.keys())) - - -def randomize_scars(cat): - - cat.scar_slot_list = [ - None, - None, - None, - None, - ] - - scar_number = random.choices([0,1,2,3,4], weights=[50, 20, 15, 10, 5], k=1)[0] - - i = 0 - all_scars = list(global_vars.scars.keys()) - while True: - if i >= scar_number: - break - if all_scars: - add_scar = choice(all_scars) - cat.scar_slot_list[i] = add_scar - all_scars.remove(add_scar) - i += 1 - - if 'NOTAIL' in cat.scars and 'HALFTAIL' in cat.scars: - for ele in range(len(cat.scar_slot_list)): - if cat.scar_slot_list[ele] == 'HALFTAIL': - cat.scar_slot_list[ele] = None - - -def randomize_accessories(cat): - acc_display_choice = randint(0, 2) - if acc_display_choice == 1: - cat.accessory = choice(list(global_vars.accessories.keys())) - else: - cat.accessory = None - - -def randomize_pattern(cat): - - if cat.pelt.name in torties: - cat.tortiepattern = choice(list(global_vars.tortie_patches_patterns.keys())) - cat.pattern = choice(list(global_vars.tortie_patches_shapes.keys())) - cat.tortiecolour = choice(list(global_vars.colors.keys())) - - -def randomize_white_patches(cat): - - chosen_white_patches = choice(list(global_vars.white_patches.keys())) - cat.white_patches = chosen_white_patches - - if random.random() > 0.5: - cat.points = choice(list(global_vars.points.keys())) - else: - cat.points = None - - if random.random() > 0.9: - cat.vitiligo = choice(list(global_vars.vit.keys())) - else: - cat.vitiligo = None - - - -def randomize_tint(cat): - # Basic tints as possible for all colors. - cat.tint = choice(list(global_vars.tints.keys())) - cat.white_patches_tint = choice(list(global_vars.white_patches_tint.keys())) diff --git a/scripts/cat/cats.py b/scripts/cat/cats.py index a91f638..6cc4d75 100644 --- a/scripts/cat/cats.py +++ b/scripts/cat/cats.py @@ -2,9 +2,9 @@ from random import choice, randint, sample import os.path -import scripts.cat.appearance_utility as util from scripts.utility import * from scripts.game_structure.game_essentials import * +from scripts.cat.pelts import Pelt @@ -18,28 +18,9 @@ def __init__(self): # Public attributes self.age = "adult" - self.pelt = SingleColour("WHITE", "short") - self.tint = "none" - self.eye_colour = "BLUE" - self.eye_colour2 = None - self.scars = [] - self.scar_slot_list = [ - None, - None, - None, - None - ] + self.pelt = Pelt() self.dead = False self.df = False - self.tortiebase = "single" - self.pattern = "ONE" - self.tortiepattern = "single" - self.tortiecolour = "GINGER" - self.white_patches = None - self.points = None - self.vitiligo = None - self.white_patches_tint = "none" - self.accessory = None self.shading = False self.cat_sprites = { "newborn": 20, @@ -48,62 +29,25 @@ def __init__(self): "adult": 8, "senior": 12, } - self.paralyzed = False - self.not_working = False - self.current_poses = { - "newborn": "1", - "kitten": "1", - "adolescent": "1", - "adult": "3", - "senior": "1", - } self.platform = "None" - # Helpers: - self.stored_eye_color_2 = "BLUE" - - self.opacity = 100 - self.reverse = False - self.skin = "BLACK" - - # Unused + # Used only for export + self.ID = "2" self.gender = "female" - self.skill = None - self.trait = None - self.parent1 = None - self.parent2 = None + self.gender_align = "female" + self.status = "warrior" + self.skill = "???" + self.trait = "troublesome" + self.backstory = "clan_founder" + self.moons = 0 # Sprite sizes self.sprite = None def randomize_looks(self, just_pattern=False): - - if not just_pattern: - self.age = choice(["newborn", "kitten", "adult", "adolescent", "senior"]) - util.randomize_sprite(self) - util.randomize_scars(self) - util.randomize_accessories(self) - util.randomize_platform(self) - lineart = choice(["Star", "Normal", "DF"]) - if lineart == "Star": - self.dead = True - self.df = False - elif lineart == "Normal": - self.dead = False - self.df = False - elif lineart == "DF": - self.dead = True - self.df = True - - self.shading = choice([True, False]) - - util.randomize_pelt(self, change_fur_length=not just_pattern) - util.randomize_eyes(self) - util.randomize_white_patches(self) - util.randomize_pattern(self) - util.randomize_tint(self) - + self.age = random.choice(list(self.pelt.current_poses.keys())) + self.pelt.randomize_pelt() def generate_large_image(self): return @@ -117,16 +61,16 @@ def generate_save_file(self): pelt_name = "Calico" save = { - "ID": "1", + "ID": self.ID, "name_prefix": "Prefix", "name_suffix": "Suffix", - "gender": "female", - "gender_align": "female", + "gender": self.gender, + "gender_align": self.gender_align, "birth_cooldown": 0, - "status": "warrior", - "backstory": "clan_founder", + "status": self.status, + "backstory": self.backstory, "age": self.age, - "moons": 30, + "moons": self.moons, "trait": "wise", "parent1": None, "parent2": None, @@ -137,7 +81,7 @@ def generate_save_file(self): "mate": None, "dead": False, "died_by": [], - "paralyzed": False, + "paralyzed": self.paralyzed, "no_kits": False, "exiled": False, "pelt_name": pelt_name, @@ -164,7 +108,7 @@ def generate_save_file(self): "tortie_pattern": self.tortiepattern if self.pelt.name == "Tortie" else None, "skin": self.skin, "tint": self.tint, - "skill": "great hunter", + "skill": self.skill, "scars": [x for x in self.scar_slot_list if x], "accessory": self.accessory, "experience": 0, diff --git a/scripts/cat/pelts.py b/scripts/cat/pelts.py index 398f4c4..4121088 100644 --- a/scripts/cat/pelts.py +++ b/scripts/cat/pelts.py @@ -1,513 +1,492 @@ -from random import choice, randint - - -class SingleColour(): - name = "SingleColour" - sprites = {1: 'single'} - white_patches = None - - def __init__(self, colour, length): - self.colour = colour - self.length = length - self.white = self.colour == "white" - - def __repr__(self): - return self.colour + self.length - -class Tabby(): - name = "Tabby" - sprites = {1: 'tabby', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and {self.colour}{self.length} tabby" - else: - return self.colour + self.length + " tabby" - -class Marbled(): - name = "Marbled" - sprites = {1: 'marbled', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and {self.colour}{self.length} marbled" - else: - return self.colour + self.length + " marbled" - -class Rosette(): - name = "Rosette" - sprites = {1: 'rosette', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and {self.colour}{self.length} rosette" - else: - return self.colour + self.length + " rosette" - -class Smoke(): - name = "Smoke" - sprites = {1: 'smoke', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and {self.colour}{self.length} smoke" - else: - return self.colour + self.length + " smoke" - -class Ticked(): - name = "Ticked" - sprites = {1: 'ticked', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and {self.colour}{self.length} ticked" - else: - return self.colour + self.length + " ticked" - -class Speckled(): - name = "Speckled" - sprites = {1: 'speckled', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} speckled{self.length}" - else: - return f"{self.colour} speckled{self.length}" - -class Bengal(): - name = "Bengal" - sprites = {1: 'bengal', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} bengal{self.length}" - else: - return f"{self.colour} bengal{self.length}" - -class Mackerel(): - name = "Mackerel" - sprites = {1: 'mackerel', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} mackerel tabby{self.length}" - else: - return f"{self.colour} mackerel tabby{self.length}" - -class Classic(): - name = "Classic" - sprites = {1: 'classic', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} classic tabby{self.length}" - else: - return f"{self.colour} classic tabby{self.length}" - -class Sokoke(): - name = "Sokoke" - sprites = {1: 'sokoke', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} sokoke tabby{self.length}" - else: - return f"{self.colour} sokoke tabby{self.length}" - -class Agouti(): - name = "Agouti" - sprites = {1: 'agouti', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} agouti{self.length}" - else: - return f"{self.colour} agouti{self.length}" - -class Singlestripe(): - name = "Singlestripe" - sprites = {1: 'singlestripe', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no - self.colour = colour - self.length = length - def __repr__(self): - if self.white: - return f"white and {self.colour} singlestripe{self.length}" - else: - return f"{self.colour} singlestripe{self.length}" - -class Tortie(): - name = "Tortie" - sprites = {1: 'tortie', 2: 'white'} - - def __init__(self, colour, white, length): - self.white = white # boolean; does cat have white on it or no +from random import choice +from scripts.cat.sprites import Sprites +import random +from re import sub +from scripts.game_structure.game_essentials import game +import scripts.global_vars as global_vars + + + + +class Pelt(): + + sprites_names = { + "SingleColour": 'single', + 'TwoColour': 'single', + 'Tabby': 'tabby', + 'Marbled': 'marbled', + 'Rosette': 'rosette', + 'Smoke': 'smoke', + 'Ticked': 'ticked', + 'Speckled': 'speckled', + 'Bengal': 'bengal', + 'Mackerel': 'mackerel', + 'Classic': 'classic', + 'Sokoke': 'sokoke', + 'Agouti': 'agouti', + 'Singlestripe': 'singlestripe', + 'Tortie': None, + 'Calico': None, + } + + # ATTRIBUTES, including non-pelt related + pelt_colours = [ + 'WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK', 'CREAM', 'PALEGINGER', + 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA', 'LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', + 'CHOCOLATE' + ] + pelt_c_no_white = [ + 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK', 'CREAM', 'PALEGINGER', + 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA', 'LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', + 'CHOCOLATE' + ] + pelt_c_no_bw = [ + 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'CREAM', 'PALEGINGER', + 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA', 'LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', + 'CHOCOLATE' + ] + + tortiepatterns = ['ONE', 'TWO', 'THREE', 'FOUR', 'REDTAIL', 'DELILAH', 'MINIMALONE', 'MINIMALTWO', 'MINIMALTHREE', 'MINIMALFOUR', 'HALF', + 'OREO', 'SWOOP', 'MOTTLED', 'SIDEMASK', 'EYEDOT', 'BANDANA', 'PACMAN', 'STREAMSTRIKE', 'ORIOLE', 'CHIMERA', 'DAUB', 'EMBER', 'BLANKET', + 'ROBIN', 'BRINDLE', 'PAIGE', 'ROSETAIL', 'SAFI', 'SMUDGED', 'DAPPLENIGHT', 'STREAK', 'MASK', 'CHEST', 'ARMTAIL'] + tortiebases = ['single', 'tabby', 'bengal', 'marbled', 'ticked', 'smoke', 'rosette', 'speckled', 'mackerel', + 'classic', 'sokoke', 'agouti', 'singlestripe'] + + pelt_length = ["short", "medium", "long"] + eye_colours = ['YELLOW', 'AMBER', 'HAZEL', 'PALEGREEN', 'GREEN', 'BLUE', 'DARKBLUE', 'GREY', 'CYAN', 'EMERALD', 'PALEBLUE', + 'PALEYELLOW', 'GOLD', 'HEATHERBLUE', 'COPPER', 'SAGE', 'COBALT', 'SUNLITICE', 'GREENYELLOW', 'BRONZE', 'SILVER'] + yellow_eyes = ['YELLOW', 'AMBER', 'PALEYELLOW', 'GOLD', 'COPPER', 'GREENYELLOW', 'BRONZE', 'SILVER'] + blue_eyes = ['BLUE', 'DARKBLUE', 'CYAN', 'PALEBLUE', 'HEATHERBLUE', 'COBALT', 'SUNLITICE', 'GREY'] + green_eyes = ['PALEGREEN', 'GREEN', 'EMERALD', 'SAGE', 'HAZEL'] + # scars1 is scars from other cats, other animals - scars2 is missing parts - scars3 is "special" scars that could only happen in a special event + # bite scars by @wood pank on discord + scars1 = ["ONE", "TWO", "THREE", "TAILSCAR", "SNOUT", "CHEEK", "SIDE", "THROAT", "TAILBASE", "BELLY", + "LEGBITE", "NECKBITE", "FACE", "MANLEG", "BRIGHTHEART", "MANTAIL", "BRIDGE", "RIGHTBLIND", "LEFTBLIND", + "BOTHBLIND", "BEAKCHEEK", "BEAKLOWER", "CATBITE", "RATBITE", "QUILLCHUNK", "QUILLSCRATCH"] + scars2 = ["LEFTEAR", "RIGHTEAR", "NOTAIL", "HALFTAIL", "NOPAW", "NOLEFTEAR", "NORIGHTEAR", "NOEAR"] + scars3 = ["SNAKE", "TOETRAP", "BURNPAWS", "BURNTAIL", "BURNBELLY", "BURNRUMP", "FROSTFACE", "FROSTTAIL", "FROSTMITT", + "FROSTSOCK", ] + + # make sure to add plural and singular forms of new accs to acc_display.json so that they will display nicely + plant_accessories = ["MAPLE LEAF", "HOLLY", "BLUE BERRIES", "FORGET ME NOTS", "RYE STALK", "LAUREL", + "BLUEBELLS", "NETTLE", "POPPY", "LAVENDER", "HERBS", "PETALS", "DRY HERBS", + "OAK LEAVES", "CATMINT", "MAPLE SEED", "JUNIPER" + ] + wild_accessories = ["RED FEATHERS", "BLUE FEATHERS", "JAY FEATHERS", "MOTH WINGS", "CICADA WINGS" + ] + tail_accessories = ["RED FEATHERS", "BLUE FEATHERS", "JAY FEATHERS"] + collars = [ + "CRIMSON", "BLUE", "YELLOW", "CYAN", "RED", "LIME", "GREEN", "RAINBOW", + "BLACK", "SPIKES", "WHITE", "PINK", "PURPLE", "MULTI", "INDIGO", "CRIMSONBELL", "BLUEBELL", + "YELLOWBELL", "CYANBELL", "REDBELL", "LIMEBELL", "GREENBELL", + "RAINBOWBELL", "BLACKBELL", "SPIKESBELL", "WHITEBELL", "PINKBELL", "PURPLEBELL", + "MULTIBELL", "INDIGOBELL", "CRIMSONBOW", "BLUEBOW", "YELLOWBOW", "CYANBOW", "REDBOW", + "LIMEBOW", "GREENBOW", "RAINBOWBOW", "BLACKBOW", "SPIKESBOW", "WHITEBOW", "PINKBOW", + "PURPLEBOW", "MULTIBOW", "INDIGOBOW", "CRIMSONNYLON", "BLUENYLON", "YELLOWNYLON", "CYANNYLON", + "REDNYLON", "LIMENYLON", "GREENNYLON", "RAINBOWNYLON", + "BLACKNYLON", "SPIKESNYLON", "WHITENYLON", "PINKNYLON", "PURPLENYLON", "MULTINYLON", "INDIGONYLON", + ] + + tabbies = ["Tabby", "Ticked", "Mackerel", "Classic", "Sokoke", "Agouti"] + spotted = ["Speckled", "Rosette"] + plain = ["SingleColour", "TwoColour", "Smoke", "Singlestripe"] + exotic = ["Bengal", "Marbled"] + torties = ["Tortie", "Calico"] + pelt_categories = [tabbies, spotted, plain, exotic, torties] + + # SPRITE NAMES + single_colours = [ + 'WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK', 'CREAM', 'PALEGINGER', + 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA', 'LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', + 'CHOCOLATE' + ] + ginger_colours = ['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA'] + black_colours = ['GREY', 'DARKGREY', 'GHOST', 'BLACK'] + white_colours = ['WHITE', 'PALEGREY', 'SILVER'] + brown_colours = ['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE'] + colour_categories = [ginger_colours, black_colours, white_colours, brown_colours] + eye_sprites = [ + 'YELLOW', 'AMBER', 'HAZEL', 'PALEGREEN', 'GREEN', 'BLUE', 'DARKBLUE', 'BLUEYELLOW', 'BLUEGREEN', + 'GREY', 'CYAN', 'EMERALD', 'PALEBLUE', 'PALEYELLOW', 'GOLD', 'HEATHERBLUE', 'COPPER', 'SAGE', 'COBALT', + 'SUNLITICE', 'GREENYELLOW', 'BRONZE', 'SILVER' + ] + little_white = ['LITTLE', 'LIGHTTUXEDO', 'BUZZARDFANG', 'TIP', 'BLAZE', 'BIB', 'VEE', 'PAWS', + 'BELLY', 'TAILTIP', 'TOES', 'BROKENBLAZE', 'LILTWO', 'SCOURGE', 'TOESTAIL', 'RAVENPAW', 'HONEY', 'LUNA', + 'EXTRA'] + mid_white = ['TUXEDO', 'FANCY', 'UNDERS', 'DAMIEN', 'SKUNK', 'MITAINE', 'SQUEAKS', 'STAR', 'WINGS', + 'DIVA', 'SAVANNAH', 'FADESPOTS', 'BEARD', 'DAPPLEPAW', 'TOPCOVER', 'WOODPECKER', 'MISS'] + high_white = ['ANY', 'ANYTWO', 'BROKEN', 'FRECKLES', 'RINGTAIL', 'HALFFACE', 'PANTSTWO', + 'GOATEE', 'PRINCE', 'FAROFA', 'MISTER', 'PANTS', 'REVERSEPANTS', 'HALFWHITE', 'APPALOOSA', 'PIEBALD', + 'CURVED', 'GLASS', 'MASKMANTLE', 'MAO', 'PAINTED', 'SHIBAINU', 'OWL'] + mostly_white = ['VAN', 'ONEEAR', 'LIGHTSONG', 'TAIL', 'HEART', 'MOORISH', 'APRON', 'CAPSADDLE', + 'CHESTSPECK', 'BLACKSTAR', 'PETAL', 'HEARTTWO','PEBBLESHINE', 'BOOTS', 'COW', 'COWTWO'] + point_markings = ['COLOURPOINT', 'RAGDOLL', 'SEPIAPOINT', 'MINKPOINT', 'SEALPOINT'] + vit = ['VITILIGO', 'VITILIGOTWO', 'MOON', 'PHANTOM', 'KARPATI', 'POWDER', 'BLEACHED'] + white_sprites = [ + little_white, mid_white, high_white, mostly_white, point_markings, vit, 'FULLWHITE'] + + skin_sprites = ['BLACK', 'PINK', 'DARKBROWN', 'BROWN', 'LIGHTBROWN', 'DARK', 'DARKGREY', 'GREY', 'DARKSALMON', + 'SALMON', 'PEACH', 'DARKMARBLED', 'MARBLED', 'LIGHTMARBLED', 'DARKBLUE', 'BLUE', 'LIGHTBLUE', 'RED'] + + """Holds all appearence information for a cat. """ + def __init__(self, + name:str="SingleColour", + length:str="short", + colour:str="WHITE", + white_patches:str=None, + eye_color:str="BLUE", + eye_colour2:str=None, + tortiebase:str=None, + tortiecolour:str="GINGER", + pattern:str="ONE", + tortiepattern:str="single", + vitiligo:str=None, + points:str=None, + accessory:str=None, + paralyzed:bool=False, + opacity:int=100, + scars:list=None, + tint:str="none", + skin:str="BLACK", + white_patches_tint:str="none", + kitten_sprite:int=None, + adol_sprite:int=None, + adult_sprite:int=None, + senior_sprite:int=None, + para_adult_sprite:int=None, + reverse:bool=False, + ) -> None: + self.name = name self.colour = colour - self.length = length - - def __repr__(self): - if self.white: - return f"white and tortoiseshell{self.length}" - else: - return f"tortoiseshell{self.length}" - - -# ATTRIBUTES, including non-pelt related -pelt_colours = [ - 'WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'PALEGINGER', - 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM', 'LIGHTBROWN', 'BROWN', 'DARKBROWN', - 'BLACK' -] -pelt_c_no_white = [ - 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'PALEGINGER', 'GOLDEN', - 'GINGER', 'DARKGINGER', 'CREAM', 'LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK' -] -pelt_c_no_bw = [ - 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'PALEGINGER', 'GOLDEN', 'GINGER', - 'DARKGINGER', 'CREAM', 'LIGHTBROWN', 'BROWN', 'DARKBROWN' -] - -tortiepatterns = ['ONE', 'TWO', 'THREE', 'FOUR', 'REDTAIL', 'DELILAH', 'MINIMAL1', 'MINIMAL2', 'MINIMAL3', 'MINIMAL4', - 'OREO', 'SWOOP', 'MOTTLED', 'SIDEMASK', 'EYEDOT', 'BANDANA', 'PACMAN', 'STREAMSTRIKE', 'ORIOLE', - 'ROBIN', 'BRINDLE', 'PAIGE'] -tortiebases = ['single', 'tabby', 'bengal', 'marbled', 'ticked', 'smoke', 'rosette', 'speckled', 'mackerel', - 'classic', 'sokoke', 'agouti', 'singlestripe'] - -pelt_length = ["short", "medium", "long"] -eye_colours = ['YELLOW', 'AMBER', 'HAZEL', 'PALEGREEN', 'GREEN', 'BLUE', 'DARKBLUE', 'GREY', 'CYAN', 'EMERALD', - 'PALEBLUE', - 'PALEYELLOW', 'GOLD', 'HEATHERBLUE', 'COPPER', 'SAGE', 'BLUE2', 'SUNLITICE', 'GREENYELLOW'] -yellow_eyes = ['YELLOW', 'AMBER', 'PALEYELLOW', 'GOLD', 'COPPER', 'GREENYELLOW'] -blue_eyes = ['BLUE', 'DARKBLUE', 'CYAN', 'PALEBLUE', 'HEATHERBLUE', 'BLUE2', 'SUNLITICE', 'GREY'] -green_eyes = ['PALEGREEN', 'GREEN', 'EMERALD', 'SAGE', 'HAZEL'] -# scars1 is scars from other cats, other animals - scars2 is missing parts - scars3 is "special" scars that could only happen in a special event -# bite scars by @wood pank on discord -scars1 = ["ONE", "TWO", "THREE", "TAILSCAR", "SNOUT", "CHEEK", "SIDE", "THROAT", "TAILBASE", "BELLY", - "LEGBITE", "NECKBITE", "FACE", "MANLEG", "BRIGHTHEART", "MANTAIL", "BRIDGE", "RIGHTBLIND", "LEFTBLIND", - "BOTHBLIND", "BEAKCHEEK", "BEAKLOWER", "CATBITE", "RATBITE", "QUILLCHUNK", "QUILLSCRATCH"] -scars2 = ["LEFTEAR", "RIGHTEAR", "NOTAIL", "HALFTAIL", "NOPAW", "NOLEFTEAR", "NORIGHTEAR", "NOEAR"] -scars3 = ["SNAKE", "TOETRAP", "BURNPAWS", "BURNTAIL", "BURNBELLY", "BURNRUMP", "FROSTFACE", "FROSTTAIL", "FROSTMITT", - "FROSTSOCK", ] - -plant_accessories = ["MAPLE LEAF", "HOLLY", "BLUE BERRIES", "FORGET ME NOTS", "RYE STALK", "LAUREL", - "BLUEBELLS", "NETTLE", "POPPY", "LAVENDER", "HERBS", "PETALS", "DRY HERBS", - "OAK LEAVES", "CATMINT", "MAPLE SEED", "JUNIPER" - ] -wild_accessories = ["RED FEATHERS", "BLUE FEATHERS", "JAY FEATHERS", "MOTH WINGS", "CICADA WINGS" - ] -tail_accessories = ["RED FEATHERS", "BLUE FEATHERS", "JAY FEATHERS"] -collars = [ - "CRIMSON", "BLUE", "YELLOW", "CYAN", "RED", "LIME", "GREEN", "RAINBOW", - "BLACK", "SPIKES", "WHITE", "PINK", "PURPLE", "MULTI", "INDIGO", "CRIMSONBELL", "BLUEBELL", - "YELLOWBELL", "CYANBELL", "REDBELL", "LIMEBELL", "GREENBELL", - "RAINBOWBELL", "BLACKBELL", "SPIKESBELL", "WHITEBELL", "PINKBELL", "PURPLEBELL", - "MULTIBELL", "INDIGOBELL", "CRIMSONBOW", "BLUEBOW", "YELLOWBOW", "CYANBOW", "REDBOW", - "LIMEBOW", "GREENBOW", "RAINBOWBOW", "BLACKBOW", "SPIKESBOW", "WHITEBOW", "PINKBOW", - "PURPLEBOW", "MULTIBOW", "INDIGOBOW", "CRIMSONNYLON", "BLUENYLON", "YELLOWNYLON", "CYANNYLON", - "REDNYLON", "LIMENYLON", "GREENNYLON", "RAINBOWNYLON", - "BLACKNYLON", "SPIKESNYLON", "WHITENYLON", "PINKNYLON", "PURPLENYLON", "MULTINYLON", "INDIGONYLON", -] - -tabbies = ["Tabby", "Ticked", "Mackerel", "Classic", "Sokoke", "Agouti"] -spotted = ["Speckled", "Rosette"] -plain = ["SingleColour", "TwoColour", "Smoke", "Singlestripe"] -exotic = ["Bengal", "Marbled"] -torties = ["Tortie", "Calico"] -pelt_categories = [tabbies, spotted, plain, exotic, torties] - -# SPRITE NAMES -single_colours = [ - 'WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'PALEGINGER', - 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM', 'LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK' -] -ginger_colours = ['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM'] -black_colours = ['GREY', 'DARKGREY', 'GHOST', 'BLACK'] -white_colours = ['WHITE', 'PALEGREY', 'SILVER'] -brown_colours = ['LIGHTBROWN', 'BROWN', 'DARKBROWN'] -colour_categories = [ginger_colours, black_colours, white_colours, brown_colours] -eye_sprites = [ - 'YELLOW', 'AMBER', 'HAZEL', 'PALEGREEN', 'GREEN', 'BLUE', 'DARKBLUE', 'BLUEYELLOW', 'BLUEGREEN', - 'GREY', 'CYAN', 'EMERALD', 'PALEBLUE', 'PALEYELLOW', 'GOLD', 'HEATHERBLUE', 'COPPER', 'SAGE', 'BLUE2', - 'SUNLITICE', 'GREENYELLOW' -] -little_white = ['LITTLE', 'LIGHTTUXEDO', 'BUZZARDFANG', 'TIP', 'BLAZE', 'BIB', 'VEE', 'PAWS', - 'BELLY', 'TAILTIP', 'TOES', 'BROKENBLAZE', 'LILTWO', 'SCOURGE', 'TOESTAIL', 'RAVENPAW', 'HONEY', 'LUNA', - 'EXTRA'] -mid_white = ['TUXEDO', 'FANCY', 'UNDERS', 'DAMIEN', 'SKUNK', 'MITAINE', 'SQUEAKS', 'STAR', - 'WINGS'] -high_white = ['ANY', 'ANY2', 'BROKEN', 'FRECKLES', 'RINGTAIL', 'HALFFACE', 'PANTS2', - 'GOATEE', 'PRINCE', 'FAROFA', 'MISTER', 'PANTS', 'REVERSEPANTS', 'HALFWHITE', 'APPALOOSA', 'PIEBALD', - 'CURVED', 'GLASS', 'MASKMANTLE', 'MAO', 'PAINTED'] -mostly_white = ['VAN', 'ONEEAR', 'LIGHTSONG', 'TAIL', 'HEART', 'MOORISH', 'APRON', 'CAPSADDLE', - 'CHESTSPECK', 'BLACKSTAR'] -point_markings = ['COLOURPOINT', 'RAGDOLL', 'KARPATI', 'SEPIAPOINT', 'MINKPOINT', - 'SEALPOINT'] -vit = ['VITILIGO', 'VITILIGO2'] -white_sprites = [ - little_white, mid_white, high_white, mostly_white, point_markings, vit, 'FULLWHITE'] - -skin_sprites = ['BLACK', 'RED', 'PINK', 'DARKBROWN', 'BROWN', 'LIGHTBROWN', 'DARK', 'DARKGREY', 'GREY', 'DARKSALMON', - 'SALMON', 'PEACH', 'DARKMARBLED', 'MARBLED', 'LIGHTMARBLED', 'DARKBLUE', 'BLUE', 'LIGHTBLUE'] - - - -# CHOOSING PELT -def choose_pelt(colour=None, white=None, pelt=None, length=None, category=None, determined=False): - colour = colour - white = white - pelt = pelt - length = length - category = category - if pelt is None: - if category != None: - pelt = choice(category) - else: - pelt = pelt - if length is None: - length = choice(pelt_length) - if pelt == 'SingleColour': - if colour is None and not white: - return SingleColour(choice(pelt_colours), length) - elif colour is None: - return SingleColour("WHITE", length) - else: - return SingleColour(colour, length) - elif pelt == 'TwoColour': - if colour is None: - return TwoColour(choice(pelt_c_no_white), length) - else: - return TwoColour(colour, length) - elif pelt == 'Tabby': - if colour is None and white is None: - return Tabby(choice(pelt_colours), choice([False, True]), length) - elif colour is None: - return Tabby(choice(pelt_colours), white, length) - else: - return Tabby(colour, white, length) - elif pelt == 'Marbled': - if colour is None and white is None: - return Marbled(choice(pelt_colours), choice([False, True]), length) - elif colour is None: - return Marbled(choice(pelt_colours), white, length) - else: - return Marbled(colour, white, length) - elif pelt == 'Rosette': - if colour is None and white is None: - return Rosette(choice(pelt_colours), choice([False, True]), length) - elif colour is None: - return Rosette(choice(pelt_colours), white, length) - else: - return Rosette(colour, white, length) - elif pelt == 'Smoke': - if colour is None and white is None: - return Smoke(choice(pelt_colours), choice([False, True]), length) - elif colour is None: - return Smoke(choice(pelt_colours), white, length) + self.white_patches = white_patches + self.eye_colour = eye_color + self.eye_colour2 = eye_colour2 + self.tortiebase = tortiebase + self.pattern = pattern + self.tortiepattern = tortiepattern + self.tortiecolour = tortiecolour + self.vitiligo = vitiligo + self.length=length + self.points = points + self.accessory = accessory + self.paralyzed = paralyzed + self.opacity = opacity + self.scar_slot_list = [ + None, + None, + None, + None + ] + self.tint = tint + self.white_patches_tint = white_patches_tint + self.cat_sprites = { + "kitten": kitten_sprite if kitten_sprite is not None else 0, + "adolescent": adol_sprite if adol_sprite is not None else 3, + "young adult": adult_sprite if adult_sprite is not None else 8, + "adult": adult_sprite if adult_sprite is not None else 8, + "senior adult": adult_sprite if adult_sprite is not None else 8, + "senior": senior_sprite if senior_sprite is not None else 12, + } + self.cat_sprites['newborn'] = 20 + self.cat_sprites['para_young'] = 17 + self.cat_sprites["sick_adult"] = 18 + self.cat_sprites["sick_young"] = 19 + + + self.current_poses = { + "newborn": "1", + "kitten": "1", + "adolescent": "1", + "adult": "3", + "senior": "1", + } + self.not_working = False + self.stored_eye_color_2 = "BLUE" + + self.reverse = reverse + self.skin = skin + + def randomize_pelt(self): + + self.init_pattern_color() + self.init_white_patches() + self.init_pose() + self.init_scars() + self.init_accessories() + self.init_eyes() + self.init_pattern() + self.init_tint() + + self.paralyzed = choice([True, False]) + self.not_working = choice([True, False]) + + #-------------------------------------------------------------------------------------------------# + # Setter Functions # + #-------------------------------------------------------------------------------------------------# + + def set_pose(self, age, pose): + """Sets the pose, updating cat_sprites """ + if not pose: + return + + if age in ["young adult", "adult", "senior adult"]: + for inter_age in ["young adult", "adult", "senior adult"]: + self.cat_sprites[inter_age] = global_vars.poses[ + self.length]["adult"][pose] + + # Adjust tracked poses. + self.current_poses["adult"] = pose else: - return Smoke(colour, white, length) - elif pelt == 'Ticked': - if colour is None and white is None: - return Ticked(choice(pelt_colours), choice([False, True]), length) - elif colour is None: - return Ticked(choice(pelt_colours), white, length) + # Change the sprite number. + self.cat_sprites[age] = global_vars.poses[ + self.length][age][pose] + + # Adjust tracked poses. + self.current_poses[age] = pose + + def set_pelt_length(self, fur_length): + if fur_length not in ["short", "long"]: + return + + self.length = fur_length + + # Update the sprite numbers: + for age in self.current_poses: + self.set_pose(age, self.current_poses[age]) + + #-------------------------------------------------------------------------------------------------# + # Randomize Functions # + #-------------------------------------------------------------------------------------------------# + + def init_eyes(self): + + self.eye_colour = choice(list(global_vars.eye_colors.keys())) + + if not random.randint(0, 4): + self.eye_colour2 = choice(list(global_vars.eye_colors.keys())) else: - return Ticked(colour, white, length) - elif pelt == 'Speckled': - if colour is None and white is None: - return Speckled(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Speckled(choice(pelt_colours), white, length) + self.eye_colour2 = None + + + def init_pattern_color(self) -> bool: + """Inits self.name, self.colour, self.length, + self.tortiebase """ + + self.name = random.choice(list(global_vars.pelt_options.keys()) + ["Tortie"]) + self.tortiebase = random.choice(list(global_vars.tortie_patches_patterns.keys())) + self.colour = random.choice(list(global_vars.colors.keys())) + self.length = random.choice(["short", "long"]) + self.skin = choice(list(global_vars.skin_colors.keys())) + + def init_pose(self): + + poses = ["1", "2", "3"] + for age in self.current_poses: + self.set_pose(age, random.choice(poses)) + + self.reverse = choice([True, False]) + + def init_scars(self): + self.scar_slot_list = [ + None, + None, + None, + None + ] + + for i in range(0, len(self.scar_slot_list)): + if random.randint(0, 1): + self.scar_slot_list[i] = random.choice(list(global_vars.scars.keys())) + + def init_accessories(self): + + self.accessory = random.choice(list(global_vars.accessories.keys())) + + def init_pattern(self): + + self.pattern = random.choice(list(global_vars.tortie_patches_shapes.keys())) + self.tortiecolour = random.choice(list(global_vars.colors.keys())) + self.tortiepattern = random.choice(list(global_vars.tortie_patches_patterns.keys())) + + def init_white_patches(self): + + self.white_patches = choice(list(global_vars.white_patches.keys())) + + if random.random() > 0.5: + self.points = choice(list(global_vars.points.keys())) else: - return Speckled(colour, white, length) - elif pelt == 'Bengal': - if colour is None and white is None: - return Bengal(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Bengal(choice(pelt_colours), white, length) + self.points = None + + if random.random() > 0.9: + self.vitiligo = choice(list(global_vars.vit.keys())) else: - return Bengal(colour, white, length) - elif pelt == 'Mackerel': - if colour is None and white is None: - return Mackerel(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Mackerel(choice(pelt_colours), white, length) + self.vitiligo = None + + + def init_tint(self): + """Sets tint for pelt and white patches""" + + self.tint = choice(list(global_vars.tints.keys())) + self.white_patches_tint = choice(list(global_vars.white_patches_tint.keys())) + + @property + def white(self): + return self.white_patches or self.points + + @white.setter + def white(self, val): + print("Can't set pelt.white") + return + + @staticmethod + def describe_appearance(cat, short=False): + + # Define look-up dictionaries + if short: + renamed_colors = { + "white": "pale", + "palegrey": "gray", + "darkgrey": "gray", + "grey": "gray", + "paleginger": "ginger", + "darkginger": "ginger", + "sienna": "ginger", + "lightbrown": "brown", + "lilac": "brown", + "golden-brown": "brown", + "darkbrown": "brown", + "chocolate": "brown", + "ghost": "black" + } else: - return Mackerel(colour, white, length) - elif pelt == 'Classic': - if colour is None and white is None: - return Classic(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Classic(choice(pelt_colours), white, length) - else: - return Classic(colour, white, length) - elif pelt == 'Sokoke': - if colour is None and white is None: - return Sokoke(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Sokoke(choice(pelt_colours), white, length) - else: - return Sokoke(colour, white, length) - elif pelt == 'Agouti': - if colour is None and white is None: - return Agouti(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Agouti(choice(pelt_colours), white, length) - else: - return Agouti(colour, white, length) - elif pelt == 'Singlestripe': - if colour is None and white is None: - return Singlestripe(choice(pelt_colours), choice([False, True]), - length) - elif colour is None: - return Singlestripe(choice(pelt_colours), white, length) - else: - return Singlestripe(colour, white, length) - elif pelt == 'Tortie': - if white is None: - return Tortie(colour, choice([False, True]), length) - else: - return Tortie(colour, white, length) - else: - return Calico(colour, length) - -def describe_color(pelt, tortiecolour, tortiepattern, white_patches): - color_name = '' - color_name = str(pelt.colour).lower() - if tortiecolour is not None: - color_name = str(tortiecolour).lower() - if color_name == 'palegrey': - color_name = 'pale grey' - elif color_name == 'darkgrey': - color_name = 'dark grey' - elif color_name == 'paleginger': - color_name = 'pale ginger' - elif color_name == 'darkginger': - color_name = 'dark ginger' - elif color_name == 'lightbrown': - color_name = 'light brown' - elif color_name == 'darkbrown': - color_name = 'dark brown' - if pelt.name == "Tabby": - color_name = color_name + ' tabby' - elif pelt.name == "Speckled": - color_name = color_name + ' speckled' - elif pelt.name == "Bengal": - color_name = color_name + ' bengal' - elif pelt.name == "Marbled": - color_name = color_name + ' marbled tabby' - elif pelt.name == "Rosette": - color_name = color_name + ' rosetted' - elif pelt.name == "Ticked": - color_name = color_name + ' ticked tabby' - elif pelt.name == "Smoke": - color_name = color_name + ' smoke' - elif pelt.name == "Mackerel": - color_name = color_name + ' mackerel tabby' - elif pelt.name == "Classic": - color_name = color_name + ' classic tabby' - elif pelt.name == "Sokoke": - color_name = color_name + ' sokoke tabby' - elif pelt.name == "Agouti": - color_name = color_name + ' agouti' - elif pelt.name == "Singlestripe": - color_name = color_name + ', with a dorsal stripe,' - - elif pelt.name == "Tortie": - if tortiepattern not in ["tortiesolid", "tortiesmoke"]: - color_name = color_name + ' torbie' + renamed_colors = { + "white": "pale", + "palegrey": "pale gray", + "grey": "gray", + "darkgrey": "dark gray", + "paleginger": "pale ginger", + "darkginger": "dark ginger", + "sienna": "dark ginger", + "lightbrown": "light brown", + "lilac": "light brown", + "golden-brown": "golden brown", + "darkbrown": "dark brown", + "chocolate": "dark brown", + "ghost": "black" + } + + pattern_des = { + "Tabby": "c_n tabby", + "Speckled": "speckled c_n", + "Bengal": "unusually dappled c_n", + "Marbled": "c_n tabby", + "Ticked": "c_n ticked", + "Smoke": "c_n smoke", + "Mackerel": "c_n tabby", + "Classic": "c_n tabby", + "Agouti": "c_n tabby", + "Singlestripe": "dorsal-striped c_n", + "Rosette": "unusually spotted c_n", + "Sokoke": "c_n tabby" + } + + # Start with determining the base color name. + color_name = str(cat.pelt.colour).lower() + if color_name in renamed_colors: + color_name = renamed_colors[color_name] + + # Replace "white" with "pale" if the cat is + if cat.pelt.name not in ["SingleColour", "TwoColour", "Tortie", "Calico"] and color_name == "white": + color_name = "pale" + + # Time to descibe the pattern and any additional colors. + if cat.pelt.name in pattern_des: + color_name = pattern_des[cat.pelt.name].replace("c_n", color_name) + elif cat.pelt.name in Pelt.torties: + # Calicos and Torties need their own desciptions. + if short: + # If using short, don't add describe the colors of calicos and torties. Just call them calico, tortie, or mottled. + # If using short, don't describe the colors of calicos and torties. Just call them calico, tortie, or mottled. + if cat.pelt.colour in Pelt.black_colours + Pelt.brown_colours + Pelt.white_colours and \ + cat.pelt.tortiecolour in Pelt.black_colours + Pelt.brown_colours + Pelt.white_colours: + color_name = "mottled" + else: + color_name = cat.pelt.name.lower() else: - color_name = color_name + ' tortie' - elif pelt.name == "Calico": - if tortiepattern not in ["tortiesolid", "tortiesmoke"]: - color_name = color_name + ' tabico' - else: - color_name = color_name + ' calico' - # enough to comment but not make calico - if white_patches is not None: - if white_patches in little_white + mid_white: - color_name = color_name + ' and white' - # and white - elif white_patches in high_white: - if pelt.name != "Calico": - color_name = color_name + ' and white' - # white and - elif white_patches in mostly_white: - color_name = 'white and ' + color_name - # colorpoint - elif white_patches in point_markings: - color_name = color_name + ' point' - if color_name == 'dark ginger point' or color_name == 'ginger point': - color_name = 'flame point' - # vitiligo - elif white_patches in vit: - color_name = color_name + ' with vitiligo' + base = cat.pelt.tortiebase.lower() + if base in Pelt.tabbies + ['bengal', 'rosette', 'speckled']: + base = 'tabby' + else: + base = '' + + patches_color = cat.pelt.tortiecolour.lower() + if patches_color in renamed_colors: + patches_color = renamed_colors[patches_color] + color_name = f"{color_name}/{patches_color}" + + if cat.pelt.colour in Pelt.black_colours + Pelt.brown_colours + Pelt.white_colours and \ + cat.pelt.tortiecolour in Pelt.black_colours + Pelt.brown_colours + Pelt.white_colours: + color_name = f"{color_name} mottled" + else: + color_name = f"{color_name} {cat.pelt.name.lower()}" + + if cat.pelt.white_patches: + if cat.pelt.white_patches == "FULLWHITE": + # If the cat is fullwhite, discard all other information. They are just white. + color_name = "white" + if cat.pelt.white_patches in Pelt.mostly_white and cat.pelt.name != "Calico": + color_name = f"white and {color_name}" + elif cat.pelt.name != "Calico": + color_name = f"{color_name} and white" + + if cat.pelt.points: + color_name = f"{color_name} point" + if "ginger point" in color_name: + color_name.replace("ginger point", "flame point") + + if "white and white" in color_name: + color_name = color_name.replace("white and white", "white") + + # Now it's time for gender + if cat.genderalign in ["female", "trans female"]: + color_name = f"{color_name} she-cat" + elif cat.genderalign in ["male", "trans male"]: + color_name = f"{color_name} tom" else: - color_name = color_name - - if color_name == 'tortie': - color_name = 'tortoiseshell' - - if white_patches == 'FULLWHITE': - color_name = 'white' - - if color_name == 'white and white': - color_name = 'white' + color_name = f"{color_name} cat" + + # Here is the place where we can add some additional details about the cat, for the full non-short one. + # These include notable missing limbs, vitiligo, long-furred-ness, and 3 or more scars. + if not short: + + scar_details = { + "NOTAIL": "no tail", + "HALFTAIL": "half a tail", + "NOPAW": "three legs", + "NOLEFTEAR": "a missing ear", + "NORIGHTEAR": "a missing ear", + "NOEAR": "no ears" + } + + additional_details = [] + if cat.pelt.vitiligo: + additional_details.append("vitiligo") + for scar in cat.pelt.scars: + if scar in scar_details and scar_details[scar] not in additional_details: + additional_details.append(scar_details[scar]) + + if len(additional_details) > 1: + color_name = f"{color_name} with {', '.join(additional_details[:-1])} and {additional_details[-1]}" + elif additional_details: + color_name = f"{color_name} with {additional_details[0]}" + + + if len(cat.pelt.scars) >= 3: + color_name = f"scarred {color_name}" + if cat.pelt.length == "long": + color_name = f"long-furred {color_name}" return color_name + + def get_sprites_name(self): + return Pelt.sprites_names[self.name] diff --git a/scripts/cat/sprites.py b/scripts/cat/sprites.py index 90a05c3..de71773 100644 --- a/scripts/cat/sprites.py +++ b/scripts/cat/sprites.py @@ -1,10 +1,8 @@ import pygame -try: - import ujson -except ImportError: - import json as ujson +import ujson +from scripts.game_structure.game_essentials import game class Sprites(): cat_tints = {} @@ -32,7 +30,7 @@ def load_tints(self): Sprites.white_patches_tints = ujson.loads(read_file.read()) except: print("ERROR: Reading White Patches Tints") - + def spritesheet(self, a_file, name): """ Add spritesheet called name from a_file. @@ -179,8 +177,24 @@ def load_scars(self): for a, i in enumerate(["PINKNYLON", "PURPLENYLON", "MULTINYLON", "INDIGONYLON"]): sprites.make_group('nyloncollars', (a, 2), f'collars{i}') +# get the width and height of the spritesheet +lineart = pygame.image.load('sprites/lineart.png') +width, height = lineart.get_size() +del lineart # unneeded + +# if anyone changes lineart for whatever reason update this +if width / 3 == height / 7: + spriteSize = width / 3 +else: + spriteSize = 50 # default, what base clangen uses + print(f"lineart.png is not 3x7, falling back to {spriteSize}") + print(f"if you are a modder, please update scripts/cat/sprites.py and do a search for 'if width / 3 == height / 7:'") + +del width, height # unneeded + -sprites = Sprites(50) +# i am sorry for merge conflicts, modders :fadeaway: +sprites = Sprites(spriteSize) #tiles = Sprites(64) for x in [ @@ -223,131 +237,134 @@ def load_scars(self): # white patches for a, i in enumerate(['FULLWHITE', 'ANY', 'TUXEDO', 'LITTLE', 'COLOURPOINT', 'VAN', 'ANYTWO', - 'MOON', 'PHANTOM', 'POWDER']): + 'MOON', 'PHANTOM', 'POWDER', 'BLEACHED', 'SAVANNAH', 'FADESPOTS', 'PEBBLESHINE']): sprites.make_group('whitepatches', (a, 0), f'white{i}') for a, i in enumerate(['EXTRA', 'ONEEAR', 'BROKEN', 'LIGHTTUXEDO', 'BUZZARDFANG', 'RAGDOLL', - 'LIGHTSONG', 'VITILIGO', 'BLACKSTAR', 'PIEBALD', 'CURVED', 'PETAL']): + 'LIGHTSONG', 'VITILIGO', 'BLACKSTAR', 'PIEBALD', 'CURVED', 'PETAL', 'SHIBAINU', 'OWL']): sprites.make_group('whitepatches', (a, 1), f'white{i}') # ryos white patches for a, i in enumerate(['TIP', 'FANCY', 'FRECKLES', 'RINGTAIL', 'HALFFACE', 'PANTSTWO', 'GOATEE', 'VITILIGOTWO', - 'PAWS', 'MITAINE', 'BROKENBLAZE', 'SCOURGE']): + 'PAWS', 'MITAINE', 'BROKENBLAZE', 'SCOURGE', 'DIVA', 'BEARD']): sprites.make_group('whitepatches', (a, 2), f'white{i}') for a, i in enumerate(['TAIL', 'BLAZE', 'PRINCE', 'BIB', 'VEE', 'UNDERS', 'HONEY', - 'FAROFA', 'DAMIEN', 'MISTER', 'BELLY', 'TAILTIP', 'TOES']): + 'FAROFA', 'DAMIEN', 'MISTER', 'BELLY', 'TAILTIP', 'TOES', 'TOPCOVER']): sprites.make_group('whitepatches', (a, 3), f'white{i}') for a, i in enumerate( ['APRON', 'CAPSADDLE', 'MASKMANTLE', 'SQUEAKS', 'STAR', 'TOESTAIL', 'RAVENPAW', - 'PANTS', 'REVERSEPANTS', 'SKUNK', 'KARPATI', 'HALFWHITE', 'APPALOOSA']): + 'PANTS', 'REVERSEPANTS', 'SKUNK', 'KARPATI', 'HALFWHITE', 'APPALOOSA', 'DAPPLEPAW']): sprites.make_group('whitepatches', (a, 4), f'white{i}') # beejeans white patches + perrio's point marks, painted, and heart2 + anju's new marks + key's blackstar for a, i in enumerate(['HEART', 'LILTWO', 'GLASS', 'MOORISH', 'SEPIAPOINT', 'MINKPOINT', 'SEALPOINT', - 'MAO', 'LUNA', 'CHESTSPECK', 'WINGS', 'PAINTED', 'HEARTTWO']): - sprites.make_group('whitepatches', (a, 5), 'white' + i) + 'MAO', 'LUNA', 'CHESTSPECK', 'WINGS', 'PAINTED', 'HEARTTWO', 'WOODPECKER']): + sprites.make_group('whitepatches', (a, 5), f'white{i}') +# acorn's woodpecker, boots, miss, cow and cow2 +for a, i in enumerate(['BOOTS', 'MISS', 'COW', 'COWTWO', 'BUB']): + sprites.make_group('whitepatches', (a, 6), 'white' + i) # single (solid) -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('singlecolours', (a, 0), f'single{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('singlecolours', (a, 1), f'single{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('singlecolours', (a, 2), f'single{i}') # tabby -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('tabbycolours', (a, 0), f'tabby{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('tabbycolours', (a, 1), f'tabby{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('tabbycolours', (a, 2), f'tabby{i}') # marbled -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('marbledcolours', (a, 0), f'marbled{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('marbledcolours', (a, 1), f'marbled{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('marbledcolours', (a, 2), f'marbled{i}') # rosette -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('rosettecolours', (a, 0), f'rosette{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('rosettecolours', (a, 1), f'rosette{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('rosettecolours', (a, 2), f'rosette{i}') # smoke -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('smokecolours', (a, 0), f'smoke{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('smokecolours', (a, 1), f'smoke{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('smokecolours', (a, 2), f'smoke{i}') # ticked -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('tickedcolours', (a, 0), f'ticked{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('tickedcolours', (a, 1), f'ticked{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('tickedcolours', (a, 2), f'ticked{i}') # speckled -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('speckledcolours', (a, 0), f'speckled{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('speckledcolours', (a, 1), f'speckled{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('speckledcolours', (a, 2), f'speckled{i}') # bengal -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('bengalcolours', (a, 0), f'bengal{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('bengalcolours', (a, 1), f'bengal{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('bengalcolours', (a, 2), f'bengal{i}') # mackerel -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('mackerelcolours', (a, 0), f'mackerel{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('mackerelcolours', (a, 1), f'mackerel{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('mackerelcolours', (a, 2), f'mackerel{i}') # classic -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('classiccolours', (a, 0), f'classic{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('classiccolours', (a, 1), f'classic{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('classiccolours', (a, 2), f'classic{i}') # sokoke -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('sokokecolours', (a, 0), f'sokoke{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('sokokecolours', (a, 1), f'sokoke{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('sokokecolours', (a, 2), f'sokoke{i}') # agouti -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('agouticolours', (a, 0), f'agouti{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('agouticolours', (a, 1), f'agouti{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('agouticolours', (a, 2), f'agouti{i}') # singlestripe -for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST']): +for a, i in enumerate(['WHITE', 'PALEGREY', 'SILVER', 'GREY', 'DARKGREY', 'GHOST', 'BLACK']): sprites.make_group('singlestripecolours', (a, 0), f'singlestripe{i}') -for a, i in enumerate(['PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'CREAM']): +for a, i in enumerate(['CREAM', 'PALEGINGER', 'GOLDEN', 'GINGER', 'DARKGINGER', 'SIENNA']): sprites.make_group('singlestripecolours', (a, 1), f'singlestripe{i}') -for a, i in enumerate(['LIGHTBROWN', 'BROWN', 'DARKBROWN', 'BLACK']): +for a, i in enumerate(['LIGHTBROWN', 'LILAC', 'BROWN', 'GOLDEN-BROWN', 'DARKBROWN', 'CHOCOLATE']): sprites.make_group('singlestripecolours', (a, 2), f'singlestripe{i}') # new new torties -for a, i in enumerate(['ONE', 'TWO', 'THREE', 'FOUR', 'REDTAIL', 'DELILAH']): +for a, i in enumerate(['ONE', 'TWO', 'THREE', 'FOUR', 'REDTAIL', 'DELILAH', 'HALF', 'STREAK', 'MASK']): sprites.make_group('tortiepatchesmasks', (a, 0), f"tortiemask{i}") -for a, i in enumerate(['MINIMALONE', 'MINIMALTWO', 'MINIMALTHREE', 'MINIMALFOUR', 'OREO', 'SWOOP']): +for a, i in enumerate(['MINIMALONE', 'MINIMALTWO', 'MINIMALTHREE', 'MINIMALFOUR', 'OREO', 'SWOOP', 'CHIMERA', 'CHEST', 'ARMTAIL']): sprites.make_group('tortiepatchesmasks', (a, 1), f"tortiemask{i}") -for a, i in enumerate(['MOTTLED', 'SIDEMASK', 'EYEDOT', 'BANDANA', 'PACMAN', 'STREAMSTRIKE']): +for a, i in enumerate(['MOTTLED', 'SIDEMASK', 'EYEDOT', 'BANDANA', 'PACMAN', 'STREAMSTRIKE', 'SMUDGED', 'DAUB', 'EMBER']): sprites.make_group('tortiepatchesmasks', (a, 2), f"tortiemask{i}") -for a, i in enumerate(['ORIOLE', 'ROBIN', 'BRINDLE', 'PAIGE']): +for a, i in enumerate(['ORIOLE', 'ROBIN', 'BRINDLE', 'PAIGE', 'ROSETAIL', 'SAFI', 'DAPPLENIGHT', 'BLANKET']): sprites.make_group('tortiepatchesmasks', (a, 3), f"tortiemask{i}") # SKINS -for a, i in enumerate(['BLACK', 'RED', 'PINK', 'DARKBROWN', 'BROWN', 'LIGHTBROWN']): +for a, i in enumerate(['BLACK', 'PINK', 'DARKBROWN', 'BROWN', 'LIGHTBROWN', "RED"]): sprites.make_group('skin', (a, 0), f"skin{i}") for a, i in enumerate(['DARK', 'DARKGREY', 'GREY', 'DARKSALMON', 'SALMON', 'PEACH']): sprites.make_group('skin', (a, 1), f"skin{i}") diff --git a/scripts/game_structure/image_button.py b/scripts/game_structure/image_button.py index 2f869e4..6508d40 100644 --- a/scripts/game_structure/image_button.py +++ b/scripts/game_structure/image_button.py @@ -1,10 +1,15 @@ +from typing import Dict, Optional, Tuple, Union import pygame import pygame_gui +from pygame_gui.core.interfaces import IContainerLikeInterface, IUIManagerInterface from pygame_gui.core.text.html_parser import HTMLParser from pygame_gui.core.text.text_box_layout import TextBoxLayout +from pygame_gui.core.ui_element import UIElement from pygame_gui.core.utility import translate import scripts.game_structure.image_cache as image_cache import html +from pygame_gui.core import UIElement +from pygame_gui.core import ObjectID class UIImageButton(pygame_gui.elements.UIButton): @@ -63,7 +68,116 @@ def _set_any_images_from_theme(self): return changed - +class UIFacetSelect(UIElement): + """ Hacked together element for two arrow bars that change the center displayed value. + Allows you to set and change an allowed range. + Using it for facet selection. """ + + def __init__(self, + relative_rect, + current_value, + allowed_range, + manager = None, + container = None, + object_id = None): + + self.button_container = None + + super().__init__(relative_rect, manager, container, + layer_thickness=2, + starting_height=1) + + self._create_valid_ids(container=container, + parent_element=None, + object_id=object_id, + element_id="facet_select") + + self.background_rect = relative_rect + + self.button_container = pygame_gui.core.UIContainer(self.background_rect, + manager=self.ui_manager, + container=self.ui_container, + anchors=self.anchors, + object_id=None, + visible=self.visible) + + self.button_width = 25 + self.low_bound = allowed_range[0] + self.high_bound = allowed_range[1] + self.current_value = current_value if self.low_bound <= current_value <= self.high_bound \ + else allowed_range[0] + + self.display = pygame_gui.elements.UITextBox("", pygame.Rect((self.button_width, 0), + (self.background_rect.width - 2*self.button_width, self.background_rect.height)), + manager=self.ui_manager, + visible=self.visible, + container=self.button_container, + object_id="#facet_select_display") + self.left_button = pygame_gui.elements.UIButton(pygame.Rect((0, 0), + (self.button_width, self.background_rect.height)), + 'â—€', self.ui_manager, + container=self.button_container, + object_id=ObjectID("#left_fac_button", "@arrow_button"), + starting_height=1, + anchors={'left': 'left', + 'right': 'left', + 'top': 'top', + 'bottom': 'bottom'}, + visible=self.visible) + self.right_button = pygame_gui.elements.UIButton(pygame.Rect((-self.button_width, 0), + (self.button_width, self.background_rect.height)), + 'â–¶', self.ui_manager, + container=self.button_container, + starting_height=1, + object_id=ObjectID("#right_fac_button", "@arrow_button"), + anchors={'left': 'right', + 'right': 'right', + 'top': 'top', + 'bottom': 'bottom'}, + visible=self.visible) + + self.set_current_value(self.current_value) + + def process_event(self, event) -> bool: + processed_event = False + if event.type == pygame_gui.UI_BUTTON_PRESSED: + if event.ui_element == self.left_button and self.low_bound < self.current_value: + new_value = self.current_value - 1 + self.set_current_value(new_value) + self.processed_event = True + elif event.ui_element == self.right_button and self.high_bound > self.current_value: + new_value = self.current_value + 1 + self.set_current_value(new_value) + self.processed_event = True + + return processed_event + + def set_current_value(self, new_value:int): + if not (self.low_bound <= new_value <= self.high_bound): + return + + self.current_value = new_value + self.display.set_text(str(self.current_value)) + self._update_disabled_buttons() + + def update_allowed_range(self, new_range): + self.low_bound = new_range[0] + self.high_bound = new_range[1] + + if not (self.low_bound <= self.current_value <= self.high_bound): + self.set_current_value(self.low_bound) + + def _update_disabled_buttons(self): + if self.current_value <= self.low_bound: + self.left_button.disable() + else: + self.left_button.enable() + + if self.current_value >= self.high_bound: + self.right_button.disable() + else: + self.right_button.enable() + class UISpriteButton(): '''This is for use with the cat sprites. It wraps together a UIImage and Transparent Button. For most functions, this can be used exactly like other pygame_gui elements. ''' diff --git a/scripts/global_vars.py b/scripts/global_vars.py index 21b3099..e611eb2 100644 --- a/scripts/global_vars.py +++ b/scripts/global_vars.py @@ -6,10 +6,12 @@ SCREEN = pygame.display.set_mode((screen_x, screen_y)) MANAGER = pygame_gui.ui_manager.UIManager((screen_x, screen_y), 'resources/defaults.json', enable_live_theme_updates=False) +MANAGER.get_theme().load_theme('resources/defaults.json') MANAGER.get_theme().load_theme('resources/buttons.json') MANAGER.get_theme().load_theme('resources/text_boxes.json') MANAGER.get_theme().load_theme('resources/text_boxes.json') + import scripts.cat.cats CREATED_CAT = scripts.cat.cats.Cat() @@ -45,7 +47,10 @@ def sort_bidict(d: bidict, first_element=None): 'MINIMALTHREE': "Minimal 3", 'MINIMALFOUR': "Minimal 4", 'OREO': "Oreo", 'SWOOP': "Swoop", 'MOTTLED': "Mottled", 'SIDEMASK': "Sidemask", 'EYEDOT': "Eye dot", 'BANDANA': "Bandana", 'PACMAN': "Pacman", 'STREAMSTRIKE': "Streamstrike", - 'ORIOLE': "Oriole", 'ROBIN': "Robin", 'BRINDLE': "Brindle", 'PAIGE': "Paige"}) + 'ORIOLE': "Oriole", 'ROBIN': "Robin", 'BRINDLE': "Brindle", 'PAIGE': "Paige", + "ROSETAIL": "Rosetail", "SAFI": "Safi", "HALF": "Half", "CHIMERA": "Chimera", + "SMUDGED": "Smudged", "DAUB": "Daub", "DAPPLENIGHT": "Dapplenight", "STREAK": "Streak", + "MASK": "Mask", "CHEST": "Chest", "ARMTAIL": "Armtail", "EMBER": "Ember"}) tortie_patches_shapes = sort_bidict(tortie_patches_shapes) eye_colors = bidict( {'YELLOW': "Yellow", 'AMBER': "Amber", 'HAZEL': "Hazel", 'PALEGREEN': "Pale Green", @@ -73,7 +78,8 @@ def sort_bidict(d: bidict, first_element=None): colors = bidict({'WHITE': 'White', 'GREY': 'Grey', 'DARKGREY': 'Dark Grey', 'PALEGREY': 'Pale Grey', 'SILVER': 'Silver', 'GOLDEN': 'Golden', 'DARKGINGER': 'Dark Ginger', 'PALEGINGER': 'Pale Ginger', 'CREAM': 'Cream', 'BROWN': 'Brown', 'DARKBROWN': 'Dark Brown', 'LIGHTBROWN': 'Light Brown', - 'BLACK': 'Black', "GHOST": "Ghost", "GINGER": "Ginger"}) + 'BLACK': 'Black', "GHOST": "Ghost", "GINGER": "Ginger", "SIENNA": "Sienna", "LILAC": "Lilac", + "GOLDEN-BROWN": "Golden Brown", "CHOCOLATE": "Chocolate"}) colors = sort_bidict(colors) white_patches = bidict({None: 'None', 'MAO': 'Mao', 'LUNA': 'Luna', 'CHESTSPECK': 'Chest Speck', 'WINGS': 'Wings', @@ -90,7 +96,11 @@ def sort_bidict(d: bidict, first_element=None): 'APPALOOSA': 'Appaloosa', 'PIEBALD': 'Piebald', 'CURVED': 'Curved', 'GLASS': 'Glass', 'MASKMANTLE': 'Mask Mantle', 'VAN': 'Van', 'ONEEAR': 'One Ear', 'LIGHTSONG': 'Lightsong', 'TAIL': 'Tail', 'HEART': 'Heart', 'HEARTTWO': 'Heart 2', 'MOORISH': 'Moorish', 'APRON': 'Apron', - 'CAPSADDLE': 'Cap Saddle', 'FULLWHITE': 'Full White', "EXTRA": "Extra", 'PETAL': 'Petal'}) + 'CAPSADDLE': 'Cap Saddle', 'FULLWHITE': 'Full White', "EXTRA": "Extra", 'PETAL': 'Petal', + "DIVA": "Diva", "SAVANNAH": "Savannah", "FADESPOTS": "Fadespots", "SHIBAINU": "Shiba Inu", + "TOPCOVER": "Top Cover", "DAPPLEPAW": "Dapplepaw", "BEARD": "Beard", "PEBBLESHINE": "Pebbleshine", + "OWL": "Owl", "WOODPECKER": "Woodpecker", "MISS": "Miss", "BOOTS": "Boots", "COW": "Cow", + "COWTWO": "Cow 2", "BUB": "Bub"}) white_patches = sort_bidict(white_patches, None) points = bidict({None: 'None', 'COLOURPOINT': 'Colorpoint', 'RAGDOLL': 'Ragdoll', 'SEPIAPOINT': 'Sepiapoint', 'MINKPOINT': 'Minkpoint', @@ -98,7 +108,7 @@ def sort_bidict(d: bidict, first_element=None): points = sort_bidict(points, None) vit = bidict({None: 'None', 'VITILIGO': 'Vitiligo 1', 'VITILIGOTWO': 'Vitiligo 2', 'KARPATI': 'Karpati', - 'MOON': 'Moon', 'PHANTOM': 'Phantom', 'POWDER': 'Powder'}) + 'MOON': 'Moon', 'PHANTOM': 'Phantom', 'POWDER': 'Powder', 'BLEACHED': 'Bleached'}) vit = sort_bidict(vit, None) scars = bidict({None: "None", "ONE": "Chest", "TWO": "Shoulder", "THREE": "Over Eye", "TAILSCAR": "Tail", diff --git a/scripts/screens/all_screens.py b/scripts/screens/all_screens.py index 5dc0025..f6f4d0a 100644 --- a/scripts/screens/all_screens.py +++ b/scripts/screens/all_screens.py @@ -1,6 +1,6 @@ from .base_screens import Screens from scripts.screens.organization_screens import StartScreen -from scripts.screens.creation_screen import CreationScreen +from scripts.screens.creation_screen import CreationScreen, MoreDetailScreen # ---------------------------------------------------------------------------- # @@ -37,3 +37,4 @@ # ---------------------------------------------------------------------------- # creation_screen = CreationScreen('creation screen') +export_prepare_screen = MoreDetailScreen('detail screen') diff --git a/scripts/screens/creation_screen.py b/scripts/screens/creation_screen.py index 652191c..0e2d911 100644 --- a/scripts/screens/creation_screen.py +++ b/scripts/screens/creation_screen.py @@ -2,11 +2,10 @@ import pygame_gui import pygame import scripts.global_vars as global_vars -from scripts.utility import update_sprite +from scripts.utility import update_sprite, generate_sprite from scripts.game_structure.image_cache import load_image import scripts.game_structure.image_button as custom_buttons from scripts.cat.cats import Cat -from scripts.cat.pelts import choose_pelt from scripts.game_structure.image_cache import load_image class CreationScreen(base_screens.Screens): @@ -39,7 +38,10 @@ def __init__(self, name): def handle_event(self, event): if event.type == pygame_gui.UI_BUTTON_START_PRESS: - if event.ui_element == self.general_tab_button: + if event.ui_element == self.done: + return + self.change_screen('detail screen') + elif event.ui_element == self.general_tab_button: self.show_tab(self.general_tab) self.handle_page_switching(0) elif event.ui_element == self.pattern_tab_button: @@ -76,47 +78,39 @@ def handle_event(self, event): # Switch pelt to tortie. if global_vars.CREATED_CAT.pelt.name == "Tortie": # Switch cat from tortie. - pelt = global_vars.CREATED_CAT.tortiebase.capitalize() + pelt = global_vars.CREATED_CAT.pelt.tortiebase.capitalize() if pelt == "Single": pelt = "SingleColour" - - global_vars.CREATED_CAT.pelt = choose_pelt( - global_vars.CREATED_CAT.pelt.colour, - False, - pelt, - global_vars.CREATED_CAT.pelt.length - ) + + global_vars.CREATED_CAT.pelt.name = pelt else: #Switch Cat to Tortie - global_vars.CREATED_CAT.pelt = choose_pelt( - global_vars.CREATED_CAT.pelt.colour, - False, - "Tortie", - global_vars.CREATED_CAT.pelt.length - ) + global_vars.CREATED_CAT.pelt.tortiebase = \ + global_vars.CREATED_CAT.pelt.sprites_names[global_vars.CREATED_CAT.pelt.name] + global_vars.CREATED_CAT.pelt.name = "Tortie" + self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() elif event.ui_element == self.checkboxes["hetero_eyes"]: - + # This will switch hetero eyes from off to on, and vis versa. - if global_vars.CREATED_CAT.eye_colour2: - global_vars.CREATED_CAT.eye_colour2 = None + if global_vars.CREATED_CAT.pelt.eye_colour2: + global_vars.CREATED_CAT.pelt.eye_colour2 = None else: # We store the last eye color 2 in "stored eye color" for QOL reasons. - global_vars.CREATED_CAT.eye_colour2 = global_vars.CREATED_CAT.stored_eye_color_2 + global_vars.CREATED_CAT.pelt.eye_colour2 = global_vars.CREATED_CAT.pelt.stored_eye_color_2 self.build_dropdown_menus() self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() elif event.ui_element == self.checkboxes["reverse"]: # This checkbox flips the car horizonally. - if global_vars.CREATED_CAT.reverse: - global_vars.CREATED_CAT.reverse = False - else: - global_vars.CREATED_CAT.reverse = True + global_vars.CREATED_CAT.pelt.reverse = not \ + global_vars.CREATED_CAT.pelt.reverse + self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() elif event.ui_element == self.checkboxes["shading"]: @@ -124,20 +118,19 @@ def handle_event(self, event): global_vars.CREATED_CAT.shading = False else: global_vars.CREATED_CAT.shading = True + self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() elif event.ui_element == self.checkboxes["paralyzed"]: - if global_vars.CREATED_CAT.paralyzed: - global_vars.CREATED_CAT.paralyzed = False - else: - global_vars.CREATED_CAT.paralyzed = True + global_vars.CREATED_CAT.pelt.paralyzed = not \ + global_vars.CREATED_CAT.pelt.paralyzed + self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() elif event.ui_element == self.checkboxes["sick"]: - if global_vars.CREATED_CAT.not_working: - global_vars.CREATED_CAT.not_working = False - else: - global_vars.CREATED_CAT.not_working = True + global_vars.CREATED_CAT.pelt.not_working = not \ + global_vars.CREATED_CAT.pelt.not_working + self.update_checkboxes_and_disable_dropdowns() self.update_cat_image() @@ -149,13 +142,16 @@ def handle_event(self, event): global_vars.CREATED_CAT.tortiecolour = global_vars.colors.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["white_patches_select"]: - global_vars.CREATED_CAT.white_patches = global_vars.white_patches.inverse[event.text] + global_vars.CREATED_CAT.pelt.white_patches = global_vars.white_patches.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["pelt_length_select"]: - self.change_fur_length(event.text.lower()) + global_vars.CREATED_CAT.pelt.set_pelt_length(event.text.lower()) self.update_cat_image() elif event.ui_element == self.dropdown_menus["pose_select"]: - self.change_pose(event.text[-1]) + global_vars.CREATED_CAT.pelt.set_pose( + global_vars.CREATED_CAT.age, + event.text[-1] + ) self.update_cat_image() elif event.ui_element == self.dropdown_menus["pelt_select"]: @@ -164,63 +160,62 @@ def handle_event(self, event): if global_vars.CREATED_CAT.pelt.name == "Tortie": if selected == "SingleColour": selected = "single" - global_vars.CREATED_CAT.tortiebase = selected.lower() + global_vars.CREATED_CAT.pelt.tortiebase = selected.lower() else: - global_vars.CREATED_CAT.pelt = choose_pelt( - global_vars.CREATED_CAT.pelt.colour, - False, - selected, - global_vars.CREATED_CAT.pelt.length - ) + global_vars.CREATED_CAT.pelt.name = selected + self.update_cat_image() elif event.ui_element == self.dropdown_menus["age_select"]: global_vars.CREATED_CAT.age = event.text.lower() + # We need to rebuild some dropdowns in order for the pose + # to update correctly. + self.build_dropdown_menus() self.update_cat_image() elif event.ui_element == self.dropdown_menus["eye_color_1"]: - global_vars.CREATED_CAT.eye_colour = global_vars.eye_colors.inverse[event.text] + global_vars.CREATED_CAT.pelt.eye_colour = global_vars.eye_colors.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["eye_color_2"]: - global_vars.CREATED_CAT.eye_colour2 = global_vars.eye_colors.inverse[event.text] - global_vars.CREATED_CAT.stored_eye_color_2 = global_vars.eye_colors.inverse[event.text] + global_vars.CREATED_CAT.pelt.eye_colour2 = global_vars.eye_colors.inverse[event.text] + global_vars.CREATED_CAT.pelt.stored_eye_color_2 = global_vars.eye_colors.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["torte_patches_color"]: - global_vars.CREATED_CAT.tortiecolour = global_vars.colors.inverse[event.text] - global_vars.CREATED_CAT.stored_tortiecolour = global_vars.colors.inverse[event.text] + global_vars.CREATED_CAT.pelt.tortiecolour = global_vars.colors.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["torte_patches_pattern"]: - global_vars.CREATED_CAT.tortiepattern = global_vars.tortie_patches_patterns.inverse[event.text] - global_vars.CREATED_CAT.stored_tortiepattern = global_vars.tortie_patches_patterns.inverse[event.text] + global_vars.CREATED_CAT.pelt.tortiepattern = global_vars.tortie_patches_patterns.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["torte_patches_shape"]: - global_vars.CREATED_CAT.pattern = global_vars.tortie_patches_shapes.inverse[event.text] - global_vars.CREATED_CAT.stored_tortiepattern = global_vars.tortie_patches_shapes.inverse[event.text] + global_vars.CREATED_CAT.pelt.pattern = global_vars.tortie_patches_shapes.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["skin_color_select"]: - global_vars.CREATED_CAT.skin = global_vars.skin_colors.inverse[event.text] + global_vars.CREATED_CAT.pelt.skin = global_vars.skin_colors.inverse[event.text] + self.update_cat_image() elif event.ui_element == self.dropdown_menus["tint_select"]: - global_vars.CREATED_CAT.tint = global_vars.tints.inverse[event.text] + global_vars.CREATED_CAT.pelt.tint = global_vars.tints.inverse[event.text] + self.update_cat_image() elif event.ui_element == self.dropdown_menus["scar_1"]: - global_vars.CREATED_CAT.scar_slot_list[0] = global_vars.scars.inverse[event.text] + global_vars.CREATED_CAT.pelt.scar_slot_list[0] = global_vars.scars.inverse[event.text] + self.update_cat_image() elif event.ui_element == self.dropdown_menus["scar_2"]: - global_vars.CREATED_CAT.scar_slot_list[1] = global_vars.scars.inverse[event.text] + global_vars.CREATED_CAT.pelt.scar_slot_list[1] = global_vars.scars.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["scar_3"]: - global_vars.CREATED_CAT.scar_slot_list[2] = global_vars.scars.inverse[event.text] + global_vars.CREATED_CAT.pelt.scar_slot_list[2] = global_vars.scars.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["scar_4"]: - global_vars.CREATED_CAT.scar_slot_list[3] = global_vars.scars.inverse[event.text] + global_vars.CREATED_CAT.pelt.scar_slot_list[3] = global_vars.scars.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["accessory"]: - global_vars.CREATED_CAT.accessory = global_vars.accessories.inverse[event.text] + global_vars.CREATED_CAT.pelt.accessory = global_vars.accessories.inverse[event.text] self.update_cat_image() elif event.ui_element == self.dropdown_menus["lineart_select"]: if event.text == "StarClan": @@ -232,18 +227,23 @@ def handle_event(self, event): else: global_vars.CREATED_CAT.dead = False global_vars.CREATED_CAT.df = False + self.update_cat_image() elif event.ui_element == self.dropdown_menus["platform_select"]: global_vars.CREATED_CAT.platform = event.text + self.update_platform() elif event.ui_element == self.dropdown_menus["white_patches_tint_select"]: - global_vars.CREATED_CAT.white_patches_tint = global_vars.white_patches_tint.inverse[event.text] + global_vars.CREATED_CAT.pelt.white_patches_tint = global_vars.white_patches_tint.inverse[event.text] + self.update_cat_image() elif event.ui_element == self.dropdown_menus["points_select"]: - global_vars.CREATED_CAT.points = global_vars.points.inverse[event.text] + global_vars.CREATED_CAT.pelt.points = global_vars.points.inverse[event.text] + self.update_cat_image() elif event.ui_element == self.dropdown_menus["vit_select"]: - global_vars.CREATED_CAT.vitiligo = global_vars.vit.inverse[event.text] + global_vars.CREATED_CAT.pelt.vitiligo = global_vars.vit.inverse[event.text] + self.update_cat_image() def show_tab(self, container): @@ -274,9 +274,11 @@ def handle_page_switching(self, direction: 1): ] for x in pages: - if self.visable_tab in x: + if self.visable_tab in x: index = x.index(self.visable_tab) new_index = index + direction + self.page_indicator.set_text(f"{new_index + 1} / {len(x)}") + if 0 <= new_index < len(x): self.show_tab(x[new_index]) @@ -292,6 +294,8 @@ def handle_page_switching(self, direction: 1): return + + self.page_indicator.set_text(f"1 / 1") self.next_page.disable() self.last_page.disable() @@ -379,8 +383,11 @@ def screen_switches(self): object_id="#last_page_button") self.next_page = custom_buttons.UIImageButton(pygame.Rect((534, 640), (34, 34)), "", object_id="#next_page_button") - self.last_page.disable() - self.next_page.disable() + self.page_indicator = pygame_gui.elements.UITextBox("", pygame.Rect((370, 647), (162, 30)), + object_id="#page_number") + + # Updates the page indicator and disabling the page buttons + self.handle_page_switching(0) # ------------------------------------------------------------------------------------------------------------ @@ -525,7 +532,6 @@ def screen_switches(self): self.build_dropdown_menus() self.update_checkboxes_and_disable_dropdowns() - def update_cat_image(self): """ Updates the cat images and displays it. """ update_sprite(global_vars.CREATED_CAT) @@ -549,7 +555,7 @@ def build_dropdown_menus(self): self.dropdown_menus["pose_select"] = pygame_gui.elements.UIDropDownMenu(["Pose " + i for i in global_vars.poses[global_vars.CREATED_CAT.pelt.length][global_vars.CREATED_CAT.age]], "Pose " + - global_vars.CREATED_CAT.current_poses[ + global_vars.CREATED_CAT.pelt.current_poses[ global_vars.CREATED_CAT.age ], pygame.Rect((180, 35), (150, 30)), @@ -586,7 +592,7 @@ def build_dropdown_menus(self): current_base_pelt = global_vars.CREATED_CAT.pelt.name if current_base_pelt in ["Tortie", "Calcio"]: - current_base_pelt = global_vars.CREATED_CAT.tortiebase.capitalize() + current_base_pelt = global_vars.CREATED_CAT.pelt.tortiebase.capitalize() if current_base_pelt == "Single": current_base_pelt = "SingleColour" @@ -597,42 +603,42 @@ def build_dropdown_menus(self): pygame.Rect((185, 35), (180, 30)), container=self.pattern_tab) - if global_vars.CREATED_CAT.white_patches: - white_patches = (global_vars.CREATED_CAT.white_patches.lower()).capitalize() + if global_vars.CREATED_CAT.pelt.white_patches: + white_patches = (global_vars.CREATED_CAT.pelt.white_patches.lower()).capitalize() else: white_patches = "None" self.dropdown_menus["white_patches_select"] = pygame_gui.elements.UIDropDownMenu(global_vars.white_patches.values(), global_vars.white_patches[ - global_vars.CREATED_CAT.white_patches + global_vars.CREATED_CAT.pelt.white_patches ], pygame.Rect((375, 35), (190, 30)), container=self.pattern_tab) self.dropdown_menus["points_select"] = pygame_gui.elements.UIDropDownMenu(global_vars.points.values(), global_vars.points[ - global_vars.CREATED_CAT.points + global_vars.CREATED_CAT.pelt.points ], pygame.Rect((20, 90), (190, 30)), container=self.pattern_tab) self.dropdown_menus["vit_select"] = pygame_gui.elements.UIDropDownMenu(global_vars.vit.values(), global_vars.vit[ - global_vars.CREATED_CAT.vitiligo + global_vars.CREATED_CAT.pelt.vitiligo ], pygame.Rect((220, 90), (190, 30)), container=self.pattern_tab) self.dropdown_menus["eye_color_1"] = pygame_gui.elements.UIDropDownMenu(global_vars.eye_colors.values(), global_vars.eye_colors[ - global_vars.CREATED_CAT.eye_colour + global_vars.CREATED_CAT.pelt.eye_colour ], pygame.Rect((20, 145), (180, 30)), container=self.pattern_tab) - if global_vars.CREATED_CAT.eye_colour2: - eye_color_2 = global_vars.CREATED_CAT.eye_colour2 + if global_vars.CREATED_CAT.pelt.eye_colour2: + eye_color_2 = global_vars.CREATED_CAT.pelt.eye_colour2 else: - eye_color_2 = global_vars.CREATED_CAT.eye_colour + eye_color_2 = global_vars.CREATED_CAT.pelt.eye_colour self.dropdown_menus["eye_color_2"] = pygame_gui.elements.UIDropDownMenu(global_vars.eye_colors.values(), @@ -644,7 +650,7 @@ def build_dropdown_menus(self): self.dropdown_menus["tint_select"] = pygame_gui.elements.UIDropDownMenu(global_vars.tints.values(), global_vars.tints[ - global_vars.CREATED_CAT.tint + global_vars.CREATED_CAT.pelt.tint ], pygame.Rect(((200, 200), (150, 30))), container=self.pattern_tab, @@ -653,7 +659,7 @@ def build_dropdown_menus(self): self.dropdown_menus["white_patches_tint_select"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.white_patches_tint.values(), global_vars.white_patches_tint[ - global_vars.CREATED_CAT.white_patches_tint + global_vars.CREATED_CAT.pelt.white_patches_tint ], pygame.Rect(((360, 200), (205, 30))), container=self.pattern_tab, @@ -661,7 +667,7 @@ def build_dropdown_menus(self): self.dropdown_menus["skin_color_select"] = pygame_gui.elements.UIDropDownMenu(global_vars.skin_colors.values(), global_vars.skin_colors[ - global_vars.CREATED_CAT.skin + global_vars.CREATED_CAT.pelt.skin ], pygame.Rect(((20, 200), (170, 30))), container=self.pattern_tab, @@ -676,7 +682,7 @@ def build_dropdown_menus(self): self.dropdown_menus["torte_patches_color"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.colors.values(), global_vars.colors[ - global_vars.CREATED_CAT.tortiecolour + global_vars.CREATED_CAT.pelt.tortiecolour ], pygame.Rect((70, 35), (150, 30)), container=self.pattern_tab2) @@ -684,7 +690,7 @@ def build_dropdown_menus(self): self.dropdown_menus["torte_patches_pattern"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.tortie_patches_patterns.values(), global_vars.tortie_patches_patterns[ - global_vars.CREATED_CAT.tortiepattern + global_vars.CREATED_CAT.pelt.tortiepattern ], pygame.Rect((230, 35), (180, 30)), container=self.pattern_tab2) @@ -692,7 +698,7 @@ def build_dropdown_menus(self): self.dropdown_menus["torte_patches_shape"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.tortie_patches_shapes.values(), global_vars.tortie_patches_shapes[ - global_vars.CREATED_CAT.pattern + global_vars.CREATED_CAT.pelt.pattern ], pygame.Rect((420, 35), (150, 30)), container=self.pattern_tab2) @@ -704,7 +710,7 @@ def build_dropdown_menus(self): self.dropdown_menus["scar_1"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.scars.values(), global_vars.scars[ - global_vars.CREATED_CAT.scar_slot_list[0] + global_vars.CREATED_CAT.pelt.scar_slot_list[0] ], pygame.Rect((20, 35), (270, 30)), container=self.extras_tab) @@ -712,7 +718,7 @@ def build_dropdown_menus(self): self.dropdown_menus["scar_2"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.scars.values(), global_vars.scars[ - global_vars.CREATED_CAT.scar_slot_list[1] + global_vars.CREATED_CAT.pelt.scar_slot_list[1] ], pygame.Rect((300, 35), (270, 30)), container=self.extras_tab) @@ -720,7 +726,7 @@ def build_dropdown_menus(self): self.dropdown_menus["scar_3"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.scars.values(), global_vars.scars[ - global_vars.CREATED_CAT.scar_slot_list[2] + global_vars.CREATED_CAT.pelt.scar_slot_list[2] ], pygame.Rect((20, 90), (270, 30)), container=self.extras_tab) @@ -728,7 +734,7 @@ def build_dropdown_menus(self): self.dropdown_menus["scar_4"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.scars.values(), global_vars.scars[ - global_vars.CREATED_CAT.scar_slot_list[3] + global_vars.CREATED_CAT.pelt.scar_slot_list[3] ], pygame.Rect((300, 90), (270, 30)), container=self.extras_tab) @@ -736,7 +742,7 @@ def build_dropdown_menus(self): self.dropdown_menus["accessory"] = \ pygame_gui.elements.UIDropDownMenu(global_vars.accessories.values(), global_vars.accessories[ - global_vars.CREATED_CAT.accessory + global_vars.CREATED_CAT.pelt.accessory ], pygame.Rect((20, 145), (240, 30)), container=self.extras_tab) @@ -771,7 +777,7 @@ def update_checkboxes_and_disable_dropdowns(self): container=self.general_tab) # Reversed - if global_vars.CREATED_CAT.reverse: + if global_vars.CREATED_CAT.pelt.reverse: self.checkboxes["reverse"] = custom_buttons.UIImageButton(pygame.Rect((190, 95), (34, 34)), "", object_id="#checked_checkbox", @@ -783,7 +789,7 @@ def update_checkboxes_and_disable_dropdowns(self): container=self.general_tab) # Paralyzed - if global_vars.CREATED_CAT.paralyzed: + if global_vars.CREATED_CAT.pelt.paralyzed: self.checkboxes["paralyzed"] = custom_buttons.UIImageButton(pygame.Rect((20, 160), (34, 34)), "", object_id="#checked_checkbox", @@ -795,7 +801,7 @@ def update_checkboxes_and_disable_dropdowns(self): container=self.general_tab) # Sick - if global_vars.CREATED_CAT.not_working: + if global_vars.CREATED_CAT.pelt.not_working: self.checkboxes["sick"] = custom_buttons.UIImageButton(pygame.Rect((190, 160), (34, 34)), "", object_id="#checked_checkbox", @@ -812,7 +818,7 @@ def update_checkboxes_and_disable_dropdowns(self): # Heterochromia - if global_vars.CREATED_CAT.eye_colour2: + if global_vars.CREATED_CAT.pelt.eye_colour2: self.checkboxes["hetero_eyes"] = custom_buttons.UIImageButton(pygame.Rect((210, 140), (34, 34)), "", object_id="#checked_checkbox", @@ -851,34 +857,21 @@ def update_checkboxes_and_disable_dropdowns(self): # Extras Tab -------------------------------------------------------------------------------------------------- # ------------------------------------------------------------------------------------------------------------- - def change_pose(self, pose: str=None): - # Changes the pose from 1, 2, or 3 - if pose: - # Change the sprite number. - global_vars.CREATED_CAT.cat_sprites[global_vars.CREATED_CAT.age] = global_vars.poses[ - global_vars.CREATED_CAT.pelt.length][global_vars.CREATED_CAT.age][pose] - - # Adjust tracked poses. - global_vars.CREATED_CAT.current_poses[global_vars.CREATED_CAT.age] = pose - - - - def change_fur_length(self, fur_length: str=None): - if fur_length: - global_vars.CREATED_CAT.pelt.length = fur_length - - # Change all poses for all ages. - for age in global_vars.CREATED_CAT.current_poses: - # This is such a mess of dictionary lookups. - global_vars.CREATED_CAT.cat_sprites[age] = global_vars.poses[ - fur_length][age][global_vars.CREATED_CAT.current_poses[age]] - def exit_screen(self): self.back.kill() self.back = None self.done.kill() self.done = None + + self.next_page.kill() + self.next_page = None + + self.last_page.kill() + self.last_page = None + + self.page_indicator.kill() + self.page_indicator = None self.cat_platform.kill() self.cat_platform = None @@ -919,23 +912,263 @@ def exit_screen(self): self.dropdown_menus = {} self.checkboxes = {} -class DoneScreen(base_screens.Screens): + + +class MoreDetailScreen(base_screens.Screens): def __init__(self, name): self.save_dict = {} + self.labels = {} + self.number_selects = {} + self.cat_images = {} + self.stored_status = None super().__init__(name) def handle_event(self, event): pass def screen_switches(self): - self.save_dict = global_vars.CREATED_CAT.generate_save_file() + update_sprite(global_vars.CREATED_CAT) + + self.draw_age_stage() + + self.back = custom_buttons.UIImageButton(pygame.Rect((50, 25), (105, 30)), "", + object_id="#back_button") + + self.done = custom_buttons.UIImageButton(pygame.Rect((673, 25), (77, 30)), "", + object_id="#done_button") + + # ----------------------------------------------------------------------------------------------------------- + # TAB BUTTONS ----------------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------------------------- + self.general_tab_button = custom_buttons.UIImageButton(pygame.Rect((50, 365), (100, 88)), "", + object_id="#general_info_tab_button") + self.general_tab_button.disable() + + self.trait_skill_tab_button = custom_buttons.UIImageButton(pygame.Rect((50, 456), (100, 88)), "", + object_id="#pattern_tab_button") + + self.tab_background = pygame_gui.elements.UIImage(pygame.Rect((150, 350), (600, 300)), + load_image("resources/images/options.png")) + + # ----------------------------------------------------------------------------------------------------------- + # TAB CONTAINERS -------------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------------------------- + self.general_tab = pygame_gui.elements.UIScrollingContainer(pygame.Rect((150, 350), (600, 300)), + global_vars.MANAGER) + + self.trait_skill_tab = pygame_gui.elements.UIScrollingContainer(pygame.Rect((150, 350), (600, 300)), + global_vars.MANAGER, + visible=False) + + self.trait_skill_tab2 = pygame_gui.elements.UIScrollingContainer(pygame.Rect((150, 350), (600, 300)), + global_vars.MANAGER, + visible=False) + + self.visable_tab = self.general_tab + + # ------------------------------------------------------------------------------------------------------------ + # Page Buttons ----------------------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------------------------------------ + self.last_page = custom_buttons.UIImageButton(pygame.Rect((334, 640), (34, 34)), "", + object_id="#last_page_button") + self.next_page = custom_buttons.UIImageButton(pygame.Rect((534, 640), (34, 34)), "", + object_id="#next_page_button") + self.page_indicator = pygame_gui.elements.UITextBox("", pygame.Rect((370, 647), (162, 30)), + object_id="#page_number") + + # Updates the page indicator and disabling the page buttons + self.handle_page_switching(0) + + + # ------------------------------------------------------------------------------------------------------------ + # General Tab Labels ----------------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------------------------------------ + self.labels["prefix"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Prefix:", + container=self.general_tab, + object_id="#dropdown_label") + + self.prefix_enter = pygame_gui.elements.UITextEntryLine(pygame.Rect((20, 35),(180, 30)), + container=self.general_tab, + placeholder_text="Fire") + + self.labels["suffix"] = pygame_gui.elements.UILabel(pygame.Rect((210, 15), (150, 25)), "Suffix:", + container=self.general_tab, + object_id="#dropdown_label") + + self.suffix_enter = pygame_gui.elements.UITextEntryLine(pygame.Rect((210, 35),(180, 30)), + container=self.general_tab, + placeholder_text="heart") + + self.labels["status"] = pygame_gui.elements.UILabel(pygame.Rect((400, 15), (150, 25)), "Status (Rank):", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["sex"] = pygame_gui.elements.UILabel(pygame.Rect((20, 80), (150, 25)), "Sex:", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["gender"] = pygame_gui.elements.UILabel(pygame.Rect((20, 145), (150, 25)), "Gender Alignment:", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["experience"] = pygame_gui.elements.UILabel(pygame.Rect((210, 80), (150, 25)), "Experience Level:", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["age"] = pygame_gui.elements.UILabel(pygame.Rect((400, 80), (150, 25)), "Age (in moons):", + container=self.general_tab, + object_id="#dropdown_label") + + self.age_enter = pygame_gui.elements.UITextEntryLine(pygame.Rect((400, 100),(180, 30)), + container=self.general_tab) + self.age_enter.set_allowed_characters('numbers') + + + """self.gender_alignment_other = pygame_gui.elements.UITextEntryLine(pygame.Rect((), ()), + container=self.general_tab, + placeholder_text="Gender Here") + + self.labels["status"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Status (Rank):", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["age"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Age (in moons):", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["id"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Cat ID:", + container=self.general_tab, + object_id="#dropdown_label") + + self.labels["experience"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Experience Level:", + container=self.general_tab, + object_id="#dropdown_label")""" + + # ------------------------------------------------------------------------------------------------------------- + # Trait Skill Labels ------------------------------------------------------------------------------------------ + # ------------------------------------------------------------------------------------------------------------- + + self.labels["trait"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Trait:", + container=self.trait_skill_tab, + object_id="#dropdown_label") + self.labels["lawfulness"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Lawfulness:", + container=self.trait_skill_tab, + object_id="#dropdown_label") + self.labels["aggression"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Aggression:", + container=self.trait_skill_tab, + object_id="#dropdown_label") + self.labels["sociability"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Sociability:", + container=self.trait_skill_tab, + object_id="#dropdown_label") + self.labels["stablity"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Stablity:", + container=self.trait_skill_tab, + object_id="#dropdown_label") + + """# Also create the facet select options, since those can be changes and don't need to be rebuild later + self.lawfulness_enter = custom_buttons.UIFacetSelect() + self.aggression_enter = custom_buttons.UIFacetSelect() + self.sociability_enter = custom_buttons.UIFacetSelect() + self.stablity_enter = custom_buttons.UIFacetSelect()""" + + + # ------------------------------------------------------------------------------------------------------------- + # Trait Skill Labels 2 Tab Labels ----------------------------------------------------------------------------- + # ------------------------------------------------------------------------------------------------------------- + + self.labels["primary_path"] = pygame_gui.elements.UILabel(pygame.Rect((20, 15), (150, 25)), "Primary Skill Path:", + container=self.trait_skill_tab2, + object_id="#dropdown_label") + + self.labels["secondary_path"] = pygame_gui.elements.UILabel(pygame.Rect((70, 15), (150, 25)), + "Secondary Skill Path:", + container=self.trait_skill_tab2, + object_id="#dropdown_label") + + self.labels["primary_tier"] = pygame_gui.elements.UILabel(pygame.Rect((230, 15), (190, 25)), + "Primary Skill Tier:", + container=self.trait_skill_tab2, + object_id="#dropdown_label") + + self.labels["secondary_tier"] = pygame_gui.elements.UILabel(pygame.Rect((420, 15), (190, 25)), + "Secondary Skill Tier:", + container=self.trait_skill_tab2, + object_id="#dropdown_label") + + self.labels["hidden"] = pygame_gui.elements.UILabel(pygame.Rect((420, 15), (190, 25)), + "Hidden Skill: ", + container=self.trait_skill_tab2, + object_id="#dropdown_label") + + """self.number_selects["primary_tier"] = custom_buttons.UIFacetSelect() + self.number_selects["secondary_tier"] = custom_buttons.UIFacetSelect()""" + + + #self.build_dropdown_menus() + #self.update_checkboxes_and_disable_dropdowns() + + def handle_page_switching(self, direction: 1): + """Direction is next vs last page. 1 is next page, -1 is last page. 0 is no change (just update the buttons) """ + if direction not in (1, 0, -1): + return + + pages = [] + + for x in pages: + if self.visable_tab in x: + index = x.index(self.visable_tab) + new_index = index + direction + self.page_indicator.set_text(f"{new_index + 1} / {len(x)}") + + if 0 <= new_index < len(x): + self.show_tab(x[new_index]) + + if new_index == len(x) - 1: + self.last_page.enable() + self.next_page.disable() + elif new_index == 0: + self.next_page.enable() + self.last_page.disable() + else: + self.next_page.enable() + self.last_page.enable() + + return + + + self.page_indicator.set_text(f"1 / 1") + self.next_page.disable() + self.last_page.disable() + def exit_screen(self): pass + + def draw_age_stage(self): + for ele in self.cat_images: + self.cat_images[ele].kill() + self.cat_images = {} + + x_pos = 130 + for age in ["newborn", "kitten", "adolescent", "adult", "senior"]: + self.cat_images[age] = pygame_gui.elements.UIImage( + pygame.Rect((x_pos, 140), (100, 100)), + pygame.transform.scale(generate_sprite( + global_vars.CREATED_CAT, + life_state=age, + no_not_working=True, + no_para=True + ), (100, 100)) + ) + x_pos += 110 + def save_png(self, path): pass + + def update_status_from_moons(self): + entered = int(self.age_enter.get_text()) + class SaveCodeScreen(base_screens.Screens): diff --git a/scripts/screens/organization_screens.py b/scripts/screens/organization_screens.py index 87bab87..89523c3 100644 --- a/scripts/screens/organization_screens.py +++ b/scripts/screens/organization_screens.py @@ -22,10 +22,10 @@ def screen_switches(self): self.title = pygame_gui.elements.UITextBox("ClanGen CatMaker", pygame.Rect((0, 200), (800, 100)), object_id="#title") self.start_button = pygame_gui.elements.UIButton(pygame.Rect((350, 320), (100, 50)), "Start") - self.version = pygame_gui.elements.UITextBox("Version 0.4.1beta" + self.version = pygame_gui.elements.UITextBox("Version 0.5.0beta" "\n Please don't sell any images created, and give proper credit. ", pygame.Rect((250, 400), (300, 100)), object_id="#version") - + def exit_screen(self): self.start_button.kill() self.start_button = None diff --git a/scripts/utility.py b/scripts/utility.py index 121311a..1da5302 100644 --- a/scripts/utility.py +++ b/scripts/utility.py @@ -8,140 +8,171 @@ def update_sprite(cat): # First, check if the cat is faded. - cat.scars = [] - for scar in cat.scar_slot_list: - if scar: - cat.scars.append(scar) - - - # setting the cat_sprite (bc this makes things much easier) - if cat.paralyzed and not cat.not_working: - if cat.age in ['newborn', 'kitten', 'adolescent']: + cat.sprite = generate_sprite(cat) + + +def generate_sprite(cat, life_state=None, scars_hidden=False, acc_hidden=False, always_living=False, + no_not_working=False, no_para=False) -> pygame.Surface: + """Generates the sprite for a cat, with optional arugments that will override certain things. + life_stage: sets the age life_stage of the cat, overriding the one set by it's age. Set to string. + scar_hidden: If True, doesn't display the cat's scars. If False, display cat scars. + acc_hidden: If True, hide the accessory. If false, show the accessory. + always_living: If True, always show the cat with living lineart + no_not_working: If true, never use the not_working lineart. + If false, use the cat.not_working() to determine the no_working art. + """ + + if life_state is not None: + age = life_state + else: + age = cat.age + + if always_living: + dead = False + else: + dead = cat.dead + + cat_scars = [] + for x in cat.pelt.scar_slot_list: + if x: + cat_scars.append(x) + + # setting the cat_sprite (bc this makes things much easier) + if not no_not_working and cat.pelt.not_working and age != 'newborn': + if age in ['kitten', 'adolescent']: + cat_sprite = str(19) + else: + cat_sprite = str(18) + elif cat.pelt.paralyzed and age != 'newborn' and not no_para: + if age in ['kitten', 'adolescent']: cat_sprite = str(17) else: if cat.pelt.length == 'long': cat_sprite = str(16) else: cat_sprite = str(15) - elif cat.not_working: - if cat.age in ['newborn', 'kitten', 'adolescent']: - cat_sprite = str(19) - else: - cat_sprite = str(18) else: - cat_sprite = str(cat.cat_sprites[cat.age]) + if age == 'elder' and not game.config['fun']['all_cats_are_newborn']: + age = 'senior' + + cat_sprite = str(cat.pelt.cat_sprites[age]) -# generating the sprite - try: - new_sprite = pygame.Surface((sprites.size, sprites.size), pygame.HWSURFACE | pygame.SRCALPHA) + new_sprite = pygame.Surface((sprites.size, sprites.size), pygame.HWSURFACE | pygame.SRCALPHA) + # generating the sprite + try: if cat.pelt.name not in ['Tortie', 'Calico']: - new_sprite.blit(sprites.sprites[cat.pelt.sprites[1] + cat.pelt.colour + cat_sprite], (0, 0)) + new_sprite.blit(sprites.sprites[cat.pelt.get_sprites_name() + cat.pelt.colour + cat_sprite], (0, 0)) else: - # Base Coat - new_sprite.blit( - sprites.sprites[cat.tortiebase + cat.pelt.colour + cat_sprite], - (0, 0)) - - # Create the patch image - if cat.tortiepattern == "Single": - tortie_pattern = "SingleColour" - else: - tortie_pattern = cat.tortiepattern + # Base Coat + new_sprite.blit( + sprites.sprites[cat.pelt.tortiebase + cat.pelt.colour + cat_sprite], + (0, 0)) + + # Create the patch image + if cat.pelt.tortiepattern == "Single": + tortie_pattern = "SingleColour" + else: + tortie_pattern = cat.pelt.tortiepattern - patches = sprites.sprites[ - tortie_pattern + cat.tortiecolour + cat_sprite].copy() - patches.blit(sprites.sprites["tortiemask" + cat.pattern + cat_sprite], (0, 0), - special_flags=pygame.BLEND_RGBA_MULT) + patches = sprites.sprites[ + tortie_pattern + cat.pelt.tortiecolour + cat_sprite].copy() + patches.blit(sprites.sprites["tortiemask" + cat.pelt.pattern + cat_sprite], (0, 0), + special_flags=pygame.BLEND_RGBA_MULT) - # Add patches onto cat. - new_sprite.blit(patches, (0, 0)) + # Add patches onto cat. + new_sprite.blit(patches, (0, 0)) # TINTS - if cat.tint != "none" and cat.tint in Sprites.cat_tints["tint_colours"]: + if cat.pelt.tint != "none" and cat.pelt.tint in Sprites.cat_tints["tint_colours"]: # Multiply with alpha does not work as you would expect - it just lowers the alpha of the # entire surface. To get around this, we first blit the tint onto a white background to dull it, # then blit the surface onto the sprite with pygame.BLEND_RGB_MULT - tint = pygame.Surface((50, 50)).convert_alpha() - tint.fill(tuple(Sprites.cat_tints["tint_colours"][cat.tint])) + tint = pygame.Surface((spriteSize, spriteSize)).convert_alpha() + tint.fill(tuple(Sprites.cat_tints["tint_colours"][cat.pelt.tint])) new_sprite.blit(tint, (0, 0), special_flags=pygame.BLEND_RGB_MULT) # draw white patches - if cat.white_patches is not None: - white_patches = sprites.sprites['white' + cat.white_patches + cat_sprite].copy() + if cat.pelt.white_patches is not None: + white_patches = sprites.sprites['white' + cat.pelt.white_patches + cat_sprite].copy() # Apply tint to white patches. - if cat.white_patches_tint != "none" and cat.white_patches_tint in Sprites.white_patches_tints[ + if cat.pelt.white_patches_tint != "none" and cat.pelt.white_patches_tint in Sprites.white_patches_tints[ "tint_colours"]: - tint = pygame.Surface((50, 50)).convert_alpha() - tint.fill(tuple(Sprites.white_patches_tints["tint_colours"][cat.white_patches_tint])) + tint = pygame.Surface((spriteSize, spriteSize)).convert_alpha() + tint.fill(tuple(Sprites.white_patches_tints["tint_colours"][cat.pelt.white_patches_tint])) white_patches.blit(tint, (0, 0), special_flags=pygame.BLEND_RGB_MULT) new_sprite.blit(white_patches, (0, 0)) # draw vit & points - if cat.points: - points = sprites.sprites['white' + cat.points + cat_sprite].copy() - if cat.white_patches_tint != "none" and cat.white_patches_tint in Sprites.white_patches_tints[ - "tint_colours"]: - tint = pygame.Surface((50, 50)).convert_alpha() - tint.fill(tuple(Sprites.white_patches_tints["tint_colours"][cat.white_patches_tint])) + if cat.pelt.points: + points = sprites.sprites['white' + cat.pelt.points + cat_sprite].copy() + if cat.pelt.white_patches_tint != "none" and cat.pelt.white_patches_tint in Sprites.white_patches_tints[ + "tint_colours"]: + tint = pygame.Surface((spriteSize, spriteSize)).convert_alpha() + tint.fill(tuple(Sprites.white_patches_tints["tint_colours"][cat.pelt.white_patches_tint])) points.blit(tint, (0, 0), special_flags=pygame.BLEND_RGB_MULT) new_sprite.blit(points, (0, 0)) - - if cat.vitiligo: - new_sprite.blit(sprites.sprites['white' + cat.vitiligo + cat_sprite], (0, 0)) + if cat.pelt.vitiligo: + new_sprite.blit(sprites.sprites['white' + cat.pelt.vitiligo + cat_sprite], (0, 0)) # draw eyes & scars1 - new_sprite.blit(sprites.sprites['eyes' + cat.eye_colour + cat_sprite], (0, 0)) - if cat.eye_colour2 != None: - new_sprite.blit(sprites.sprites['eyes2' + cat.eye_colour2 + cat_sprite], (0, 0)) - for scar in cat.scars: - if scar in scars1: - new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0)) - if scar in scars3: - new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0)) + eyes = sprites.sprites['eyes' + cat.pelt.eye_colour + cat_sprite].copy() + if cat.pelt.eye_colour2 != None: + eyes.blit(sprites.sprites['eyes2' + cat.pelt.eye_colour2 + cat_sprite], (0, 0)) + new_sprite.blit(eyes, (0, 0)) + + if not scars_hidden: + for scar in cat_scars: + if scar in cat.pelt.scars1: + new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0)) + if scar in cat.pelt.scars3: + new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0)) # draw line art if cat.shading: new_sprite.blit(sprites.sprites['shaders' + cat_sprite], (0, 0), special_flags=pygame.BLEND_RGB_MULT) new_sprite.blit(sprites.sprites['lighting' + cat_sprite], (0, 0)) - if not cat.dead: + if not dead: new_sprite.blit(sprites.sprites['lines' + cat_sprite], (0, 0)) elif cat.df: new_sprite.blit(sprites.sprites['lineartdf' + cat_sprite], (0, 0)) - elif cat.dead: + elif dead: new_sprite.blit(sprites.sprites['lineartdead' + cat_sprite], (0, 0)) # draw skin and scars2 blendmode = pygame.BLEND_RGBA_MIN - new_sprite.blit(sprites.sprites['skin' + cat.skin + cat_sprite], (0, 0)) - for scar in cat.scars: - if scar in scars2: - new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0), special_flags=blendmode) - - # draw accessories - if cat.accessory in plant_accessories: - new_sprite.blit(sprites.sprites['acc_herbs' + cat.accessory + cat_sprite], (0, 0)) - elif cat.accessory in wild_accessories: - new_sprite.blit(sprites.sprites['acc_wild' + cat.accessory + cat_sprite], (0, 0)) - elif cat.accessory in collars: - new_sprite.blit(sprites.sprites['collars' + cat.accessory + cat_sprite], (0, 0)) + new_sprite.blit(sprites.sprites['skin' + cat.pelt.skin + cat_sprite], (0, 0)) + + if not scars_hidden: + for scar in cat_scars: + if scar in cat.pelt.scars2: + new_sprite.blit(sprites.sprites['scars' + scar + cat_sprite], (0, 0), special_flags=blendmode) + + # draw accessories + if not acc_hidden: + if cat.pelt.accessory in cat.pelt.plant_accessories: + new_sprite.blit(sprites.sprites['acc_herbs' + cat.pelt.accessory + cat_sprite], (0, 0)) + elif cat.pelt.accessory in cat.pelt.wild_accessories: + new_sprite.blit(sprites.sprites['acc_wild' + cat.pelt.accessory + cat_sprite], (0, 0)) + elif cat.pelt.accessory in cat.pelt.collars: + new_sprite.blit(sprites.sprites['collars' + cat.pelt.accessory + cat_sprite], (0, 0)) # Apply fading fog - if cat.opacity <= 97 and not cat.prevent_fading and game.settings["fading"]: - + if cat.pelt.opacity <= 97 and not cat.prevent_fading and game.settings["fading"] and dead: + stage = "0" - if 80 >= cat.opacity > 45: + if 80 >= cat.pelt.opacity > 45: # Stage 1 stage = "1" - elif cat.opacity <= 45: + elif cat.pelt.opacity <= 45: # Stage 2 stage = "2" - new_sprite.blit(sprites.sprites['fademask' + stage + cat_sprite], + new_sprite.blit(sprites.sprites['fademask' + stage + cat_sprite], (0, 0), special_flags=pygame.BLEND_RGBA_MULT) if cat.df: @@ -153,17 +184,18 @@ def update_sprite(cat): temp.blit(new_sprite, (0, 0)) new_sprite = temp + # reverse, if assigned so + if cat.pelt.reverse: + new_sprite = pygame.transform.flip(new_sprite, True, False) + except (TypeError, KeyError): - traceback.print_exc() - # Placeholder image - new_sprite = image_cache.load_image(f"sprites/error_placeholder.png").convert_alpha().copy() - - # reverse, if assigned so - if cat.reverse: - new_sprite = pygame.transform.flip(new_sprite, True, False) + print("Failed to load sprite") - cat.sprite = new_sprite + # Placeholder image + new_sprite = image_cache.load_image(f"sprites/error_placeholder.png").convert_alpha() + return new_sprite + # ---------------------------------------------------------------------------- # # OTHER # # ---------------------------------------------------------------------------- # diff --git a/sprites/agouticolours.png b/sprites/agouticolours.png index d9609e7..fc0fa1c 100644 Binary files a/sprites/agouticolours.png and b/sprites/agouticolours.png differ diff --git a/sprites/bengalcolours.png b/sprites/bengalcolours.png index 2f75944..b05a0e7 100644 Binary files a/sprites/bengalcolours.png and b/sprites/bengalcolours.png differ diff --git a/sprites/classiccolours.png b/sprites/classiccolours.png index 14a86cd..86c24fc 100644 Binary files a/sprites/classiccolours.png and b/sprites/classiccolours.png differ diff --git a/sprites/dicts/tint.json b/sprites/dicts/tint.json index 76d0119..2dcf871 100644 --- a/sprites/dicts/tint.json +++ b/sprites/dicts/tint.json @@ -1,28 +1,33 @@ { "colour_groups": { - "DARKGINGER": "warm", "WHITE": "white", "PALEGREY": "cool", "SILVER": "cool", "GREY": "monochrome", "DARKGREY": "monochrome", "GHOST": "monochrome", + "BLACK": "monochrome", + "CREAM": "warm", "PALEGINGER": "warm", "GOLDEN": "warm", "GINGER": "warm", - "CREAM": "warm", - "LIGHTBROWN": "warm", - "DARKBROWN": "warm", - "BROWN": "warm", - "BLACK": "monochrome" + "DARKGINGER": "warm", + "SIENNA": "brown", + "LIGHTBROWN": "brown", + "LILAC": "brown", + "BROWN": "brown", + "GOLDEN-BROWN": "brown", + "DARKBROWN": "brown", + "CHOCOLATE": "brown" }, "possible_tints": { - "basic": ["pink", "gray", "red", "black", "orange", "none"], + "basic": ["pink", "gray", "red", "orange", "none"], "warm": ["yellow", "purple"], - "cool": ["blue", "purple"], + "cool": ["blue", "purple", "black"], "white": ["yellow"], - "monochrome": ["blue"] + "monochrome": ["blue", "black"], + "brown": ["yellow", "purple", "black"] }, "tint_colours": { diff --git a/sprites/dicts/white_patches_tint.json b/sprites/dicts/white_patches_tint.json index 1ed1425..abf6b5b 100644 --- a/sprites/dicts/white_patches_tint.json +++ b/sprites/dicts/white_patches_tint.json @@ -1,21 +1,25 @@ { "colour_groups": { - "DARKGINGER": "ginger", "WHITE": "white", "PALEGREY": "gray", "SILVER": "gray", "GREY": "gray", "DARKGREY": "black", "GHOST": "black", + "BLACK": "black", + "CREAM": "ginger", "PALEGINGER": "ginger", "GOLDEN": "ginger", "GINGER": "ginger", - "CREAM": "ginger", + "DARKGINGER": "ginger", + "SIENNA": "ginger", "LIGHTBROWN": "brown", - "DARKBROWN": "brown", + "LILAC": "brown", "BROWN": "brown", - "BLACK": "black" + "GOLDEN-BROWN": "brown", + "DARKBROWN": "brown", + "CHOCOLATE": "brown" }, "possible_tints": { "basic": ["none", "offwhite", "offwhite"], diff --git a/sprites/lineart.png b/sprites/lineart.png index 966430c..9ec8acf 100644 Binary files a/sprites/lineart.png and b/sprites/lineart.png differ diff --git a/sprites/mackerelcolours.png b/sprites/mackerelcolours.png index c9010e9..ae670a5 100644 Binary files a/sprites/mackerelcolours.png and b/sprites/mackerelcolours.png differ diff --git a/sprites/marbledcolours.png b/sprites/marbledcolours.png index 3959af4..3c9b865 100644 Binary files a/sprites/marbledcolours.png and b/sprites/marbledcolours.png differ diff --git a/sprites/missingscars.png b/sprites/missingscars.png index fe55a14..9641738 100644 Binary files a/sprites/missingscars.png and b/sprites/missingscars.png differ diff --git a/sprites/paralyzed/Credit.png b/sprites/paralyzed/Credit.png new file mode 100644 index 0000000..c08ce82 Binary files /dev/null and b/sprites/paralyzed/Credit.png differ diff --git a/sprites/paralyzed/Paralyzed_lineart.png b/sprites/paralyzed/Paralyzed_lineart.png new file mode 100644 index 0000000..540bf51 Binary files /dev/null and b/sprites/paralyzed/Paralyzed_lineart.png differ diff --git a/sprites/paralyzed/bell_collars_full_paralyzed.png b/sprites/paralyzed/bell_collars_full_paralyzed.png new file mode 100644 index 0000000..b40b4ff Binary files /dev/null and b/sprites/paralyzed/bell_collars_full_paralyzed.png differ diff --git a/sprites/paralyzed/bowcollars_paralyzed.png b/sprites/paralyzed/bowcollars_paralyzed.png new file mode 100644 index 0000000..f552bda Binary files /dev/null and b/sprites/paralyzed/bowcollars_paralyzed.png differ diff --git a/sprites/paralyzed/collars_full_paralyzed 2.png b/sprites/paralyzed/collars_full_paralyzed 2.png new file mode 100644 index 0000000..a79ef4e Binary files /dev/null and b/sprites/paralyzed/collars_full_paralyzed 2.png differ diff --git a/sprites/paralyzed/eyesparalyzed.png b/sprites/paralyzed/eyesparalyzed.png new file mode 100644 index 0000000..d0f31f3 Binary files /dev/null and b/sprites/paralyzed/eyesparalyzed.png differ diff --git a/sprites/paralyzed/medcatherbsparalyzed.png b/sprites/paralyzed/medcatherbsparalyzed.png new file mode 100644 index 0000000..fec120c Binary files /dev/null and b/sprites/paralyzed/medcatherbsparalyzed.png differ diff --git a/sprites/paralyzed/scarsparalyzed.png b/sprites/paralyzed/scarsparalyzed.png new file mode 100644 index 0000000..d80a03d Binary files /dev/null and b/sprites/paralyzed/scarsparalyzed.png differ diff --git a/sprites/paralyzed/singleparalyzed.png b/sprites/paralyzed/singleparalyzed.png new file mode 100644 index 0000000..d77028b Binary files /dev/null and b/sprites/paralyzed/singleparalyzed.png differ diff --git a/sprites/paralyzed/skinparalyed.png b/sprites/paralyzed/skinparalyed.png new file mode 100644 index 0000000..75799c9 Binary files /dev/null and b/sprites/paralyzed/skinparalyed.png differ diff --git a/sprites/paralyzed/skinparalyzed.png b/sprites/paralyzed/skinparalyzed.png new file mode 100644 index 0000000..f7ba433 Binary files /dev/null and b/sprites/paralyzed/skinparalyzed.png differ diff --git a/sprites/paralyzed/speckledparalyzed.png b/sprites/paralyzed/speckledparalyzed.png new file mode 100644 index 0000000..e08bcf0 Binary files /dev/null and b/sprites/paralyzed/speckledparalyzed.png differ diff --git a/sprites/paralyzed/tabbyparalyzed.png b/sprites/paralyzed/tabbyparalyzed.png new file mode 100644 index 0000000..05b4791 Binary files /dev/null and b/sprites/paralyzed/tabbyparalyzed.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_flats.png b/sprites/paralyzed/tailless_paralyzed_flats.png new file mode 100644 index 0000000..bec6cc9 Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_flats.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_lineart.png b/sprites/paralyzed/tailless_paralyzed_lineart.png new file mode 100644 index 0000000..5505601 Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_lineart.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_skin.png b/sprites/paralyzed/tailless_paralyzed_skin.png new file mode 100644 index 0000000..3e0ac19 Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_skin.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_speckled.png b/sprites/paralyzed/tailless_paralyzed_speckled.png new file mode 100644 index 0000000..e9b2ada Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_speckled.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_tabby.png b/sprites/paralyzed/tailless_paralyzed_tabby.png new file mode 100644 index 0000000..29366e4 Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_tabby.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_torties.png b/sprites/paralyzed/tailless_paralyzed_torties.png new file mode 100644 index 0000000..e1ee8d9 Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_torties.png differ diff --git a/sprites/paralyzed/tailless_paralyzed_whites.png b/sprites/paralyzed/tailless_paralyzed_whites.png new file mode 100644 index 0000000..c7af8ab Binary files /dev/null and b/sprites/paralyzed/tailless_paralyzed_whites.png differ diff --git a/sprites/paralyzed/tortiesparalyzed.png b/sprites/paralyzed/tortiesparalyzed.png new file mode 100644 index 0000000..b149f35 Binary files /dev/null and b/sprites/paralyzed/tortiesparalyzed.png differ diff --git a/sprites/paralyzed/whiteallparalyzed.png b/sprites/paralyzed/whiteallparalyzed.png new file mode 100644 index 0000000..4c281bd Binary files /dev/null and b/sprites/paralyzed/whiteallparalyzed.png differ diff --git a/sprites/rosettecolours.png b/sprites/rosettecolours.png index d33303b..42c67f6 100644 Binary files a/sprites/rosettecolours.png and b/sprites/rosettecolours.png differ diff --git a/sprites/singlecolours.png b/sprites/singlecolours.png index f65a948..b8b011d 100644 Binary files a/sprites/singlecolours.png and b/sprites/singlecolours.png differ diff --git a/sprites/singlestripecolours.png b/sprites/singlestripecolours.png index d531753..e3523ba 100644 Binary files a/sprites/singlestripecolours.png and b/sprites/singlestripecolours.png differ diff --git a/sprites/smokecolours.png b/sprites/smokecolours.png index 12830e0..ed36511 100644 Binary files a/sprites/smokecolours.png and b/sprites/smokecolours.png differ diff --git a/sprites/sokokecolours.png b/sprites/sokokecolours.png index 29e430a..aabc6cd 100644 Binary files a/sprites/sokokecolours.png and b/sprites/sokokecolours.png differ diff --git a/sprites/speckledcolours.png b/sprites/speckledcolours.png index 628a580..243a5cb 100644 Binary files a/sprites/speckledcolours.png and b/sprites/speckledcolours.png differ diff --git a/sprites/tabbycolours.png b/sprites/tabbycolours.png index 600e88d..d607abe 100644 Binary files a/sprites/tabbycolours.png and b/sprites/tabbycolours.png differ diff --git a/sprites/tickedcolours.png b/sprites/tickedcolours.png index aefb722..147852d 100644 Binary files a/sprites/tickedcolours.png and b/sprites/tickedcolours.png differ diff --git a/sprites/tortiepatchesmasks.png b/sprites/tortiepatchesmasks.png index 67cdcf8..7ffe9ea 100644 Binary files a/sprites/tortiepatchesmasks.png and b/sprites/tortiepatchesmasks.png differ diff --git a/sprites/whitepatches.png b/sprites/whitepatches.png index 1fe87c4..6470665 100644 Binary files a/sprites/whitepatches.png and b/sprites/whitepatches.png differ