Finished naive effect implementation...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 11:32:19 -04:00
parent 9b5bffa7d3
commit 753b35b60d
4 changed files with 52 additions and 22 deletions

27
source/effect.adb Normal file
View File

@ -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;

View File

@ -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);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -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

View File

@ -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;