-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic -- -- GNU General Public Licence (version 3 or later) with core, ui; package body equipment is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ function "=" (a, b : in enumeration) return boolean is begin return natural (enumeration'pos (a)) = natural (enumeration'pos (b)); end "="; function "/" (a, b : in enumeration) return boolean is begin return natural (enumeration'pos (a)) /= natural (enumeration'pos (b)); end "/"; ------------------------------------------------------------------------------------------ procedure configure is procedure define (index : in enumeration; name : in string; kind : in slot; attributes : in attribute.bonus := (others => 0); favor : in faction.enumeration := faction.neutral; evoke : in effect.information := effect.none) is begin description (index).name := core.unbound (name); description (index).kind := kind; description (index).attributes := attributes; description (index).favor := favor; description (index).evoke := evoke; end define; begin core.echo (core.comment, "Configuring equipment components..."); -- define (none, "--", full_body); define (bone_chestplate, "Bone Chestplate", chest); define (bronze_chestplate, "Bronze Chestplate", chest); define (chainmail_chestplate, "Chainmail Chestplate", chest); define (crystal_chestplate, "Crystal Chestplate", chest); define (golden_chestplate, "Golden Chestplate", chest); define (iron_chestplate, "Iron Chestplate", chest); define (leather_chestplate, "Leather Chestplate", chest); define (mithril_chestplate, "Mithril Chestplate", chest); define (steel_chestplate, "Steel Chestplate", chest); define (bone_greaves, "Bone Greaves", feet); define (bronze_greaves, "Bronze Greaves", feet); define (chainmail_greaves, "Chainmail Greaves", feet); define (crystal_greaves, "Crystal Greaves", feet); define (golden_greaves, "Golden Greaves", feet); define (iron_greaves, "Iron Greaves", feet); define (leather_greaves, "Leather Greaves", feet); define (mithril_greaves, "Mithril Greaves", feet); define (steel_greaves, "Steel Greaves", feet); define (black_tunic, "Black Tunic", full_body); define (blue_tunic, "Blue Tunic", full_body); define (cyan_tunic, "Cyan Tunic", full_body); define (green_tunic, "Green Tunic", full_body); define (grey_tunic, "Grey Tunic", full_body); define (lime_tunic, "Lime Tunic", full_body); define (orange_tunic, "Orange Tunic", full_body); define (pink_tunic, "Pink Tunic", full_body); define (purple_tunic, "Purple Tunic", full_body); define (red_tunic, "Red Tunic", full_body); define (white_tunic, "White Tunic", full_body); define (yellow_tunic, "Yellow Tunic", full_body); define (bone_gauntlets, "Bone Gauntlets", hands); define (bronze_gauntlets, "Bronze Gauntlets", hands); define (chainmail_gauntlets, "Chainmail Gauntlets", hands); define (crystal_gauntlets, "Crystal Gauntlets", hands); define (golden_gauntlets, "Golden Gauntlets", hands); define (iron_gauntlets, "Iron Gauntlets", hands); define (leather_gauntlets, "Leather Gauntlets", hands); define (mithril_gauntlets, "Mithril Gauntlets", hands); define (steel_gauntlets, "Steel Gauntlets", hands); define (bone_helmet, "Bone Helmet", head); define (bronze_helmet, "Bronze Helmet", head); define (chainmail_helmet, "Chainmail Helmet", head); define (crystal_helmet, "Crystal Helmet", head); define (golden_helmet, "Golden Helmet", head); define (iron_helmet, "Iron Helmet", head); define (leather_helmet, "Leather Helmet", head); define (mithril_helmet, "Mithril Helmet", head); define (steel_helmet, "Steel Helmet", head); define (bone_axe, "Bone Axe", main_hand); define (bone_battleaxe, "Bone Battleaxe", main_hand); define (bone_bow, "Bone Bow", main_hand); define (bone_mace, "Bone Mace", main_hand); define (bone_spear, "Bone Spear", main_hand); define (bone_sword, "Bone Sword", main_hand); define (bronze_axe, "Bronze Axe", main_hand); define (bronze_greatsword, "Bronze Greatsword", main_hand); define (bronze_mace, "Bronze Mace", main_hand); define (bronze_spear, "Bronze Spear", main_hand); define (bronze_sword, "Bronze Sword", main_hand); define (club, "Club", main_hand); define (crystal_bow, "Crystal Bow", main_hand); define (crystal_greatsword, "Crystal Greatsword", main_hand); define (crystal_mace, "Crystal Mace", main_hand); define (crystal_spear, "Crystal Spear", main_hand); define (crystal_sword, "Crystal Sword", main_hand); define (golden_axe, "Golden Axe", main_hand); define (golden_battleaxe, "Golden Battleaxe", main_hand); define (golden_bow, "Golden Bow", main_hand); define (golden_greatsword, "Golden Greatsword", main_hand); define (golden_sword, "Golden Sword", main_hand); define (iron_axe, "Iron Axe", main_hand); define (iron_bow, "Iron Bow", main_hand); define (iron_mace, "Iron Mace", main_hand); define (iron_spear, "Iron Spear", main_hand); define (iron_sword, "Iron Sword", main_hand); define (jade_axe, "Jade Axe", main_hand); define (jade_battleaxe, "Jade Battleaxe", main_hand); define (jade_greatsword, "Jade Greatsword", main_hand); define (jade_mace, "Jade Mace", main_hand); define (jade_spear, "Jade Spear", main_hand); define (jade_sword, "Jade Sword", main_hand); define (maul, "Maul", main_hand); define (mithril_axe, "Mithril Axe", main_hand); define (mithril_battleaxe, "Mithril Battleaxe", main_hand); define (mithril_bow, "Mithril Bow", main_hand); define (mithril_mace, "Mithril Mace", main_hand); define (mithril_spear, "Mithril Spear", main_hand); define (sledge_hammer, "Sledge Hammer", main_hand); define (spiked_club, "Spiked Club", main_hand); define (spiked_staff, "Spiked Staff", main_hand); define (staff, "Staff", main_hand); define (steel_battleaxe, "Steel Battleaxe", main_hand); define (steel_bow, "Steel Bow", main_hand); define (steel_greatsword, "Steel Greatsword", main_hand); define (steel_mace, "Steel Mace", main_hand); define (steel_sword, "Steel Sword", main_hand); define (wooden_bow, "Wooden Bow", main_hand); define (wooden_greatsword, "Wooden Greatsword", main_hand); define (wooden_sword, "Wooden Sword", main_hand); define (golden_necklace, "Golden Necklace", neck); define (bronze_shield, "Bronze Shield", off_hand); define (crystal_shield, "Crystal Shield", off_hand); define (golden_shield, "Golden Shield", off_hand); define (iron_shield, "Iron Shield", off_hand); define (mithril_shield, "Mithril Shield", off_hand); define (steel_shield, "Steel Shield", off_hand); define (wooden_shield, "Wooden Shield", off_hand); define (wooden_armour, "Wooden Armour", chest); define (fur_armour, "Fur Armour", chest); define (fur_greaves, "Fur Greaves", feet); define (fur_gauntlets, "Fur Gauntlets", hands); define (red_hood, "Red Hood", head); define (white_hood, "White Hood", head); define (wooden_helmet, "Wooden Helmet", head); define (human_helmet, "Human Helmet", head); define (human_armour, "Human Armour", chest); define (elven_helmet, "Elven Helmet", head); define (elven_armour, "Elven Armour", chest); define (orcish_helmet, "Orcish Helmet", head); define (orcish_armour, "Orcish Armour", chest); define (black_robe, "Black Robe", full_body); define (cyan_robe, "Cyan Robe", full_body); define (lime_dress, "Lime Dress", full_body); define (magenta_dress, "Magenta Dress", full_body); define (orange_robe, "Orange Robe", full_body); define (pink_dress, "Pink Dress", full_body); define (red_robe, "Red Robe", full_body); define (sexy_dress, "Sexy Dress", full_body); define (white_robe, "White Robe", full_body); define (lime_robe, "Lime Robe", full_body); define (orange_hood, "Orange Hood", head); define (fur_helmet, "Fur Helmet", head); define (black_hood, "Black Hood", head); define (cyan_hood, "Cyan Hood", head); define (lime_hood, "Lime Hood", head); -- for index in enumeration loop declare folder : constant string := core.lowercase (slot'image (description (index).kind)); file : constant string := core.lowercase (enumeration'image (index)); begin sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6); icon (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1); end; end loop; end configure; ------------------------------------------------------------------------------------------ procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is begin core.draw (sprite (index), x, y, state => state); end draw; ------------------------------------------------------------------------------------------ procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer) is use type core.cursor_code; begin draw (index, state, x, y); -- if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_middle and index / none and not ui.prioritize then core.write_text_box (core.bound (description (index).name)); end if; end draw_plus; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end equipment;