From 91c0073ce212ddd51044575199e76be73092d370 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 15 Jun 2024 08:36:42 -0400 Subject: [PATCH] Added skill explanation implementation... --- source/core.adb | 2 +- source/skill.ads | 33 +++++++++++++++++++++++++++++++++ source/ui.adb | 5 ++--- source/world.adb | 20 +++++++++++++++----- source/world.ads | 6 ++++-- 5 files changed, 55 insertions(+), 11 deletions(-) diff --git a/source/core.adb b/source/core.adb index 7422955..95cc0b9 100644 --- a/source/core.adb +++ b/source/core.adb @@ -210,7 +210,7 @@ package body core is end if; end loop; -- - return height + 1; + return height + 2; end string_height; ------------------------------------------------------------------------------------------ diff --git a/source/skill.ads b/source/skill.ads index 15e182a..3895dd1 100644 --- a/source/skill.ads +++ b/source/skill.ads @@ -66,6 +66,39 @@ package skill is eremnokinesis => (new string'("Eremnokinesis"), new string'("Eremnokinesis skill is for lonely, sad and depressed people only.")) ); + explanation : constant array (enumeration) of access string := ( + none => new string'("--"), + -- + alchemy => new string'("--"), + archery => new string'("--"), + architecture => new string'("--"), + athletics => new string'("--"), + diplomacy => new string'("--"), + estates => new string'("--"), + exploration => new string'("--"), + leadership => new string'("--"), + logistics => new string'("--"), + medicine => new string'("--"), + mercantile => new string'("--"), + mysticism => new string'("--"), + necromancy => new string'("--"), + resistance => new string'("--"), + skirmish => new string'("--"), + sorcery => new string'("--"), + tactics => new string'("--"), + thaumaturgy => new string'("--"), + pyrokinesis => new string'("--"), + hydrokinesis => new string'("--"), + aerokinesis => new string'("--"), + khousokinesis => new string'("--"), + phosokinesis => new string'("--"), + eremnokinesis => new string'("Eremnokinesis skill, meaning the art of manipulating darkness, increases strength and " & core.line_feed & + "duration of magical abilities from Dark school of magic, influences your experience with " & core.line_feed & + "creatures that have high darkness aptitude, mainly Dark Elementals, and lets you see " & core.line_feed & + "further into the shroud, not increasing the visibility, but giving you information about " & core.line_feed & + "what monsters or items are beyond the shadows.") + ); + icon : array (enumeration) of core.sprite; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/ui.adb b/source/ui.adb index 3dd83db..76553a9 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -167,12 +167,11 @@ package body ui is core.draw (data, x, y, factor => 1); write (text, x + core.icon + 10, y + 10, code => true); -- - if core.cursor_inside (x, y, core.icon, core.icon) then + if core.cursor_inside (x, y, width, core.icon) then prioritize := true; -- - if core.cursor_mode = core.cursor_left then + if core.cursor_mode = core.cursor_right then action.all; - core.cursor_mode := core.cursor_none; end if; end if; end draw_icon_and_text; diff --git a/source/world.adb b/source/world.adb index 6eb4fc8..8bbb8b3 100644 --- a/source/world.adb +++ b/source/world.adb @@ -440,6 +440,13 @@ package body world is ------------------------------------------------------------------------------------------ + procedure review_skill is + begin + ui.draw_text (skill.explanation (review_skill_data).all, core.center_x (90*9+20), core.center_y (5*15+20), offset => 10); + end review_skill; + + ------------------------------------------------------------------------------------------ + procedure review_unit is data : unit.definition := unit.description (review_unit_data); from : faction.definition := faction.description (data.kind); @@ -1181,11 +1188,14 @@ package body world is count : constant natural := skill.limit'last + 1; begin for index in skill.limit loop - ui.draw_icon_and_text (data => skill.icon (data.skills (index).index), - text => skill.description (data.skills (index).index).name.all & data.skills (index).value'image, - x => x + (index mod 2) * (width / 2), - y => y + (index / 2) * core.icon, - width => width / 2); + review_skill_data := data.skills (index).index; + -- + ui.draw_icon_and_text (data => skill.icon (data.skills (index).index), + text => skill.description (data.skills (index).index).name.all & data.skills (index).value'image, + x => x + (index mod 2) * (width / 2), + y => y + (index / 2) * core.icon, + width => width / 2, + action => review_skill'access); end loop; -- return (width, (count / 2) * core.icon); diff --git a/source/world.ads b/source/world.ads index cec8d37..e23770c 100644 --- a/source/world.ads +++ b/source/world.ads @@ -41,8 +41,9 @@ package world is map : definition; - review_unit_data : unit.enumeration; - review_chad_data : chad.enumeration; + review_skill_data : skill.enumeration; + review_unit_data : unit.enumeration; + review_chad_data : chad.enumeration; ------------------------------------------------------------------------------------------ @@ -70,6 +71,7 @@ package world is procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y, factor : in integer); procedure draw_chad (data : in chad.information; state : in core.animation; x, y, factor : in integer); + procedure review_skill; procedure review_unit; procedure review_chad;