From 753b35b60d385c483b9df12fc734fb2744d8beed Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 19 May 2024 11:32:19 -0400 Subject: [PATCH] Finished naive effect implementation... --- source/effect.adb | 27 +++++++++++++++++++++++++++ source/effect.ads | 31 ++++++++++++------------------- source/world.adb | 10 ++++++++++ source/world.ads | 6 +++--- 4 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 source/effect.adb diff --git a/source/effect.adb b/source/effect.adb new file mode 100644 index 0000000..9b030ce --- /dev/null +++ b/source/effect.adb @@ -0,0 +1,27 @@ +-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic +-- +-- GNU General Public Licence (version 3 or later) + +with core, attribute, skill, resource, deity, material, magic, equipment, unit, construction, chad, world; + +package body effect is + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + procedure apply (data : in value) is + begin + case data.operation is + when player_add => + case data.operator is + when attribute_offense => core.increment (world.map.chad_data (1).attributes (attribute.offense)); + when attribute_wisdom => core.increment (world.map.chad_data (1).attributes (attribute.wisdom)); + when attribute_speed => core.increment (world.map.chad_data (1).attributes (attribute.speed)); + when others => null; + end case; + when others => null; + end case; + end apply; + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + +end effect; diff --git a/source/effect.ads b/source/effect.ads index b9b43d9..13dd3ed 100644 --- a/source/effect.ads +++ b/source/effect.ads @@ -2,26 +2,26 @@ -- -- GNU General Public Licence (version 3 or later) -with core; - package effect is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type operation_index is ( idle, - add, - subtract, - multiply, - divide, - increment, - decrement + player_add, + player_subtract, + player_multiply, + player_divide, + player_increment, + player_decrement ); type operator_index is ( - attribute, - skill, - resource + attribute_offense, attribute_defense, attribute_wisdom, attribute_stamina, attribute_speed, attribute_reach, + skill_alchemy, skill_archery, skill_architecture, skill_athletics, skill_diplomacy, skill_estates, + skill_exploration, skill_leadership, skill_logistics, skill_medicine, skill_mercantile, skill_mysticism, + skill_necromancy, skill_resistance, skill_skirmish, skill_sorcery, skill_tactics, skill_thaumaturgy, + resource_gold, resource_wood, resource_stone, resource_metal, resource_leather, resource_gem ); ------------------------------------------------------------------------------------------ @@ -38,14 +38,7 @@ package effect is ------------------------------------------------------------------------------------------ - --~count : constant natural := enumeration'pos (enumeration'last) + 1; - - --~trait : constant array (enumeration) of information := ( - --~((others => null), (others => (others => 0))), - --~((others => null), (others => (others => 0))), - --~((others => null), (others => (others => 0))), - --~((others => null), (others => (others => 0))) - --~); + procedure apply (data : in value); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index 37e143f..9125dcf 100644 --- a/source/world.adb +++ b/source/world.adb @@ -283,6 +283,16 @@ package body world is core.write_text_box (location_trait (location_index'val (map.locations (index).index)).name); end if; end if; + -- + if core.camera.x > map.locations (index).x - 2 + and core.camera.x < map.locations (index).x + 1 + locations (location_index'val (map.locations (index).index)).width / core.base + and core.camera.y > map.locations (index).y - 2 + and core.camera.y < map.locations (index).y + 1 + locations (location_index'val (map.locations (index).index)).height / core.base + and core.signal_code'pos (core.signal_mode) = core.signal_code'pos (core.signal_e) + and not ui.prioritize then + core.echo (core.warning, "Applying effect..."); + effect.apply (location_trait (location_index'val (map.locations (index).index)).evoke); + end if; end loop; -- for index in 1 .. construction_limit loop diff --git a/source/world.ads b/source/world.ads index dcfb839..6ae6e3e 100644 --- a/source/world.ads +++ b/source/world.ads @@ -105,9 +105,9 @@ package world is ); location_trait : constant array (location_index) of location_stats := ( - well_of_agility => ("Well of Agility ", true, 4, 1, effect.none), - well_of_knowledge => ("Well of Knowledge ", true, 4, 1, effect.none), - well_of_strength => ("Well of Strength ", true, 4, 1, effect.none) + well_of_agility => ("Well of Agility ", true, 4, 1, (effect.player_add, effect.attribute_speed, 2, false, 0)), + well_of_knowledge => ("Well of Knowledge ", true, 4, 1, (effect.player_add, effect.attribute_wisdom, 2, false, 0)), + well_of_strength => ("Well of Strength ", true, 4, 1, (effect.player_add, effect.attribute_offense, 2, false, 0)) ); map : information;