From b9e0329431b3eae8b4d8eaf9cb155e76d8fcbdce Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 5 Jun 2024 16:04:29 -0400 Subject: [PATCH] Defining some dwarven units... --- source/equipment.ads | 34 +++++++++++------------ source/main.adb | 2 +- source/unit.ads | 77 +++++++++++++++++++++++++++++++++++++++------------- source/world.adb | 15 ++++++---- 4 files changed, 85 insertions(+), 43 deletions(-) diff --git a/source/equipment.ads b/source/equipment.ads index daeb046..83142bb 100644 --- a/source/equipment.ads +++ b/source/equipment.ads @@ -62,9 +62,9 @@ package equipment is none => (others => <>), -- golden_axe => (new string'("Golden Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.fairy, effect.none), - golden_battleaxe => (new string'("Golden Battleaxe"), main_hand, (3, 0, 0, 0, 0, 0), faction.fairy, effect.none), + golden_battleaxe => (new string'("Golden Battleaxe"), main_hand, (3, 0, 0, 0, 0, 1), faction.fairy, effect.none), golden_bow => (new string'("Golden Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.fairy, effect.none), - golden_greatsword => (new string'("Golden Greatsword"), main_hand, (3, 0, 0, 0, 0, 0), faction.fairy, effect.none), + golden_greatsword => (new string'("Golden Greatsword"), main_hand, (3, 0, 0, 0, 0, 1), faction.fairy, effect.none), golden_sword => (new string'("Golden Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.fairy, effect.none), golden_shield => (new string'("Golden Shield"), off_hand, (0, 3, 0, 0, 0, 0), faction.fairy, effect.none), golden_helmet => (new string'("Golden Helmet"), head, (0, 2, 0, 0, 0, 0), faction.fairy, effect.none), @@ -72,10 +72,10 @@ package equipment is golden_gauntlets => (new string'("Golden Gauntlets"), hands, (0, 1, 0, 0, 0, 0), faction.fairy, effect.none), golden_greaves => (new string'("Golden Greaves"), feet, (0, 1, 0, 0, 0, 0), faction.fairy, effect.none), mithril_axe => (new string'("Mithril Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.dwarf, effect.none), - mithril_battleaxe => (new string'("Mithril Battleaxe"), main_hand, (4, 0, 0, 0, 0, 0), faction.dwarf, effect.none), + mithril_battleaxe => (new string'("Mithril Battleaxe"), main_hand, (4, 0, 0, 0, 0, 1), faction.dwarf, effect.none), mithril_bow => (new string'("Mithril Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.dwarf, effect.none), mithril_mace => (new string'("Mithril Mace"), main_hand, (1, 0, 0, 0, 0, 0), faction.dwarf, effect.none), - mithril_spear => (new string'("Mithril Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.dwarf, effect.none), + mithril_spear => (new string'("Mithril Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.dwarf, effect.none), mithril_shield => (new string'("Mithril Shield"), off_hand, (0, 4, 0, 0, 0, 0), faction.dwarf, effect.none), mithril_helmet => (new string'("Mithril Helmet"), head, (0, 3, 0, 0, 0, 0), faction.dwarf, effect.none), mithril_chestplate => (new string'("Mithril Chestplate"), chest, (0, 4, 0, 0, 0, 0), faction.dwarf, effect.none), @@ -84,16 +84,16 @@ package equipment is iron_axe => (new string'("Iron Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.gnoll, effect.none), iron_bow => (new string'("Iron Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.gnoll, effect.none), iron_mace => (new string'("Iron Mace"), main_hand, (2, 0, 0, 0, 0, 0), faction.gnoll, effect.none), - iron_spear => (new string'("Iron Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.gnoll, effect.none), + iron_spear => (new string'("Iron Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.gnoll, effect.none), iron_sword => (new string'("Iron Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.gnoll, effect.none), iron_shield => (new string'("Iron Shield"), off_hand, (0, 3, 0, 0, 0, 0), faction.gnoll, effect.none), iron_helmet => (new string'("Iron Helmet"), head, (0, 2, 0, 0, 0, 0), faction.gnoll, effect.none), iron_chestplate => (new string'("Iron Chestplate"), chest, (0, 3, 0, 0, 0, 0), faction.gnoll, effect.none), iron_gauntlets => (new string'("Iron Gauntlets"), hands, (0, 1, 0, 0, 0, 0), faction.gnoll, effect.none), iron_greaves => (new string'("Iron Greaves"), feet, (0, 1, 0, 0, 0, 0), faction.gnoll, effect.none), - steel_battleaxe => (new string'("Steel Battleaxe"), main_hand, (3, 0, 0, 0, 0, 0), faction.kobold, effect.none), + steel_battleaxe => (new string'("Steel Battleaxe"), main_hand, (3, 0, 0, 0, 0, 1), faction.kobold, effect.none), steel_bow => (new string'("Steel Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.kobold, effect.none), - steel_greatsword => (new string'("Steel Greatsword"), main_hand, (3, 0, 0, 0, 0, 0), faction.kobold, effect.none), + steel_greatsword => (new string'("Steel Greatsword"), main_hand, (3, 0, 0, 0, 0, 1), faction.kobold, effect.none), steel_mace => (new string'("Steel Mace"), main_hand, (2, 0, 0, 0, 0, 0), faction.kobold, effect.none), steel_sword => (new string'("Steel Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.kobold, effect.none), steel_shield => (new string'("Steel Shield"), off_hand, (0, 2, 0, 0, 0, 0), faction.kobold, effect.none), @@ -102,19 +102,19 @@ package equipment is steel_gauntlets => (new string'("Steel Gauntlets"), hands, (0, 1, 0, 0, 0, 0), faction.kobold, effect.none), steel_greaves => (new string'("Steel Greaves"), feet, (0, 1, 0, 0, 0, 0), faction.kobold, effect.none), bone_axe => (new string'("Bone Axe"), main_hand, (1, 0, 0, 0, 0, 0), faction.goblin, effect.none), - bone_battleaxe => (new string'("Bone Battleaxe"), main_hand, (3, 0, 0, 0, 0, 0), faction.goblin, effect.none), + bone_battleaxe => (new string'("Bone Battleaxe"), main_hand, (3, 0, 0, 0, 0, 1), faction.goblin, effect.none), bone_bow => (new string'("Bone Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.goblin, effect.none), bone_mace => (new string'("Bone Mace"), main_hand, (2, 0, 0, 0, 0, 0), faction.goblin, effect.none), - bone_spear => (new string'("Bone Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.goblin, effect.none), + bone_spear => (new string'("Bone Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.goblin, effect.none), bone_sword => (new string'("Bone Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.goblin, effect.none), bone_helmet => (new string'("Bone Helmet"), head, (0, 2, 0, 0, 0, 0), faction.goblin, effect.none), bone_chestplate => (new string'("Bone Chestplate"), chest, (0, 2, 0, 0, 1, 0), faction.goblin, effect.none), bone_gauntlets => (new string'("Bone Gauntlets"), hands, (0, 1, 0, 0, 0, 0), faction.goblin, effect.none), bone_greaves => (new string'("Bone Greaves"), feet, (0, 1, 0, 0, 0, 0), faction.goblin, effect.none), crystal_bow => (new string'("Crystal Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.imp, effect.none), - crystal_greatsword => (new string'("Crystal Greatsword"), main_hand, (4, 0, 0, 0, 0, 0), faction.imp, effect.none), + crystal_greatsword => (new string'("Crystal Greatsword"), main_hand, (4, 0, 0, 0, 0, 1), faction.imp, effect.none), crystal_mace => (new string'("Crystal Mace"), main_hand, (1, 0, 0, 0, 0, 0), faction.imp, effect.none), - crystal_spear => (new string'("Crystal Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.imp, effect.none), + crystal_spear => (new string'("Crystal Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.imp, effect.none), crystal_sword => (new string'("Crystal Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.imp, effect.none), crystal_shield => (new string'("Crystal Shield"), off_hand, (0, 3, 0, 0, 0, 0), faction.imp, effect.none), crystal_helmet => (new string'("Crystal Helmet"), head, (0, 2, 0, 0, 0, 0), faction.imp, effect.none), @@ -128,9 +128,9 @@ package equipment is orcish_helmet => (new string'("Orcish Helmet"), head, (0, 4, 0, 0, 0, 0), faction.orc, effect.none), orcish_armour => (new string'("Orcish Armour"), chest, (0, 5, 0, 0, 0, 0), faction.orc, effect.none), bronze_axe => (new string'("Bronze Axe"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), - bronze_greatsword => (new string'("Bronze Greatsword"), main_hand, (3, 0, 0, 0, 0, 0), faction.neutral, effect.none), + bronze_greatsword => (new string'("Bronze Greatsword"), main_hand, (3, 0, 0, 0, 0, 1), faction.neutral, effect.none), bronze_mace => (new string'("Bronze Mace"), main_hand, (2, 0, 0, 0, 0, 0), faction.neutral, effect.none), - bronze_spear => (new string'("Bronze Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), + bronze_spear => (new string'("Bronze Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.neutral, effect.none), bronze_sword => (new string'("Bronze Sword"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), bronze_shield => (new string'("Bronze Shield"), off_hand, (0, 2, 0, 0, 0, 0), faction.neutral, effect.none), bronze_helmet => (new string'("Bronze Helmet"), head, (0, 2, 0, 0, 0, 0), faction.neutral, effect.none), @@ -150,16 +150,16 @@ package equipment is fur_gauntlets => (new string'("Fur Gauntlets"), hands, (0, 1, 0, 0, 1, 0), faction.neutral, effect.none), fur_greaves => (new string'("Fur Greaves"), feet, (0, 1, 0, 0, 1, 0), faction.neutral, effect.none), wooden_sword => (new string'("Wooden Sword"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), - wooden_greatsword => (new string'("Wooden Greatsword"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), + wooden_greatsword => (new string'("Wooden Greatsword"), main_hand, (1, 0, 0, 0, 0, 1), faction.neutral, effect.none), wooden_bow => (new string'("Wooden Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), wooden_shield => (new string'("Wooden Shield"), off_hand, (0, 2, 0, 0, 0, 0), faction.neutral, effect.none), wooden_helmet => (new string'("Wooden Helmet"), head, (0, 1, 0, 0, 0, 0), faction.neutral, effect.none), wooden_armour => (new string'("Wooden Armour"), chest, (0, 1, 0, 0, 1, 0), faction.neutral, effect.none), jade_axe => (new string'("Jade Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.neutral, effect.none), - jade_battleaxe => (new string'("Jade Battleaxe"), main_hand, (4, 0, 0, 0, 0, 0), faction.neutral, effect.none), - jade_greatsword => (new string'("Jade Greatsword"), main_hand, (3, 0, 0, 0, 0, 0), faction.neutral, effect.none), + jade_battleaxe => (new string'("Jade Battleaxe"), main_hand, (4, 0, 0, 0, 0, 1), faction.neutral, effect.none), + jade_greatsword => (new string'("Jade Greatsword"), main_hand, (3, 0, 0, 0, 0, 1), faction.neutral, effect.none), jade_mace => (new string'("Jade Mace"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), - jade_spear => (new string'("Jade Spear"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), + jade_spear => (new string'("Jade Spear"), main_hand, (1, 0, 0, 0, 0, 1), faction.neutral, effect.none), jade_sword => (new string'("Jade Sword"), main_hand, (2, 0, 0, 0, 0, 0), faction.neutral, effect.none), club => (new string'("Club"), main_hand, (1, 0, 0, 0, 0, 0), faction.neutral, effect.none), spiked_club => (new string'("Spiked Club"), main_hand, (2, 0, 0, 0, 0, 0), faction.neutral, effect.none), diff --git a/source/main.adb b/source/main.adb index b0498cd..19c7837 100644 --- a/source/main.adb +++ b/source/main.adb @@ -294,7 +294,7 @@ begin --~core.cursor_mode := core.cursor_none; - world.load ("heyo"); + --~world.load ("heyo"); ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1); diff --git a/source/unit.ads b/source/unit.ads index 2bade59..6310a26 100644 --- a/source/unit.ads +++ b/source/unit.ads @@ -9,17 +9,22 @@ package unit is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type enumeration is ( - dwarf_berserker, dwarf_elite_berserker, dwarf_guard, dwarf_elite_guard + none, + dwarf_villager, dwarf_miner, dwarf_blacksmith, dwarf_hunter, dwarf_bowman, dwarf_warrior, + dwarf_axeman, dwarf_crossbowman, dwarf_berserker, dwarf_guard, dwarf_elite_guard, dwarf_war_druid, + dwarf_pig_rider, dwarf_boar_rider, dwarf_giant_mole_rider, dwarf_siegebowman, dwarf_knight, dwarf_flag_carrier ); ------------------------------------------------------------------------------------------ type definition is record - name : core.short_string := "-- "; - kind : faction.enumeration := faction.neutral; - attributes : attribute.bonus := (others => 0); - daily_fee : natural := 0; - equipments : equipment.equip_array := (others => equipment.none); + name : access string := new string'("--"); + kind : faction.enumeration := faction.neutral; + attributes : attribute.bonus := (others => 0); + hire_fee : natural := 0; + weekly_fee : natural := 0; + battle_fee : natural := 0; + equipments : equipment.equip_array := equipment.default; end record; --~bone_chestplate, bronze_chestplate, chainmail_chestplate, crystal_chestplate, golden_chestplate, iron_chestplate, @@ -46,26 +51,60 @@ package unit is --~red_robe, sexy_dress, white_robe, lime_robe, orange_hood, fur_helmet, --~black_hood, cyan_hood, lime_hood - --~full_body, head, chest, hands, feet, neck, - --~main_hand, off_hand + --~full_body, head, chest, hands, + --~feet, neck, main_hand, off_hand ------------------------------------------------------------------------------------------ count : constant natural := enumeration'pos (enumeration'last) + 1; description : constant array (enumeration) of definition := ( - dwarf_berserker => ("Dwarf Berserker ", faction.dwarf, (3, 2, 1, 3, 2, 2), 1, ( - equipment.blue_tunic, equipment.leather_helmet, equipment.leather_chestplate, equipment.none, + none => (others => <>), + -- + dwarf_villager => (new string'("Villager"), faction.dwarf, (2, 1, 1, 1, 2, 1), 2, 1, 1, ( + equipment.grey_tunic, equipment.none, equipment.none, equipment.none, + equipment.none, equipment.none, equipment.club, equipment.none)), + dwarf_miner => (new string'("Miner"), faction.dwarf, (2, 1, 1, 1, 2, 1), 2, 1, 1, ( -- todo + equipment.grey_tunic, equipment.none, equipment.none, equipment.fur_gauntlets, + equipment.fur_greaves, equipment.none, equipment.none, equipment.none)), + dwarf_blacksmith => (new string'("Blacksmith"), faction.dwarf, (2, 1, 1, 1, 2, 1), 3, 1, 2, ( -- todo + equipment.grey_tunic, equipment.leather_helmet, equipment.none, equipment.leather_gauntlets, + equipment.leather_greaves, equipment.none, equipment.sledge_hammer, equipment.none)), + dwarf_hunter => (new string'("Hunter"), faction.dwarf, (2, 1, 1, 1, 2, 1), 3, 2, 2, ( -- todo + equipment.grey_tunic, equipment.none, equipment.leather_chestplate, equipment.fur_gauntlets, + equipment.fur_greaves, equipment.none, equipment.wooden_bow, equipment.none)), + dwarf_bowman => (new string'("Bowman"), faction.dwarf, (2, 1, 1, 1, 2, 1), 5, 3, 2, ( -- todo + equipment.blue_tunic, equipment.leather_helmet, equipment.iron_chestplate, equipment.none, + equipment.leather_greaves, equipment.none, equipment.iron_bow, equipment.none)), + dwarf_warrior => (new string'("Warrior"), faction.dwarf, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( -- todo + equipment.blue_tunic, equipment.leather_helmet, equipment.iron_chestplate, equipment.leather_gauntlets, + equipment.leather_greaves, equipment.none, equipment.iron_mace, equipment.wooden_shield)), + dwarf_axeman => (new string'("Axeman"), faction.dwarf, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( -- todo + equipment.blue_tunic, equipment.leather_helmet, equipment.iron_chestplate, equipment.leather_gauntlets, + equipment.leather_greaves, equipment.none, equipment.iron_axe, equipment.wooden_shield)), + dwarf_crossbowman => (new string'("Crossbowman"), faction.dwarf, (2, 1, 1, 2, 2, 1), 7, 5, 3, ( -- todo + equipment.blue_tunic, equipment.iron_helmet, equipment.iron_chestplate, equipment.none, + equipment.leather_greaves, equipment.none, equipment.none, equipment.none)), + dwarf_berserker => (new string'("Berserker"), faction.dwarf, (3, 2, 1, 3, 3, 1), 7, 3, 5, ( + equipment.blue_tunic, equipment.none, equipment.none, equipment.leather_gauntlets, equipment.leather_greaves, equipment.none, equipment.iron_axe, equipment.none)), - dwarf_elite_berserker => ("Dwarf Elite Berserker ", faction.dwarf, (3, 2, 1, 3, 2, 2), 3, ( - equipment.cyan_tunic, equipment.mithril_helmet, equipment.mithril_chestplate, equipment.leather_gauntlets, - equipment.leather_greaves, equipment.none, equipment.mithril_axe, equipment.none)), - dwarf_guard => ("Dwarf Guard ", faction.dwarf, (3, 2, 1, 3, 2, 2), 4, ( - equipment.cyan_tunic, equipment.steel_helmet, equipment.steel_chestplate, equipment.leather_gauntlets, - equipment.leather_greaves, equipment.none, equipment.steel_battleaxe, equipment.steel_shield)), - dwarf_elite_guard => ("Dwarf Elite Guard ", faction.dwarf, (3, 2, 1, 3, 2, 2), 6, ( - equipment.cyan_tunic, equipment.steel_helmet, equipment.mithril_chestplate, equipment.steel_gauntlets, - equipment.steel_greaves, equipment.none, equipment.mithril_axe, equipment.steel_shield)) + dwarf_guard => (new string'("Guard"), faction.dwarf, (2, 3, 1, 3, 2, 1), 17, 5, 3, ( + equipment.cyan_tunic, equipment.iron_helmet, equipment.iron_chestplate, equipment.leather_gauntlets, + equipment.leather_greaves, equipment.none, equipment.iron_spear, equipment.iron_shield)), + dwarf_elite_guard => (new string'("Elite Guard"), faction.dwarf, (3, 3, 1, 3, 2, 1), 23, 7, 2, ( + equipment.cyan_tunic, equipment.mithril_helmet, equipment.mithril_chestplate, equipment.steel_gauntlets, + equipment.steel_greaves, equipment.none, equipment.mithril_spear, equipment.steel_shield)), + dwarf_war_druid => (new string'("War Druid"), faction.dwarf, (1, 1, 3, 1, 1, 1), 23, 3, 0, ( -- todo + equipment.black_robe, equipment.black_hood, equipment.none, equipment.none, + equipment.none, equipment.none, equipment.staff, equipment.none)), + dwarf_pig_rider => (new string'("Pig Rider"), faction.dwarf, others => <>), -- todo + dwarf_boar_rider => (new string'("Boar Rider"), faction.dwarf, others => <>), -- todo + dwarf_giant_mole_rider => (new string'("Giant Mole Rider"), faction.dwarf, others => <>), -- todo + dwarf_siegebowman => (new string'("Siegebowman"), faction.dwarf, others => <>), -- todo + dwarf_knight => (new string'("Knight"), faction.dwarf, (5, 3, 2, 3, 3, 1), 29, 7, 13, ( -- todo + equipment.cyan_robe, equipment.mithril_helmet, equipment.mithril_chestplate, equipment.mithril_gauntlets, + equipment.mithril_greaves, equipment.none, equipment.mithril_battleaxe, equipment.mithril_shield)), + dwarf_flag_carrier => (new string'("Flag Carrier"), faction.dwarf, others => <>) -- todo ); base : array (faction.fairy .. faction.imp) of core.sprite; diff --git a/source/world.adb b/source/world.adb index 2c94ac0..1a18cdd 100644 --- a/source/world.adb +++ b/source/world.adb @@ -20,7 +20,7 @@ package body world is location_limit : constant integer := 240; construction_limit : constant natural := 120; equipment_limit : constant natural := 300; - unit_limit : constant natural := 60; + unit_limit : constant natural := 600; tiles : array (biome) of core.sprite; @@ -255,7 +255,7 @@ package body world is end loop; -- for index in 1 .. unit_limit loop - map.units (index).index := core.random (0, unit.count - 1); + map.units (index).index := core.random (1, unit.count - 1); map.units (index).state := 0; <> map.units (index).x := core.random (0, map.width - 1); @@ -1032,10 +1032,13 @@ package body world is state => core.animation'val (map.units (index).state)); -- for slot in equipment.slot loop - core.draw (data => equipment.sprite (unit.description (unit.enumeration'val (map.units (index).index)).equipments (slot)), - x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom, - y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom, - state => core.animation'val (map.units (index).state)); + if equipment.enumeration'pos (unit.description (unit.enumeration'val (map.units (index).index)).equipments (slot)) + /= equipment.enumeration'pos (equipment.none) then + core.draw (data => equipment.sprite (unit.description (unit.enumeration'val (map.units (index).index)).equipments (slot)), + x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom, + y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom, + state => core.animation'val (map.units (index).state)); + end if; end loop; -- core.increment (drawn_units);