Experimental code...

This commit is contained in:
Ognjen Milan Robovic 2024-06-09 11:07:49 -04:00
parent e12120a3c2
commit 8a5bfd412d
4 changed files with 59 additions and 55 deletions

View File

@ -14,6 +14,12 @@ package chad is
------------------------------------------------------------------------------------------
item_limit : constant natural := 24;
skill_limit : constant natural := 8;
--~unit_limit : constant natural := 8;
type item_array is array (0 .. item_limit - 1) of equipment.enumeration;
type definition is record
name : access string;
title : access string;
@ -23,13 +29,6 @@ package chad is
bonus_resource : resource.enumeration;
end record;
item_limit : constant natural := 24;
skill_limit : constant natural := 8;
type item_array is array (0 .. item_limit - 1) of equipment.enumeration;
type skill_array is array (0 .. skill_limit - 1) of skill.enumeration;
type skill_point is array (0 .. skill_limit - 1) of core.point;
type information is record
index : enumeration := ada;
state : core.animation := core.idle;
@ -40,13 +39,14 @@ package chad is
mana : core.point := (12, 12);
movement : core.point := (12, 12);
attributes : attribute.points := attribute.default;
skills : skill_array := (others => skill.none);
points : skill_point := (others => (0, 3));
skills : skill.points := (others => (others => <>));
resources : resource.points := resource.default;
materials : material.points := material.default;
equipments : equipment.equip_array := equipment.default;
item_count : natural := 0;
items : item_array := (others => equipment.none);
--~unit_index : array (1 .. unit_limit) of unit.enumeration := (others => unit.none);
--~unit_count : array (1 .. unit_limit) of natural := (others => 0);
end record;
type informations is array (natural range <>) of information;

View File

@ -109,8 +109,7 @@ procedure main is
text_box_height : integer := 0;
player : chad.information := (
skills => (skill.archery, skill.athletics, skill.tactics, skill.aerokinesis, skill.logistics, skill.leadership, skill.estates, skill.mysticism),
points => (others => (1, 3)),
skills => ((skill.archery, 1, 3), (skill.athletics, 1, 3), (skill.tactics, 1, 3), others => <>),
--
equipments => (equipment.chest => equipment.iron_chestplate,
equipment.head => equipment.iron_helmet,
@ -217,8 +216,8 @@ procedure main is
--
ui.draw_text ("Skills", at_x + side, at_y, width - side - 2 * offset, core.icon, more);
--
for index in 0 .. chad.skill_limit - 1 loop
ui.draw_icon (skill.icon (player_1.skills (index)), skill.description (player_1.skills (index)).text.all, at_x + index * core.icon, at_y);
for index in 0 .. skill.limit - 1 loop
ui.draw_icon (skill.icon (player_1.skills (index).index), skill.description (player_1.skills (index).index).text.all, at_x + index * core.icon, at_y);
--~ui.write (player_1.points (index).value'image, at_x + index * core.icon + more, at_y + more, code => true);
end loop;
--
@ -367,8 +366,8 @@ begin
core.dash;
for index in view loop
view_icon (index, false) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & "_off.png", 1, 2);
view_icon (index, true) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & "_on.png", 1, 2);
view_icon (index, false) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & "_off.png", 1, 1);
view_icon (index, true) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & "_on.png", 1, 1);
end loop;
game_title := core.import_sprite (core.folder & "/ui/game_title.png", 1, 1);

View File

