From 34edd2ef7299ac246f9eda901de3cb9730a14c97 Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 28 May 2024 06:08:45 -0400 Subject: [PATCH] Added picking-up bananas... --- game/world/location/banana_tree.png | Bin 0 -> 779 bytes source/chad.adb | 4 ++- source/chad.ads | 3 +- source/effect.adb | 64 +++++++++++++++++++----------------- source/effect.ads | 7 ++-- source/main.adb | 2 ++ source/material.adb | 35 ++++++++++++++++++-- source/material.ads | 11 ++++++- source/world.ads | 16 +++++---- 9 files changed, 96 insertions(+), 46 deletions(-) create mode 100644 game/world/location/banana_tree.png diff --git a/game/world/location/banana_tree.png b/game/world/location/banana_tree.png new file mode 100644 index 0000000000000000000000000000000000000000..3aef1898f4113ae257a2ea0367c9877297ad2c37 GIT binary patch literal 779 zcmeAS@N?(olHy`uVBq!ia0vp^4nS{@IhgQ=+r?aQtVx#-PAp|90}Nd%JfY zD=wQe+0RC};V^qcal`v(bLw@Tg&p|LdqwHM=F&$>GEF<`RT^$t)rfJb7#b$p!&wtyUSn~de#_JO4#PuKF9`UL8vDU&|`how0ScY32DkYWblQ`cz zW3J%XA1iMk=Vmi4%D08vc+XP7=>KASth$0Wo9)?qWLn&P#!%5I_q#uw7O^i<;TL0*7&?wQvjhPBsXpCkvuWMT-@ac? zy+5cpm*?wd#yuSNGZ~aV-&z0H@5}zq*TN0V4b6u4`4walbf%zuicCh$*&3?f&{Xuf=pQ}F_UcR-x(C=P4{|WQHF8Qa-F*8q;6=k`aKVVM# z_`lRH!K`8b8Frn6_1(48JI@Gwdwf%Vg3tW@Q}}O4?f2Qf== world.map.chads (1).attributes (attribute.offense) := world.map.chads (1).attributes (attribute.offense) + data.modifier; - when defense => world.map.chads (1).attributes (attribute.defense) := world.map.chads (1).attributes (attribute.defense) + data.modifier; - when wisdom => world.map.chads (1).attributes (attribute.wisdom) := world.map.chads (1).attributes (attribute.wisdom) + data.modifier; - when stamina => world.map.chads (1).attributes (attribute.stamina) := world.map.chads (1).attributes (attribute.stamina) + data.modifier; - when speed => world.map.chads (1).attributes (attribute.speed) := world.map.chads (1).attributes (attribute.speed) + data.modifier; - when reach => world.map.chads (1).attributes (attribute.reach) := world.map.chads (1).attributes (attribute.reach) + data.modifier; - when alchemy => world.map.chads (1).skills (skill.alchemy) := world.map.chads (1).skills (skill.alchemy) + data.modifier; - when archery => world.map.chads (1).skills (skill.archery) := world.map.chads (1).skills (skill.archery) + data.modifier; - when architecture => world.map.chads (1).skills (skill.architecture) := world.map.chads (1).skills (skill.architecture) + data.modifier; - when athletics => world.map.chads (1).skills (skill.athletics) := world.map.chads (1).skills (skill.athletics) + data.modifier; - when diplomacy => world.map.chads (1).skills (skill.diplomacy) := world.map.chads (1).skills (skill.diplomacy) + data.modifier; - when estates => world.map.chads (1).skills (skill.estates) := world.map.chads (1).skills (skill.estates) + data.modifier; - when exploration => world.map.chads (1).skills (skill.exploration) := world.map.chads (1).skills (skill.exploration) + data.modifier; - when leadership => world.map.chads (1).skills (skill.leadership) := world.map.chads (1).skills (skill.leadership) + data.modifier; - when logistics => world.map.chads (1).skills (skill.logistics) := world.map.chads (1).skills (skill.logistics) + data.modifier; - when medicine => world.map.chads (1).skills (skill.medicine) := world.map.chads (1).skills (skill.medicine) + data.modifier; - when mercantile => world.map.chads (1).skills (skill.mercantile) := world.map.chads (1).skills (skill.mercantile) + data.modifier; - when mysticism => world.map.chads (1).skills (skill.mysticism) := world.map.chads (1).skills (skill.mysticism) + data.modifier; - when necromancy => world.map.chads (1).skills (skill.necromancy) := world.map.chads (1).skills (skill.necromancy) + data.modifier; - when resistance => world.map.chads (1).skills (skill.resistance) := world.map.chads (1).skills (skill.resistance) + data.modifier; - when skirmish => world.map.chads (1).skills (skill.skirmish) := world.map.chads (1).skills (skill.skirmish) + data.modifier; - when sorcery => world.map.chads (1).skills (skill.sorcery) := world.map.chads (1).skills (skill.sorcery) + data.modifier; - when tactics => world.map.chads (1).skills (skill.tactics) := world.map.chads (1).skills (skill.tactics) + data.modifier; - when thaumaturgy => world.map.chads (1).skills (skill.thaumaturgy) := world.map.chads (1).skills (skill.thaumaturgy) + data.modifier; - when gold => world.map.chads (1).resources (resource.gold) := world.map.chads (1).resources (resource.gold) + data.modifier; - when wood => world.map.chads (1).resources (resource.wood) := world.map.chads (1).resources (resource.wood) + data.modifier; - when stone => world.map.chads (1).resources (resource.stone) := world.map.chads (1).resources (resource.stone) + data.modifier; - when metal => world.map.chads (1).resources (resource.metal) := world.map.chads (1).resources (resource.metal) + data.modifier; - when leather => world.map.chads (1).resources (resource.leather) := world.map.chads (1).resources (resource.leather) + data.modifier; - when gem => world.map.chads (1).resources (resource.gem) := world.map.chads (1).resources (resource.gem) + data.modifier; - when others => null; + when idle => null; + when offense => core.increment (world.map.chads (1).attributes (attribute.offense).value, data.modifier); + when defense => core.increment (world.map.chads (1).attributes (attribute.defense).value, data.modifier); + when wisdom => core.increment (world.map.chads (1).attributes (attribute.wisdom).value, data.modifier); + when stamina => core.increment (world.map.chads (1).attributes (attribute.stamina).value, data.modifier); + when speed => core.increment (world.map.chads (1).attributes (attribute.speed).value, data.modifier); + when reach => core.increment (world.map.chads (1).attributes (attribute.reach).value, data.modifier); + when alchemy => core.increment (world.map.chads (1).skills (skill.alchemy).value, data.modifier); + when archery => core.increment (world.map.chads (1).skills (skill.archery).value, data.modifier); + when architecture => core.increment (world.map.chads (1).skills (skill.architecture).value, data.modifier); + when athletics => core.increment (world.map.chads (1).skills (skill.athletics).value, data.modifier); + when diplomacy => core.increment (world.map.chads (1).skills (skill.diplomacy).value, data.modifier); + when estates => core.increment (world.map.chads (1).skills (skill.estates).value, data.modifier); + when exploration => core.increment (world.map.chads (1).skills (skill.exploration).value, data.modifier); + when leadership => core.increment (world.map.chads (1).skills (skill.leadership).value, data.modifier); + when logistics => core.increment (world.map.chads (1).skills (skill.logistics).value, data.modifier); + when medicine => core.increment (world.map.chads (1).skills (skill.medicine).value, data.modifier); + when mercantile => core.increment (world.map.chads (1).skills (skill.mercantile).value, data.modifier); + when mysticism => core.increment (world.map.chads (1).skills (skill.mysticism).value, data.modifier); + when necromancy => core.increment (world.map.chads (1).skills (skill.necromancy).value, data.modifier); + when resistance => core.increment (world.map.chads (1).skills (skill.resistance).value, data.modifier); + when skirmish => core.increment (world.map.chads (1).skills (skill.skirmish).value, data.modifier); + when sorcery => core.increment (world.map.chads (1).skills (skill.sorcery).value, data.modifier); + when tactics => core.increment (world.map.chads (1).skills (skill.tactics).value, data.modifier); + when thaumaturgy => core.increment (world.map.chads (1).skills (skill.thaumaturgy).value, data.modifier); + when gold => core.increment (world.map.chads (1).resources (resource.gold).value, data.modifier); + when wood => core.increment (world.map.chads (1).resources (resource.wood).value, data.modifier); + when stone => core.increment (world.map.chads (1).resources (resource.stone).value, data.modifier); + when metal => core.increment (world.map.chads (1).resources (resource.metal).value, data.modifier); + when leather => core.increment (world.map.chads (1).resources (resource.leather).value, data.modifier); + when gem => core.increment (world.map.chads (1).resources (resource.gem).value, data.modifier); + -- + when take_material => core.increment (world.map.chads (1).materials (material.enumeration'val (data.modifier)).value, data.amount); end case; end apply; diff --git a/source/effect.ads b/source/effect.ads index 9cd238e..88922c4 100644 --- a/source/effect.ads +++ b/source/effect.ads @@ -7,11 +7,13 @@ package effect is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type operation_index is ( + idle, offense, defense, wisdom, stamina, speed, reach, alchemy, archery, architecture, athletics, diplomacy, estates, exploration, leadership, logistics, medicine, mercantile, mysticism, necromancy, resistance, skirmish, sorcery, tactics, thaumaturgy, - gold, wood, stone, metal, leather, gem + gold, wood, stone, metal, leather, gem, + take_material ); ------------------------------------------------------------------------------------------ @@ -19,11 +21,12 @@ package effect is type value is record operation : operation_index; modifier : integer; + amount : natural; permanent : boolean; duration : natural; end record; - none : value; + none : constant value := (idle, 0, 0, false, 0); ------------------------------------------------------------------------------------------ diff --git a/source/main.adb b/source/main.adb index a7e9da5..8d4b497 100644 --- a/source/main.adb +++ b/source/main.adb @@ -129,6 +129,7 @@ procedure main is attributes => attribute.default, skills => skill.default, resources => ((101, 240), (103, 240), (107, 240), (109, 240), (113, 240), (127, 240)), + materials => material.default, equipments => (equipment.chest => equipment.elven_armour, equipment.head => equipment.elven_helmet, equipment.hands => equipment.leather_gauntlets, @@ -307,6 +308,7 @@ begin end loop; -- resource.draw_points (world.map.chads (1).resources, (preview_width - 5 * core.icon * resource.count) / 2, core.base); + material.draw_points (world.map.chads (1).materials, core.icon, 2 * core.base); -- signal_list (core.signal_mode).all; -- diff --git a/source/material.adb b/source/material.adb index 88a43bc..281aa0b 100644 --- a/source/material.adb +++ b/source/material.adb @@ -23,10 +23,39 @@ package body material is ------------------------------------------------------------------------------------------ - procedure draw (index : in enumeration; x, y : in integer) is + procedure draw_points (data : in points := (others => (0, 0)); + x : in integer := 0; + y : in integer := 0) is + move_x : integer := x; begin - core.draw (sprite (index), x, y); - end draw; + for index in enumeration loop + if data (index).value > 0 then + ui.draw_icon (sprite (index), trait (index).name, move_x, y); + ui.draw_text_box (move_x, y + core.icon, core.icon, core.icon); + ui.write (data (index).value'image, move_x + 4, y + core.icon + 8, (255, 255, 255, 255), 15, true); + -- + move_x := move_x + core.icon; + end if; + end loop; + end draw_points; + + ------------------------------------------------------------------------------------------ + + procedure save_points (here : in core.io.file_type; data : in points) is + begin + for index in enumeration loop + core.save_point (here, data (index)); + end loop; + end save_points; + + ------------------------------------------------------------------------------------------ + + procedure load_points (here : in core.io.file_type; data : out points) is + begin + for index in enumeration loop + core.load_point (here, data (index)); + end loop; + end load_points; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/material.ads b/source/material.ads index ba889a7..8044ff1 100644 --- a/source/material.ads +++ b/source/material.ads @@ -58,11 +58,20 @@ package material is animal_fur => ("Animal Fur ", 7) ); + type points is array (enumeration) of core.point; + + default : points := (others => (1, 12)); + ------------------------------------------------------------------------------------------ procedure configure; - procedure draw (index : in enumeration; x, y : in integer); + procedure draw_points (data : in points := (others => (0, 0)); + x : in integer := 0; + y : in integer := 0); + + procedure save_points (here : in core.io.file_type; data : in points); + procedure load_points (here : in core.io.file_type; data : out points); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/world.ads b/source/world.ads index 0358373..a16ece3 100644 --- a/source/world.ads +++ b/source/world.ads @@ -2,7 +2,7 @@ -- -- GNU General Public Licence (version 3 or later) -with core, equipment, unit, construction, chad, effect; +with core, material, equipment, unit, construction, chad, effect; package world is @@ -20,7 +20,7 @@ package world is ); type location_index is ( - well_of_agility, well_of_knowledge, well_of_strength, old_dwarven_grave, huge_ancient_urn + well_of_agility, well_of_knowledge, well_of_strength, old_dwarven_grave, huge_ancient_urn, banana_tree ); ------------------------------------------------------------------------------------------ @@ -105,11 +105,13 @@ package world is ); location_trait : constant array (location_index) of location_stats := ( - well_of_agility => ("Well of Agility ", true, 4, 3, (effect.speed, 2, false, 0)), - well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.wisdom, 2, false, 0)), - well_of_strength => ("Well of Strength ", true, 4, 3, (effect.offense, 2, false, 0)), - old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.defense, 1, false, 0)), - huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.offense, 1, false, 0)) + well_of_agility => ("Well of Agility ", true, 4, 3, (effect.speed, 2, 0, false, 0)), + well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.wisdom, 2, 0, false, 0)), + well_of_strength => ("Well of Strength ", true, 4, 3, (effect.offense, 2, 0, false, 0)), + old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.defense, 1, 0, false, 0)), + huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.offense, 1, 0, false, 0)), + -- + banana_tree => ("Banana Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.banana), 4, true, 600)) ); map : information;