From d4f4ac85307f81a1a66cc718e55dd42d0d0bc367 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 9 Oct 2023 23:10:19 -0400 Subject: [PATCH] Core item implementation... --- xabina.adb | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 12 deletions(-) diff --git a/xabina.adb b/xabina.adb index 2b7cd0d..3b874ea 100644 --- a/xabina.adb +++ b/xabina.adb @@ -133,6 +133,88 @@ function xabina return integer is -- Item ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + type item_list is ( + WOOD, BARK, FLAX, PLANK, STICK, BRACES, NAILS, LINEN, + CHAMOMILE, MINT, WAX, SALT, SUGAR, PEPPER, CINNAMON, YEAST, + SKULL, BONE, INTESTINES, FUR, LEATHER, FAT, HORN, TUSK, + COPPER_ORE, IRON_ORE, SILVER_ORE, GOLD_ORE, COAL_ORE, TIN_ORE, ZINC_ORE, LEAD_ORE, + COPPER, IRON, SILVER, GOLD, COAL, TIN, ZINC, LEAD, + BRONZE, BRASS, STEEL, MERCURY, OIL, INK, VENOM, SILK, + PAPERS, PAPERWEIGHT + ); + + type item_mark is mod 72; + + type item_constant_type is new entity_constant_type with + record + value : natural := 0; + weight : natural := 0; + -- description : unbounded_string := null_unbounded_string; + end record; + + type item_variable_type is new entity_variable_type with + record + owner : natural := 0; + end record; + + type item_constant_list is array (item_list) of item_constant_type; + type item_variable_list is array (item_mark) of item_variable_type; + + item_constant_data : constant item_constant_list := ( + (ENTITY_ITEM, to_unbounded_string ("Wood"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2), + (ENTITY_ITEM, to_unbounded_string ("Bark"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 2), + (ENTITY_ITEM, to_unbounded_string ("Flax"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1), + (ENTITY_ITEM, to_unbounded_string ("Plank"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2), + (ENTITY_ITEM, to_unbounded_string ("Stick"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2), + (ENTITY_ITEM, to_unbounded_string ("Braces"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1), + (ENTITY_ITEM, to_unbounded_string ("Nails"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1), + (ENTITY_ITEM, to_unbounded_string ("Linen"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 1), + (ENTITY_ITEM, to_unbounded_string ("Chamomile"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1), + (ENTITY_ITEM, to_unbounded_string ("Mint"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1), + (ENTITY_ITEM, to_unbounded_string ("Wax"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 1), + (ENTITY_ITEM, to_unbounded_string ("Salt"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1), + (ENTITY_ITEM, to_unbounded_string ("Sugar"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 1), + (ENTITY_ITEM, to_unbounded_string ("Pepper"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 1), + (ENTITY_ITEM, to_unbounded_string ("Cinnamon"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 1), + (ENTITY_ITEM, to_unbounded_string ("Yeast"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1), + (ENTITY_ITEM, to_unbounded_string ("Skull"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1), + (ENTITY_ITEM, to_unbounded_string ("Bone"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1), + (ENTITY_ITEM, to_unbounded_string ("Intestines"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1), + (ENTITY_ITEM, to_unbounded_string ("Fur"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 2), + (ENTITY_ITEM, to_unbounded_string ("Leather"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1), + (ENTITY_ITEM, to_unbounded_string ("Fat"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1), + (ENTITY_ITEM, to_unbounded_string ("Horn"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1), + (ENTITY_ITEM, to_unbounded_string ("Tusk"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 5), + (ENTITY_ITEM, to_unbounded_string ("Copper Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 7), + (ENTITY_ITEM, to_unbounded_string ("Iron Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 11), + (ENTITY_ITEM, to_unbounded_string ("Silver Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 7), + (ENTITY_ITEM, to_unbounded_string ("Gold Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 7), + (ENTITY_ITEM, to_unbounded_string ("Coal Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 7), + (ENTITY_ITEM, to_unbounded_string ("Tin Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 7), + (ENTITY_ITEM, to_unbounded_string ("Zinc Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 7), + (ENTITY_ITEM, to_unbounded_string ("Lead Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 13), + (ENTITY_ITEM, to_unbounded_string ("Copper"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 5), + (ENTITY_ITEM, to_unbounded_string ("Iron"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 19, 7), + (ENTITY_ITEM, to_unbounded_string ("Silver"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 5), + (ENTITY_ITEM, to_unbounded_string ("Gold"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 29, 5), + (ENTITY_ITEM, to_unbounded_string ("Coal"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 19, 5), + (ENTITY_ITEM, to_unbounded_string ("Tin"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 5), + (ENTITY_ITEM, to_unbounded_string ("Zinc"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 5), + (ENTITY_ITEM, to_unbounded_string ("Lead"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 47, 7), + (ENTITY_ITEM, to_unbounded_string ("Bronze"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 61, 5), + (ENTITY_ITEM, to_unbounded_string ("Brass"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 67, 5), + (ENTITY_ITEM, to_unbounded_string ("Steel"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 71, 7), + (ENTITY_ITEM, to_unbounded_string ("Mercury"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 97, 11), + (ENTITY_ITEM, to_unbounded_string ("Oil"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1), + (ENTITY_ITEM, to_unbounded_string ("Ink"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1), + (ENTITY_ITEM, to_unbounded_string ("Venom"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 1), + (ENTITY_ITEM, to_unbounded_string ("Silk"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1), + (ENTITY_ITEM, to_unbounded_string ("Papers"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1), + (ENTITY_ITEM, to_unbounded_string ("Paperweight"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1) + ); + + item_variable_data : item_variable_list; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- Spell ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -172,14 +254,14 @@ function xabina return integer is type weapon_variable_list is array (weapon_mark) of weapon_variable_type; weapon_constant_data : constant weapon_constant_list := ( - (ENTITY_WEAPON, to_unbounded_string ("Iron Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 31, 11, (3, 7), (0, 2), (0, 1)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 67, 19, (5, 11), (1, 3), (0, 2)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 43, 13, (1, 7), (0, 2), (0, 1)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 73, 17, (6, 13), (1, 2), (0, 2)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 53, 11, (4, 10), (2, 4), (0, 2)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 37, 13, (0, 3), (4, 9), (0, 1)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 41, 11, (3, 8), (0, 2), (0, 1)), - (ENTITY_WEAPON, to_unbounded_string ("Iron Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 47, 13, (4, 7), (0, 3), (0, 1)) + (ENTITY_WEAPON, to_unbounded_string ("Iron Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, (3, 7), (0, 2), (0, 1)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, (5, 11), (1, 3), (0, 2)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, (1, 7), (0, 2), (0, 1)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, (6, 13), (1, 2), (0, 2)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, (4, 10), (2, 4), (0, 2)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, (0, 3), (4, 9), (0, 1)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, (3, 8), (0, 2), (0, 1)), + (ENTITY_WEAPON, to_unbounded_string ("Iron Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, (4, 7), (0, 3), (0, 1)) ); weapon_variable_data : weapon_variable_list; @@ -257,13 +339,12 @@ function xabina return integer is begin - for this in weapon_list + for this in item_list loop - put_line ("> " & to_string (weapon_constant_data (this).name)); + x := x + render_character (item_constant_data (this).symbol, item_constant_data (this).colour, item_constant_data (this).effect); + put_line (" " & to_string (item_constant_data (this).name)); end loop; - x := x + render_character ('@', COLOUR_BLUE, EFFECT_BOLD); - return 0; end xabina;