@ -18,48 +18,51 @@ package skill is
------------------------------------------------------------------------------------------
type definition is record
base : core.point := (0, 3);
name : access string := new string'("--");
text : access string := new string'("--");
end record;
type points is array (enumeration) of core.point;
type bonus is array (enumeration) of natural;
------------------------------------------------------------------------------------------
limit : constant natural := 8;
count : constant natural := enumeration'pos (enumeration'last) + 1;
default : constant points := (others => (0, 3));
type definition is record
name : access string := new string'("--");
text : access string := new string'("--");
end record;
type point is record
index : enumeration := none;
value : natural := 0;
limit : natural := 0;
end record;
type points is array (0 .. limit - 1) of point;
------------------------------------------------------------------------------------------
description : constant array (enumeration) of definition := (
none => (others => <>),
--
alchemy => ((0, 3), new string'("Alchemy"), new string'("Alchemy skill determines effectiveness of your vials and potions.")),
archery => ((0, 3), new string'("Archery"), new string'("Archery skill determines effectiveness and range or your archers.")),
architecture => ((0, 3), new string'("Architecture"), new string'("Architecture decreases time spent on building constructions.")),
athletics => ((0, 3), new string'("Athletics"), new string'("Athletics increases movement speed of all your units, since they train.")),
diplomacy => ((0, 3), new string'("Diplomacy"), new string'("Diplomacy helps you to avoid starting a battle you can't win.")),
estates => ((0, 3), new string'("Estates"), new string'("Estates makes you the ultimate crypto-bro, establishing a blockchain.")),
exploration => ((0, 3), new string'("Exploration"), new string'("Exploration is quite self-explanatory by its' name, seriously.")),
leadership => ((0, 3), new string'("Leadership"), new string'("Leadership is the default skill for any true chad, like God intended.")),
logistics => ((0, 3), new string'("Logistics"), new string'("Logistics is a nightmare in real life, but this is only a game.")),
medicine => ((0, 3), new string'("Medicine"), new string'("Medicine skill makes you swallow pills like a kid in a drugstore.")),
mercantile => ((0, 3), new string'("Mercantile"), new string'("Mercantile is the skill of any true-born nosy person, otherwise useless.")),
mysticism => ((0, 3), new string'("Mysticism"), new string'("Mysticism allows you to have 60 cats, drink wine and talk weird.")),
necromancy => ((0, 3), new string'("Necromancy"), new string'("Necromancy lets you not to waste the bones after every battle.")),
resistance => ((0, 3), new string'("Resistence"), new string'("Resistence skill increases defense points of all your units slightly.")),
skirmish => ((0, 3), new string'("Skirmish"), new string'("Skirmish makes your units go berserk when they have little health left.")),
sorcery => ((0, 3), new string'("Sorcery"), new string'("Sorcery skill is appropriately named useless skill to have in real life.")),
tactics => ((0, 3), new string'("Tactics"), new string'("Tactics is the opposite of skirmish, master it and lose in every battle.")),
thaumaturgy => ((0, 3), new string'("Thaumaturgy"), new string'("Thaumaturgy lets you do nothing, and hope that the best will happen.")),
pyrokinesis => ((0, 3), new string'("Pyrokinesis"), new string'("Pyrokinesis helps you to start fire quicker while cooking pork in camp.")),
hydrokinesis => ((0, 3), new string'("Hydrokinesis"), new string'("Hydrokinesis skill is for people who really like to drink water.")),
aerokinesis => ((0, 3), new string'("Aerokinesis"), new string'("Aerokinesis lets you fly, summon winds and then fall down.")),
khousokinesis => ((0, 3), new string'("Khousokinesis"), new string'("Khousokinesis is an essential skill for any proper farmer here.")),
phosokinesis => ((0, 3), new string'("Phosokinesis"), new string'("Phosokinesis allows you to bend the light and summon flying lamps.")),
eremnokinesis => ((0, 3), new string'("Eremnokinesis"), new string'("Eremnokinesis skill is for lonely, sad and depressed people only."))
alchemy => (new string'("Alchemy"), new string'("Alchemy skill determines effectiveness of your vials and potions.")),
archery => (new string'("Archery"), new string'("Archery skill determines effectiveness and range or your archers.")),
architecture => (new string'("Architecture"), new string'("Architecture decreases time spent on building constructions.")),
athletics => (new string'("Athletics"), new string'("Athletics increases movement speed of all your units, since they train.")),
diplomacy => (new string'("Diplomacy"), new string'("Diplomacy helps you to avoid starting a battle you can't win.")),
estates => (new string'("Estates"), new string'("Estates makes you the ultimate crypto-bro, establishing a blockchain.")),
exploration => (new string'("Exploration"), new string'("Exploration is quite self-explanatory by its' name, seriously.")),
leadership => (new string'("Leadership"), new string'("Leadership is the default skill for any true chad, like God intended.")),
logistics => (new string'("Logistics"), new string'("Logistics is a nightmare in real life, but this is only a game.")),
medicine => (new string'("Medicine"), new string'("Medicine skill makes you swallow pills like a kid in a drugstore.")),
mercantile => (new string'("Mercantile"), new string'("Mercantile is the skill of any true-born nosy person, otherwise useless.")),
mysticism => (new string'("Mysticism"), new string'("Mysticism allows you to have 60 cats, drink wine and talk weird.")),
necromancy => (new string'("Necromancy"), new string'("Necromancy lets you not to waste the bones after every battle.")),
resistance => (new string'("Resistence"), new string'("Resistence skill increases defense points of all your units slightly.")),
skirmish => (new string'("Skirmish"), new string'("Skirmish makes your units go berserk when they have little health left.")),
sorcery => (new string'("Sorcery"), new string'("Sorcery skill is appropriately named useless skill to have in real life.")),
tactics => (new string'("Tactics"), new string'("Tactics is the opposite of skirmish, master it and lose in every battle.")),
thaumaturgy => (new string'("Thaumaturgy"), new string'("Thaumaturgy lets you do nothing, and hope that the best will happen.")),
pyrokinesis => (new string'("Pyrokinesis"), new string'("Pyrokinesis helps you to start fire quicker while cooking pork in camp.")),
hydrokinesis => (new string'("Hydrokinesis"), new string'("Hydrokinesis skill is for people who really like to drink water.")),
aerokinesis => (new string'("Aerokinesis"), new string'("Aerokinesis lets you fly, summon winds and then fall down.")),
khousokinesis => (new string'("Khousokinesis"), new string'("Khousokinesis is an essential skill for any proper farmer here.")),
phosokinesis => (new string'("Phosokinesis"), new string'("Phosokinesis allows you to bend the light and summon flying lamps.")),
eremnokinesis => (new string'("Eremnokinesis"), new string'("Eremnokinesis skill is for lonely, sad and depressed people only."))
);
icon : array (enumeration) of core.sprite;

