2024-04-25 00:27:13 -04:00
|
|
|
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
|
|
--
|
|
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
|
2024-05-11 06:01:07 -04:00
|
|
|
with core, ui;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-05-11 03:38:33 -04:00
|
|
|
package body equipment is
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-19 15:06:20 -04:00
|
|
|
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 "/";
|
2024-05-19 02:59:45 -04:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
procedure configure is
|
2024-06-01 15:36:15 -04:00
|
|
|
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;
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-05-11 03:38:33 -04:00
|
|
|
core.echo (core.comment, "Configuring equipment components...");
|
2024-03-11 08:42:25 -04:00
|
|
|
--
|
2024-06-01 15:36:15 -04:00
|
|
|
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);
|
|
|
|
--
|
2024-04-27 10:01:54 -04:00
|
|
|
for index in enumeration loop
|
2024-06-01 11:27:59 -04:00
|
|
|
declare folder : constant string := core.lowercase (slot'image (description (index).kind));
|
2024-04-27 10:01:54 -04:00
|
|
|
file : constant string := core.lowercase (enumeration'image (index));
|
2024-02-16 05:52:11 -05:00
|
|
|
begin
|
2024-05-19 02:59:45 -04:00
|
|
|
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);
|
2024-02-16 05:52:11 -05:00
|
|
|
end;
|
2024-02-15 21:03:09 -05:00
|
|
|
end loop;
|
|
|
|
end configure;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-09 05:07:20 -04:00
|
|
|
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-05-16 14:52:41 -04:00
|
|
|
core.draw (sprite (index), x, y, state => state);
|
2024-02-15 21:03:09 -05:00
|
|
|
end draw;
|
|
|
|
|
2024-05-11 06:01:07 -04:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer) is
|
2024-05-19 15:06:20 -04:00
|
|
|
use type core.cursor_code;
|
2024-05-11 06:01:07 -04:00
|
|
|
begin
|
|
|
|
draw (index, state, x, y);
|
|
|
|
--
|
2024-05-17 20:02:37 -04:00
|
|
|
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height)
|
2024-05-22 21:05:19 -04:00
|
|
|
and core.cursor_mode = core.cursor_middle
|
2024-05-17 20:02:37 -04:00
|
|
|
and index / none
|
|
|
|
and not ui.prioritize then
|
2024-06-01 15:36:15 -04:00
|
|
|
core.write_text_box (core.bound (description (index).name));
|
2024-05-11 06:01:07 -04:00
|
|
|
end if;
|
|
|
|
end draw_plus;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-11 03:38:33 -04:00
|
|
|
end equipment;
|