Experimental minimal terminal rogue-like game in Ada programming language. I used to write a lot of Ada programs some time ago, then went in full C and assembly mode, and came back to Ada...
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

477 lignes
27KB

  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. -- Experimental minimal terminal rogue-like game in Ada programming language. I used to write a lot of Ada programs some time ago, then went in full C and assembly mode, and came
  9. -- back to Ada, but realized that I keep my folders messy... Since it's bothersome to find my old Ada projects and share them here, I decided that the most easy thing to do is to
  10. -- write a new program in Ada, a tiny game. Work in progress, it's messy and ugly for now...
  11. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  12. with ada.text_io, ada.strings.unbounded;
  13. use ada.text_io, ada.strings.unbounded;
  14. -- Do not use this command below, it's for real-time game...
  15. -- $ gnatmake xabina.adb && stty raw -echo && ./xabina && reset
  16. function xabina return integer is
  17. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  18. -- System
  19. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  20. type integer_subrange is
  21. record
  22. minimum : integer := 0;
  23. maximum : integer := 0;
  24. end record;
  25. type natural_subrange is
  26. record
  27. minimum : natural := 0;
  28. maximum : natural := 0;
  29. end record;
  30. type colours is (
  31. COLOUR_GREY, COLOUR_RED, COLOUR_GREEN, COLOUR_YELLOW, COLOUR_BLUE, COLOUR_PINK, COLOUR_CYAN, COLOUR_WHITE
  32. );
  33. type effects is (
  34. EFFECT_NORMAL, EFFECT_BOLD, EFFECT_ITALIC, EFFECT_UNDERLINE, EFFECT_BLINK, EFFECT_REVERSE
  35. );
  36. function render_character ( -- A joke function...
  37. symbol : character := ' ';
  38. colour : colours := COLOUR_WHITE;
  39. effect : effects := EFFECT_NORMAL
  40. ) return natural is
  41. begin
  42. put (character'val (27) & "[");
  43. case effect is
  44. when EFFECT_NORMAL => put ("0");
  45. when EFFECT_BOLD => put ("1");
  46. when EFFECT_ITALIC => put ("3");
  47. when EFFECT_UNDERLINE => put ("4");
  48. when EFFECT_BLINK => put ("5");
  49. when EFFECT_REVERSE => put ("7");
  50. end case;
  51. put (";3");
  52. case colour is
  53. when COLOUR_GREY => put ("0");
  54. when COLOUR_RED => put ("1");
  55. when COLOUR_GREEN => put ("2");
  56. when COLOUR_YELLOW => put ("3");
  57. when COLOUR_BLUE => put ("4");
  58. when COLOUR_PINK => put ("5");
  59. when COLOUR_CYAN => put ("6");
  60. when COLOUR_WHITE => put ("7");
  61. end case;
  62. put ("m");
  63. put (symbol);
  64. put (character'val (27) & "[0m");
  65. return 1;
  66. end render_character;
  67. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  68. -- Entity
  69. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  70. type entities is (
  71. ENTITY_NULL, ENTITY_MENU, ENTITY_MAP, ENTITY_ITEM, ENTITY_MAGIC, ENTITY_AMMUNITION, ENTITY_WEAPON, ENTITY_ARMOUR,
  72. ENTITY_SCROLL, ENTITY_POTION, ENTITY_CONSUMABLE, ENTITY_NOTE, ENTITY_PLANT, ENTITY_ANIMAL, ENTITY_GOBLIN, ENTITY_PLAYER
  73. );
  74. type entity_constant_type is tagged
  75. record
  76. entity : entities := ENTITY_NULL; -- Entity identifier.
  77. name : unbounded_string := null_unbounded_string; -- Entity general name.
  78. symbol : character := ' '; -- Entity ASCII character representation.
  79. colour : colours := COLOUR_WHITE; -- Entity VT100 escape sequence colour.
  80. effect : effects := EFFECT_NORMAL; -- Entity VT100 escape sequence effect.
  81. end record;
  82. type entity_variable_type is tagged
  83. record
  84. x : integer := 0; -- Global X coordinate.
  85. y : integer := 0; -- Global Y coordinate.
  86. end record;
  87. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  88. -- Menu
  89. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  90. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  91. -- Map:
  92. -- -- Map data is only constant, not variable, since X and Y coordinates are determined by player, camera or global position.
  93. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  94. type map_list is (
  95. STONE_WALL, WOODEN_WALL, STONE_FLOOR, WOODEN_FLOOR, WATER_SHALLOW, WATER_DEEP, SWAMP_SHALLOW, SWAMP_DEEP
  96. );
  97. type map_constant_type is new entity_constant_type with
  98. record
  99. collide : boolean := false;
  100. end record;
  101. type map_constant_list is array (map_list) of map_constant_type;
  102. map_constant_data : constant map_constant_list := (
  103. (ENTITY_MAP, to_unbounded_string ("Stone Wall"), '#', COLOUR_GREY, EFFECT_BOLD, true),
  104. (ENTITY_MAP, to_unbounded_string ("Wooden Wall"), '#', COLOUR_YELLOW, EFFECT_NORMAL, true),
  105. (ENTITY_MAP, to_unbounded_string ("Stone Floor"), '.', COLOUR_GREY, EFFECT_BOLD, false),
  106. (ENTITY_MAP, to_unbounded_string ("Wooden Floor"), '.', COLOUR_YELLOW, EFFECT_NORMAL, false),
  107. (ENTITY_MAP, to_unbounded_string ("Water (shallow)"), '~', COLOUR_BLUE, EFFECT_NORMAL, false),
  108. (ENTITY_MAP, to_unbounded_string ("Water (deep)"), '~', COLOUR_BLUE, EFFECT_BOLD, true),
  109. (ENTITY_MAP, to_unbounded_string ("Swamp (shallow)"), '~', COLOUR_GREEN, EFFECT_NORMAL, false),
  110. (ENTITY_MAP, to_unbounded_string ("Swamp (deep)"), '~', COLOUR_GREEN, EFFECT_BOLD, true)
  111. );
  112. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  113. -- Item
  114. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  115. type item_list is (
  116. WOOD, BARK, FLAX, PLANK, STICK, BRACES, NAILS, LINEN,
  117. CHAMOMILE, MINT, WAX, SALT, SUGAR, PEPPER, CINNAMON, YEAST,
  118. SKULL, BONE, INTESTINES, FUR, LEATHER, FAT, HORN, TUSK,
  119. COPPER_ORE, IRON_ORE, SILVER_ORE, GOLD_ORE, COAL_ORE, TIN_ORE, ZINC_ORE, LEAD_ORE,
  120. COPPER, IRON, SILVER, GOLD, COAL, TIN, ZINC, LEAD,
  121. BRONZE, BRASS, STEEL, MERCURY, OIL, INK, VENOM, SILK,
  122. PAPERS, PAPERWEIGHT
  123. );
  124. type item_mark is mod 72;
  125. type item_constant_type is new entity_constant_type with
  126. record
  127. value : natural := 0;
  128. weight : natural := 0;
  129. end record;
  130. type item_variable_type is new entity_variable_type with
  131. record
  132. owner : natural := 0;
  133. end record;
  134. type item_constant_list is array (item_list) of item_constant_type;
  135. type item_variable_list is array (item_mark) of item_variable_type;
  136. item_constant_data : constant item_constant_list := (
  137. (ENTITY_ITEM, to_unbounded_string ("Wood"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2),
  138. (ENTITY_ITEM, to_unbounded_string ("Bark"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 2),
  139. (ENTITY_ITEM, to_unbounded_string ("Flax"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1),
  140. (ENTITY_ITEM, to_unbounded_string ("Plank"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2),
  141. (ENTITY_ITEM, to_unbounded_string ("Stick"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 2),
  142. (ENTITY_ITEM, to_unbounded_string ("Braces"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1),
  143. (ENTITY_ITEM, to_unbounded_string ("Nails"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1),
  144. (ENTITY_ITEM, to_unbounded_string ("Linen"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 1),
  145. (ENTITY_ITEM, to_unbounded_string ("Chamomile"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1),
  146. (ENTITY_ITEM, to_unbounded_string ("Mint"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1),
  147. (ENTITY_ITEM, to_unbounded_string ("Wax"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 1),
  148. (ENTITY_ITEM, to_unbounded_string ("Salt"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1),
  149. (ENTITY_ITEM, to_unbounded_string ("Sugar"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 1),
  150. (ENTITY_ITEM, to_unbounded_string ("Pepper"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 1),
  151. (ENTITY_ITEM, to_unbounded_string ("Cinnamon"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 1),
  152. (ENTITY_ITEM, to_unbounded_string ("Yeast"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1),
  153. (ENTITY_ITEM, to_unbounded_string ("Skull"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1),
  154. (ENTITY_ITEM, to_unbounded_string ("Bone"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1),
  155. (ENTITY_ITEM, to_unbounded_string ("Intestines"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1),
  156. (ENTITY_ITEM, to_unbounded_string ("Fur"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 2),
  157. (ENTITY_ITEM, to_unbounded_string ("Leather"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 1),
  158. (ENTITY_ITEM, to_unbounded_string ("Fat"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1),
  159. (ENTITY_ITEM, to_unbounded_string ("Horn"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1),
  160. (ENTITY_ITEM, to_unbounded_string ("Tusk"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 3, 5),
  161. (ENTITY_ITEM, to_unbounded_string ("Copper Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 7),
  162. (ENTITY_ITEM, to_unbounded_string ("Iron Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 7, 11),
  163. (ENTITY_ITEM, to_unbounded_string ("Silver Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 7),
  164. (ENTITY_ITEM, to_unbounded_string ("Gold Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 7),
  165. (ENTITY_ITEM, to_unbounded_string ("Coal Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 7),
  166. (ENTITY_ITEM, to_unbounded_string ("Tin Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 7),
  167. (ENTITY_ITEM, to_unbounded_string ("Zinc Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 7),
  168. (ENTITY_ITEM, to_unbounded_string ("Lead Ore"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 13),
  169. (ENTITY_ITEM, to_unbounded_string ("Copper"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 17, 5),
  170. (ENTITY_ITEM, to_unbounded_string ("Iron"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 19, 7),
  171. (ENTITY_ITEM, to_unbounded_string ("Silver"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 23, 5),
  172. (ENTITY_ITEM, to_unbounded_string ("Gold"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 29, 5),
  173. (ENTITY_ITEM, to_unbounded_string ("Coal"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 19, 5),
  174. (ENTITY_ITEM, to_unbounded_string ("Tin"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 5),
  175. (ENTITY_ITEM, to_unbounded_string ("Zinc"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 5),
  176. (ENTITY_ITEM, to_unbounded_string ("Lead"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 47, 7),
  177. (ENTITY_ITEM, to_unbounded_string ("Bronze"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 61, 5),
  178. (ENTITY_ITEM, to_unbounded_string ("Brass"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 67, 5),
  179. (ENTITY_ITEM, to_unbounded_string ("Steel"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 71, 7),
  180. (ENTITY_ITEM, to_unbounded_string ("Mercury"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 97, 11),
  181. (ENTITY_ITEM, to_unbounded_string ("Oil"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 5, 1),
  182. (ENTITY_ITEM, to_unbounded_string ("Ink"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1),
  183. (ENTITY_ITEM, to_unbounded_string ("Venom"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 11, 1),
  184. (ENTITY_ITEM, to_unbounded_string ("Silk"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 13, 1),
  185. (ENTITY_ITEM, to_unbounded_string ("Papers"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 1, 1),
  186. (ENTITY_ITEM, to_unbounded_string ("Paperweight"), '+', COLOUR_YELLOW, EFFECT_NORMAL, 2, 1)
  187. );
  188. item_variable_data : item_variable_list;
  189. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  190. -- Spell
  191. -- -- Place-holders mostly, implement self/target/target_range effect variations...
  192. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  193. type magic_list is (
  194. IGNITE, ILLUMINATE, BLADECHARM, BATTLECRY
  195. );
  196. type magic_mark is mod 72;
  197. type magic_constant_type is new entity_constant_type with
  198. record
  199. self : boolean := false;
  200. health : integer := 0;
  201. armour : integer := 0;
  202. mana : integer := 0;
  203. stamina : integer := 0;
  204. distance : integer := 0;
  205. tribute : natural := 0;
  206. end record;
  207. type magic_variable_type is new entity_variable_type with
  208. record
  209. enchantment : natural := 0;
  210. end record;
  211. type magic_constant_list is array (magic_list) of magic_constant_type;
  212. type magic_variable_list is array (magic_mark) of magic_variable_type;
  213. magic_constant_data : constant magic_constant_list := (
  214. (ENTITY_MAGIC, to_unbounded_string ("Ignite"), '*', COLOUR_YELLOW, EFFECT_ITALIC, false, -3, 0, 0, -1, 7, 1),
  215. (ENTITY_MAGIC, to_unbounded_string ("Illuminate"), '*', COLOUR_YELLOW, EFFECT_ITALIC, false, 0, 0, 0, -1, 13, 1),
  216. (ENTITY_MAGIC, to_unbounded_string ("Bladecharm"), '*', COLOUR_RED, EFFECT_ITALIC, true, 0, -3, 0, -1, 7, 3),
  217. (ENTITY_MAGIC, to_unbounded_string ("Battlecry"), '*', COLOUR_RED, EFFECT_ITALIC, true, -1, -1, 0, -1, 7, 2)
  218. );
  219. magic_variable_data : magic_variable_list;
  220. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  221. -- Ammunition
  222. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  223. type ammunition_list is (
  224. ARROWS, BOLTS, SLINGSHOTS, JARIDS
  225. );
  226. type ammunition_mark is mod 72;
  227. type ammunition_constant_type is new entity_constant_type with
  228. record
  229. value : natural := 0;
  230. weight : natural := 0;
  231. dual_wield : boolean := false;
  232. amount_limit : natural := 0;
  233. attack_range : natural_subrange := (0, 0);
  234. distance_range : natural_subrange := (0, 0);
  235. end record;
  236. type ammunition_variable_type is new entity_variable_type with
  237. record
  238. amount : natural_subrange := (0, 0);
  239. enchantment : natural := 0;
  240. end record;
  241. type ammunition_constant_list is array (ammunition_list) of ammunition_constant_type;
  242. type ammunition_variable_list is array (ammunition_mark) of ammunition_variable_type;
  243. ammunition_constant_data : constant ammunition_constant_list := (
  244. (ENTITY_AMMUNITION, to_unbounded_string ("Arrows"), '^', COLOUR_RED, EFFECT_NORMAL, 11, 13, false, 23, (0, 7), (17, 67)),
  245. (ENTITY_AMMUNITION, to_unbounded_string ("Bolts"), '^', COLOUR_RED, EFFECT_NORMAL, 13, 23, false, 29, (0, 5), (17, 67)),
  246. (ENTITY_AMMUNITION, to_unbounded_string ("Slingshots"), '^', COLOUR_RED, EFFECT_NORMAL, 5, 7, true, 43, (0, 7), (17, 67)),
  247. (ENTITY_AMMUNITION, to_unbounded_string ("Jarids"), '^', COLOUR_RED, EFFECT_NORMAL, 29, 37, true, 7, (0, 7), (17, 67))
  248. );
  249. ammunition_variable_data : ammunition_variable_list;
  250. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  251. -- Weapon
  252. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  253. type weapon_list is (
  254. IRON_SWORD, IRON_GREATSWORD, IRON_AXE, IRON_BATTLEAXE, IRON_SPEAR, IRON_SHIELD, IRON_MACE, IRON_HAMMER
  255. );
  256. type weapon_mark is mod 72;
  257. type weapon_constant_type is new entity_constant_type with
  258. record
  259. dual_wield : boolean := false;
  260. value : natural := 0;
  261. weight : natural := 0;
  262. attack_range : natural_subrange := (0, 0);
  263. defense_range : natural_subrange := (0, 0);
  264. distance_range : natural_subrange := (0, 0);
  265. end record;
  266. type weapon_variable_type is new entity_variable_type with
  267. record
  268. enchantment : natural := 0;
  269. condition : natural := 0;
  270. end record;
  271. type weapon_constant_list is array (weapon_list) of weapon_constant_type;
  272. type weapon_variable_list is array (weapon_mark) of weapon_variable_type;
  273. weapon_constant_data : constant weapon_constant_list := (
  274. (ENTITY_WEAPON, to_unbounded_string ("Iron Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, (3, 7), (0, 2), (0, 1)),
  275. (ENTITY_WEAPON, to_unbounded_string ("Iron Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, (5, 11), (1, 3), (0, 2)),
  276. (ENTITY_WEAPON, to_unbounded_string ("Iron Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, (1, 7), (0, 2), (0, 1)),
  277. (ENTITY_WEAPON, to_unbounded_string ("Iron Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, (6, 13), (1, 2), (0, 2)),
  278. (ENTITY_WEAPON, to_unbounded_string ("Iron Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, (4, 10), (2, 4), (0, 2)),
  279. (ENTITY_WEAPON, to_unbounded_string ("Iron Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, (0, 3), (4, 9), (0, 1)),
  280. (ENTITY_WEAPON, to_unbounded_string ("Iron Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, (3, 8), (0, 2), (0, 1)),
  281. (ENTITY_WEAPON, to_unbounded_string ("Iron Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, (4, 7), (0, 3), (0, 1))
  282. );
  283. weapon_variable_data : weapon_variable_list;
  284. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  285. -- Armour
  286. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  287. type armour_list is (
  288. IRON_HELMET, IRON_CHESTPLATE, IRON_GAUNTLETS, IRON_GREAVES, IRON_CUISSE, IRON_FAULD, IRON_GARDBRACE, IRON_REREBRACE
  289. );
  290. type armour_mark is mod 72;
  291. type armour_constant_type is new entity_constant_type with
  292. record
  293. value : natural := 0;
  294. weight : natural := 0;
  295. defense_range : natural_subrange := (0, 0);
  296. end record;
  297. type armour_variable_type is new entity_variable_type with
  298. record
  299. enchantment : natural := 0;
  300. condition : natural := 0;
  301. end record;
  302. type armour_constant_list is array (armour_list) of armour_constant_type;
  303. type armour_variable_list is array (armour_mark) of armour_variable_type;
  304. armour_constant_data : constant armour_constant_list := (
  305. (ENTITY_ARMOUR, to_unbounded_string ("Iron Helmet"), 'm', COLOUR_YELLOW, EFFECT_NORMAL, 11, 31, (3, 7)),
  306. (ENTITY_ARMOUR, to_unbounded_string ("Iron Chestplate"), 'M', COLOUR_YELLOW, EFFECT_BOLD, 23, 67, (5, 11)),
  307. (ENTITY_ARMOUR, to_unbounded_string ("Iron Gauntlets"), 'i', COLOUR_YELLOW, EFFECT_NORMAL, 13, 43, (1, 7)),
  308. (ENTITY_ARMOUR, to_unbounded_string ("Iron Greaves"), 'I', COLOUR_YELLOW, EFFECT_NORMAL, 19, 73, (6, 13)),
  309. (ENTITY_ARMOUR, to_unbounded_string ("Iron Cuisse"), 'Y', COLOUR_YELLOW, EFFECT_BOLD, 17, 53, (4, 10)),
  310. (ENTITY_ARMOUR, to_unbounded_string ("Iron Fauld"), '-', COLOUR_YELLOW, EFFECT_NORMAL, 13, 37, (0, 3)),
  311. (ENTITY_ARMOUR, to_unbounded_string ("Iron Gardbrace"), 'v', COLOUR_YELLOW, EFFECT_NORMAL, 11, 41, (3, 8)),
  312. (ENTITY_ARMOUR, to_unbounded_string ("Iron Rerebrace"), 'V', COLOUR_YELLOW, EFFECT_NORMAL, 13, 47, (4, 7))
  313. );
  314. armour_variable_data : armour_variable_list;
  315. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  316. -- Scroll
  317. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  318. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  319. -- Potion
  320. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  321. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  322. -- Consumable
  323. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  324. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  325. -- Note
  326. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  327. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  328. -- Plant
  329. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  330. type plant_list is (
  331. PLANT_FLOWER, PLANT_GRASS, PLANT_REED, PLANT_BUSH, PLANT_APPLE_TREE, PLANT_LEMON_TREE, PLANT_OAK_TREE, PLANT_PINE_TREE
  332. );
  333. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  334. -- Animal
  335. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  336. type animal_list is (
  337. ANIMAL_ROACH, ANIMAL_RAT, ANIMAL_BAT, ANIMAL_SPIDER, ANIMAL_LIZARD, ANIMAL_SNAIL, ANIMAL_WORM, ANIMAL_MOLE
  338. );
  339. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  340. -- Goblin
  341. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  342. type goblin_list is (
  343. GOBLIN_FEMALE, GOBLIN_WORKER, GOBLIN_WARRIOR, GOBLIN_BOAR_RIDER, GOBLIN_SHAMAN, GOBLIN_CHIEF, GOBLIN_KING, GOBLIN_OGRE
  344. );
  345. type goblin_constant_type is new entity_constant_type with
  346. record
  347. health_limit : natural := 0;
  348. armour_limit : natural := 0;
  349. mana_limit : natural := 0;
  350. stamina_limit : natural := 0;
  351. attack_range : natural_subrange := (0, 0);
  352. end record;
  353. type goblin_variable_type is new entity_variable_type with
  354. record
  355. health : natural := 0;
  356. armour : natural := 0;
  357. mana : natural := 0;
  358. stamina : natural := 0;
  359. end record;
  360. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  361. -- Player
  362. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  363. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  364. -- Gameplay
  365. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  366. x : natural := 0;
  367. begin
  368. for this in magic_list
  369. loop
  370. x := x + render_character (magic_constant_data (this).symbol, magic_constant_data (this).colour, magic_constant_data (this).effect);
  371. put_line (" " & to_string (magic_constant_data (this).name));
  372. end loop;
  373. for this in item_list
  374. loop
  375. x := x + render_character (item_constant_data (this).symbol, item_constant_data (this).colour, item_constant_data (this).effect);
  376. put_line (" " & to_string (item_constant_data (this).name));
  377. end loop;
  378. for this in ammunition_list
  379. loop
  380. x := x + render_character (ammunition_constant_data (this).symbol, ammunition_constant_data (this).colour, ammunition_constant_data (this).effect);
  381. put_line (" " & to_string (ammunition_constant_data (this).name));
  382. end loop;
  383. for this in weapon_list
  384. loop
  385. x := x + render_character (weapon_constant_data (this).symbol, weapon_constant_data (this).colour, weapon_constant_data (this).effect);
  386. put_line (" " & to_string (weapon_constant_data (this).name));
  387. end loop;
  388. for this in armour_list
  389. loop
  390. x := x + render_character (armour_constant_data (this).symbol, armour_constant_data (this).colour, armour_constant_data (this).effect);
  391. put_line (" " & to_string (armour_constant_data (this).name));
  392. end loop;
  393. return 0;
  394. end xabina;