More to come...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
4.2KB

  1. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. -- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
  3. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4. -- Xabina is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either
  5. -- version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
  6. -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  7. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. with core;
  9. package magic is
  10. ------------------------------------------------------------------------------------------
  11. type list is (
  12. ignite, illuminate, bladecharm, battlecry
  13. );
  14. type mark is mod 72;
  15. ------------------------------------------------------------------------------------------
  16. type constant_type is new core.constant_type with
  17. record
  18. self : boolean := false;
  19. health : integer := 0;
  20. armour : integer := 0;
  21. mana : integer := 0;
  22. stamina : integer := 0;
  23. distance : integer := 0;
  24. tribute : natural := 0;
  25. end record;
  26. type variable_type is new core.variable_type with
  27. record
  28. enchantment : natural := 0;
  29. end record;
  30. type constant_list is array (list) of constant_type;
  31. type variable_list is array (mark) of variable_type;
  32. ------------------------------------------------------------------------------------------
  33. constant_data : constant constant_list := (
  34. (core.magic, "Ignite ", '*', core.colour.yellow, core.effect.italic, false, -3, 0, 0, -1, 7, 1),
  35. (core.magic, "Illuminate ", '*', core.colour.yellow, core.effect.italic, false, 0, 0, 0, -1, 13, 1),
  36. (core.magic, "Bladecharm ", '*', core.colour.red, core.effect.italic, true, 0, -3, 0, -1, 7, 3),
  37. (core.magic, "Battlecry ", '*', core.colour.red, core.effect.italic, true, -1, -1, 0, -1, 7, 2)
  38. );
  39. variable_data : variable_list;
  40. ------------------------------------------------------------------------------------------
  41. procedure generate;
  42. procedure render;
  43. ------------------------------------------------------------------------------------------
  44. end magic;
  45. with core, map;
  46. package body magic is
  47. ------------------------------------------------------------------------------------------
  48. procedure generate is
  49. y : natural := 0;
  50. x : natural := 0;
  51. identifier : natural := 0;
  52. begin
  53. for this in map.mark
  54. loop
  55. y := core.randomize (0, natural (map.height'last));
  56. x := core.randomize (0, natural (map.width'last));
  57. identifier := core.randomize (0, natural (list'size));
  58. map.variable_data (this) := (integer (y), integer (x), core.magic, identifier);
  59. end loop;
  60. end generate;
  61. procedure render is
  62. symbol : character := ' ';
  63. colour : character := core.colour.white;
  64. effect : character := core.effect.normal;
  65. begin
  66. for this in map.mark
  67. loop
  68. symbol := constant_data (list'val (map.variable_data (this).identifier)).symbol;
  69. colour := constant_data (list'val (map.variable_data (this).identifier)).colour;
  70. effect := constant_data (list'val (map.variable_data (this).identifier)).effect;
  71. core.render_character (symbol, colour, effect, core.screen_height (map.variable_data (this).y), core.screen_width (map.variable_data (this).x));
  72. end loop;
  73. end render;
  74. ------------------------------------------------------------------------------------------
  75. end magic;