2024-05-19 11:32:19 -04:00
|
|
|
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
|
|
--
|
|
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
|
2024-05-31 07:14:00 -04:00
|
|
|
with core, ui, attribute, skill, resource, material, chad, world;
|
2024-05-19 11:32:19 -04:00
|
|
|
|
2024-06-02 07:14:06 -04:00
|
|
|
use core;
|
2024-05-23 03:34:45 -04:00
|
|
|
|
2024-05-19 11:32:19 -04:00
|
|
|
package body effect is
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-06-01 11:56:18 -04:00
|
|
|
procedure apply (data : in information) is
|
|
|
|
player : chad.information renames world.map.chads (1);
|
2024-05-31 07:14:00 -04:00
|
|
|
--
|
|
|
|
attribute_index : attribute.enumeration;
|
|
|
|
skill_index : skill.enumeration;
|
|
|
|
resource_index : resource.enumeration;
|
|
|
|
material_index : material.enumeration;
|
2024-05-19 11:32:19 -04:00
|
|
|
begin
|
2024-05-31 07:14:00 -04:00
|
|
|
case data.kind is
|
|
|
|
when idle => null;
|
|
|
|
--
|
|
|
|
when modify_attribute => attribute_index := attribute.enumeration'val (data.modifier);
|
|
|
|
player.attributes (attribute_index) := player.attributes (attribute_index) + data.amount;
|
|
|
|
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
|
2024-06-02 07:14:06 -04:00
|
|
|
& (-(attribute.description (attribute_index).name)) & " attribute points.");
|
2024-05-31 07:14:00 -04:00
|
|
|
--
|
|
|
|
when modify_skill => skill_index := skill.enumeration'val (data.modifier);
|
|
|
|
player.skills (skill_index) := player.skills (skill_index) + data.amount;
|
|
|
|
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
|
2024-06-02 07:14:06 -04:00
|
|
|
& (-(skill.description (skill_index).name)) & " skill points.");
|
2024-05-28 06:08:45 -04:00
|
|
|
--
|
2024-05-31 07:14:00 -04:00
|
|
|
when modify_resource => resource_index := resource.enumeration'val (data.modifier);
|
|
|
|
player.resources (resource_index) := player.resources (resource_index) + data.amount;
|
|
|
|
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
|
2024-06-02 07:14:06 -04:00
|
|
|
& (-(resource.description (resource_index).name)) & " resource points.");
|
2024-05-31 07:14:00 -04:00
|
|
|
--
|
|
|
|
when modify_material => material_index := material.enumeration'val (data.modifier);
|
|
|
|
player.materials (material_index) := player.materials (material_index) + data.amount;
|
2024-06-02 07:14:06 -04:00
|
|
|
ui.echo ("+" & data.amount'image & " " & (-(material.description (material_index).name)));
|
2024-05-19 11:32:19 -04:00
|
|
|
end case;
|
|
|
|
end apply;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
end effect;
|