View File

@ -319,8 +319,9 @@ package body world is
for index in resource.enumeration loop core.save_point (file, map.chads (1).resources (index)); end loop;
for index in material.enumeration loop core.save_point (file, map.chads (1).materials (index)); end loop;
--
for index in 0 .. chad.skill_limit - 1 loop core.io.write (file, skill.enumeration'pos (map.chads (1).skills (index))); end loop;
for index in 0 .. chad.skill_limit - 1 loop core.save_point (file, map.chads (1).points (index)); end loop;
for index in 0 .. skill.limit - 1 loop core.io.write (file, skill.enumeration'pos (map.chads (1).skills (index).index)); end loop;
for index in 0 .. skill.limit - 1 loop core.io.write (file, map.chads (1).skills (index).value); end loop;
for index in 0 .. skill.limit - 1 loop core.io.write (file, map.chads (1).skills (index).limit); end loop;
--
for kind in equipment.kind loop
core.io.write (file, equipment.enumeration'pos (map.chads (1).equipments (kind)));
@ -390,8 +391,9 @@ package body world is
for index in resource.enumeration loop core.load_point (file, map.chads (1).resources (index)); end loop;
for index in material.enumeration loop core.load_point (file, map.chads (1).materials (index)); end loop;
--
for index in 0 .. chad.skill_limit - 1 loop core.io.read (file, this); map.chads (1).skills (index) := skill.enumeration'val (this); end loop;
for index in 0 .. chad.skill_limit - 1 loop core.load_point (file, map.chads (1).points (index)); end loop;
for index in 0 .. skill.limit - 1 loop core.io.read (file, this); map.chads (1).skills (index).index := skill.enumeration'val (this); end loop;
for index in 0 .. skill.limit - 1 loop core.io.read (file, map.chads (1).skills (index).value); end loop;
for index in 0 .. skill.limit - 1 loop core.io.read (file, map.chads (1).skills (index).limit); end loop;
--
for kind in equipment.kind loop
core.io.read (file, this); map.chads (1).equipments (kind) := equipment.enumeration'val (this);