Prototype game engine for Heroes of Might & Magic, featuring a gameplay plot-twist...
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

48 строки
2.5KB

  1. -- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
  2. --
  3. -- GNU General Public Licence (version 3 or later)
  4. with core, ui, attribute, skill, resource, material, chad, world;
  5. use core;
  6. package body effect is
  7. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. procedure apply (data : in information) is
  9. player : chad.information renames world.map.chads (1);
  10. --
  11. attribute_index : attribute.enumeration;
  12. skill_index : skill.enumeration;
  13. resource_index : resource.enumeration;
  14. material_index : material.enumeration;
  15. begin
  16. case data.kind is
  17. when idle => null;
  18. --
  19. when modify_attribute => attribute_index := attribute.enumeration'val (data.modifier);
  20. player.attributes (attribute_index) := player.attributes (attribute_index) + data.amount;
  21. ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
  22. & (-(attribute.description (attribute_index).name)) & " attribute points.");
  23. --
  24. when modify_skill => skill_index := skill.enumeration'val (data.modifier);
  25. player.skills (skill_index) := player.skills (skill_index) + data.amount;
  26. ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
  27. & (-(skill.description (skill_index).name)) & " skill points.");
  28. --
  29. when modify_resource => resource_index := resource.enumeration'val (data.modifier);
  30. player.resources (resource_index) := player.resources (resource_index) + data.amount;
  31. ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
  32. & (-(resource.description (resource_index).name)) & " resource points.");
  33. --
  34. when modify_material => material_index := material.enumeration'val (data.modifier);
  35. player.materials (material_index) := player.materials (material_index) + data.amount;
  36. ui.echo ("+" & data.amount'image & " " & (-(material.description (material_index).name)));
  37. end case;
  38. end apply;
  39. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  40. end effect;