From bee22e4352bde23b21c6ca4ab6d3ec0129ab7d40 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 15 Jun 2024 04:54:30 -0400 Subject: [PATCH] Added monsters, separately from units for logical reasons... --- source/effect.ads | 4 +++- source/location.ads | 16 +++++++-------- source/material.ads | 2 ++ source/monster.ads | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ source/unit.ads | 37 +++++++++++++++++----------------- source/world.adb | 2 +- source/world.ads | 2 +- 7 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 source/monster.ads diff --git a/source/effect.ads b/source/effect.ads index 4fc5b9d..96aee0f 100644 --- a/source/effect.ads +++ b/source/effect.ads @@ -11,7 +11,9 @@ package effect is modify_attribute, modify_skill, modify_resource, - modify_material + append_material, + append_equipment, + append_monster ); ------------------------------------------------------------------------------------------ diff --git a/source/location.ads b/source/location.ads index e83f624..c4ad728 100644 --- a/source/location.ads +++ b/source/location.ads @@ -42,14 +42,14 @@ package location is well_of_strength => (new string'("Well of Strength"), true, 4, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)), old_dwarven_grave => (new string'("Old Dwarven Grave"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)), huge_ancient_urn => (new string'("Huge Ancient Urn"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)), - banana_tree => (new string'("Banana Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 12)), - apple_tree => (new string'("Apple Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 12)), - cherry_tree => (new string'("Cherry Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 12)), - lemon_tree => (new string'("Lemon Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 12)), - orange_tree => (new string'("Orange Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 12)), - pear_tree => (new string'("Pear Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 12)), - peach_tree => (new string'("Peach Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 12)), - plum_tree => (new string'("Plum Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 12)), + banana_tree => (new string'("Banana Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.banana), 4, true, 12)), + apple_tree => (new string'("Apple Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.apple), 6, true, 12)), + cherry_tree => (new string'("Cherry Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.cherry), 6, true, 12)), + lemon_tree => (new string'("Lemon Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.lemon), 6, true, 12)), + orange_tree => (new string'("Orange Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.orange), 6, true, 12)), + pear_tree => (new string'("Pear Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.pear), 6, true, 12)), + peach_tree => (new string'("Peach Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.peach), 6, true, 12)), + plum_tree => (new string'("Plum Tree"), true, 4, (effect.append_material, material.enumeration'pos (material.plum), 6, true, 12)), pillars_of_observation => (new string'("Pillars of Observation"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.reach), 2, false, 0)) ); diff --git a/source/material.ads b/source/material.ads index 93dd860..9870541 100644 --- a/source/material.ads +++ b/source/material.ads @@ -34,6 +34,8 @@ package material is type points is array (limit) of point; + type drops is array (natural range <>) of point; + ------------------------------------------------------------------------------------------ count : constant natural := enumeration'pos (enumeration'last) + 1; diff --git a/source/monster.ads b/source/monster.ads new file mode 100644 index 0000000..471c8d6 --- /dev/null +++ b/source/monster.ads @@ -0,0 +1,58 @@ +-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic +-- +-- GNU General Public Licence (version 3 or later) + +with core, attribute, material, effect; + +package monster is + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + type enumeration is ( + none, + hill_troll, cave_troll, mountain_troll, swamp_worm, sand_worm, ash_worm + ); + + ------------------------------------------------------------------------------------------ + + type definition is record + name : access string := new string'("--"); + attributes : attribute.bonus := (others => 0); + materials : access material.drops := new material.drops'((material.meat, 1, 1), (material.bone, 1, 1)); + evoke : effect.information := effect.none; + end record; + + type information is record + index : enumeration := enumeration'first; + state : core.animation := core.idle; + x : integer := 0; + y : integer := 0; + health : core.point := (24, 24); + mana : core.point := (24, 24); + stamina : core.point := (24, 24); + end record; + + type informations is array (natural range <>) of information; + + ------------------------------------------------------------------------------------------ + + count : constant natural := enumeration'pos (enumeration'last) + 1; + + description : constant array (enumeration) of definition := ( + none => (others => <>), + -- + hill_troll => (new string'("Hill Troll"), (3, 3, 3, 6, 6, 6), new material.drops'((material.meat, 3, 6), (material.skull, 1, 1)), effect.none), + cave_troll => (new string'("Cave Troll"), (3, 3, 3, 6, 6, 6), new material.drops'((material.meat, 3, 6), (material.skull, 1, 1)), effect.none), + mountain_troll => (new string'("Mountain Troll"), (3, 3, 3, 6, 6, 6), new material.drops'((material.meat, 3, 6), (material.skull, 1, 1)), effect.none), + swamp_worm => (new string'("Swamp Worm"), (2, 3, 3, 4, 6, 6), new material.drops'((material.meat, 3, 6), (material.bone, 1, 3)), effect.none), + sand_worm => (new string'("Sand Word"), (2, 3, 3, 4, 6, 6), new material.drops'((material.meat, 3, 6), (material.bone, 1, 3)), effect.none), + ash_worm => (new string'("Ash Worm"), (2, 3, 3, 4, 6, 6), new material.drops'((material.meat, 3, 6), (material.bone, 1, 3)), effect.none) + ); + + game : array (enumeration) of core.sprite; + icon : array (enumeration) of core.sprite; + view : array (enumeration) of core.sprite; + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + +end monster; diff --git a/source/unit.ads b/source/unit.ads index af70920..42d029f 100644 --- a/source/unit.ads +++ b/source/unit.ads @@ -20,7 +20,6 @@ package unit is type definition is record name : access string := new string'("--"); kind : faction.enumeration := faction.neutral; - limit : natural := 0; attributes : attribute.bonus := (others => 0); hiring_fee : natural := 0; weekly_fee : natural := 0; @@ -74,50 +73,50 @@ package unit is description : constant array (enumeration) of definition := ( none => (others => <>), -- - dwarf_villager => (new string'("Villager"), faction.dwarf, 120, (2, 1, 1, 1, 2, 1), 2, 1, 1, ( + 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, 120, (2, 1, 1, 1, 2, 1), 2, 1, 1, ( + dwarf_miner => (new string'("Miner"), faction.dwarf, (2, 1, 1, 1, 2, 1), 2, 1, 1, ( equipment.grey_tunic, equipment.none, equipment.none, equipment.fur_gauntlets, equipment.fur_greaves, equipment.none, equipment.pickaxe, equipment.none)), - dwarf_blacksmith => (new string'("Blacksmith"), faction.dwarf, 90, (2, 1, 1, 1, 2, 1), 3, 1, 2, ( + dwarf_blacksmith => (new string'("Blacksmith"), faction.dwarf, (2, 1, 1, 1, 2, 1), 3, 1, 2, ( 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, 90, (2, 1, 1, 1, 2, 1), 3, 2, 2, ( + dwarf_hunter => (new string'("Hunter"), faction.dwarf, (2, 1, 1, 1, 2, 1), 3, 2, 2, ( 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, 90, (2, 1, 1, 1, 2, 1), 5, 3, 2, ( + dwarf_bowman => (new string'("Bowman"), faction.dwarf, (2, 1, 1, 1, 2, 1), 5, 3, 2, ( 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, 120, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( + dwarf_warrior => (new string'("Warrior"), faction.dwarf, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( 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, 120, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( + dwarf_axeman => (new string'("Axeman"), faction.dwarf, (2, 1, 1, 1, 2, 1), 7, 3, 3, ( 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, 90, (2, 1, 1, 2, 2, 1), 7, 5, 3, ( + dwarf_crossbowman => (new string'("Crossbowman"), faction.dwarf, (2, 1, 1, 2, 2, 1), 7, 5, 3, ( equipment.blue_tunic, equipment.iron_helmet, equipment.iron_chestplate, equipment.leather_gauntlets, equipment.leather_greaves, equipment.none, equipment.light_crossbow, equipment.none)), - dwarf_berserker => (new string'("Berserker"), faction.dwarf, 120, (3, 2, 1, 3, 3, 1), 7, 3, 5, ( + dwarf_berserker => (new string'("Berserker"), faction.dwarf, (3, 2, 1, 3, 3, 1), 7, 3, 5, ( equipment.blue_pants, equipment.none, equipment.none, equipment.leather_gauntlets, equipment.leather_greaves, equipment.none, equipment.iron_axe, equipment.none)), - dwarf_guard => (new string'("Guard"), faction.dwarf, 90, (2, 3, 1, 3, 2, 1), 17, 5, 3, ( + 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, 90, (3, 3, 1, 3, 2, 1), 23, 7, 2, ( + 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, 60, (1, 1, 3, 1, 1, 1), 23, 3, 0, ( + dwarf_war_druid => (new string'("War Druid"), faction.dwarf, (1, 1, 3, 1, 1, 1), 23, 3, 0, ( equipment.black_robe, equipment.black_hood, equipment.mithril_chestplate, equipment.none, equipment.none, equipment.none, equipment.staff_of_earth, equipment.none)), - dwarf_pig_rider => (new string'("Pig Rider"), faction.dwarf, 30, others => <>), -- todo - dwarf_boar_rider => (new string'("Boar Rider"), faction.dwarf, 30, others => <>), -- todo - dwarf_giant_mole_rider => (new string'("Giant Mole Rider"), faction.dwarf, 30, others => <>), -- todo - dwarf_siegebowman => (new string'("Siegebowman"), faction.dwarf, 60, others => <>), -- todo - dwarf_knight => (new string'("Knight"), faction.dwarf, 60, (5, 3, 2, 3, 3, 1), 29, 7, 13, ( -- todo + 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, 10, (5, 3, 2, 3, 5, 1), 29, 13, 0, ( + dwarf_flag_carrier => (new string'("Flag Carrier"), faction.dwarf, (5, 3, 2, 3, 5, 1), 29, 13, 0, ( equipment.cyan_robe, equipment.mithril_helmet, equipment.mithril_chestplate, equipment.mithril_gauntlets, equipment.mithril_greaves, equipment.none, equipment.mithril_mace, equipment.mithril_shield)) ); diff --git a/source/world.adb b/source/world.adb index 7dd7818..6eb4fc8 100644 --- a/source/world.adb +++ b/source/world.adb @@ -1294,7 +1294,7 @@ package body world is ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " " & resource.description (resource_index).name.all & " resource points."); -- - when effect.modify_material => material_index := material.enumeration'val (data.modifier); + when effect.append_material => material_index := material.enumeration'val (data.modifier); -- for this in material.limit loop exit when done; diff --git a/source/world.ads b/source/world.ads index f29f4c4..cec8d37 100644 --- a/source/world.ads +++ b/source/world.ads @@ -2,7 +2,7 @@ -- -- GNU General Public Licence (version 3 or later) -with core, ui, attribute, skill, resource, material, lore, biome, landmark, location, faction, equipment, magic, deity, unit, construction, chad, effect; +with core, ui, attribute, skill, resource, material, lore, biome, landmark, location, faction, equipment, magic, deity, monster, unit, construction, chad, effect; use type core.cursor_code; use type core.signal_code;