Browse Source

Core plant implementation...

master
Ognjen Milan Robovic 7 months ago
parent
commit
add562fb08
1 changed files with 42 additions and 5 deletions
  1. +42
    -5
      xabina.adb

+ 42
- 5
xabina.adb View File

@@ -68,9 +68,7 @@ function xabina return integer is
when COLOUR_CYAN => put ("6");
when COLOUR_WHITE => put ("7");
end case;
put ("m");
put (symbol);
put (character'val (27) & "[0m");
put ("m" & symbol & character'val (27) & "[0m");
return 1;
end render_character;

@@ -393,9 +391,42 @@ function xabina return integer is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

type plant_list is (
PLANT_FLOWER, PLANT_GRASS, PLANT_REED, PLANT_BUSH, PLANT_APPLE_TREE, PLANT_LEMON_TREE, PLANT_OAK_TREE, PLANT_PINE_TREE
OAK_TREE, PINE_TREE, BIRCH_TREE, ACACIA_TREE, APPLE_TREE, PEACH_TREE, ORANGE_TREE, PEAR_TREE,
BUSH, THORNY_BUSH, TALL_GRASS, REED
);

type plant_mark is mod 72;

type plant_constant_type is new entity_constant_type with
record
health_limit : natural := 0;
end record;

type plant_variable_type is new entity_variable_type with
record
health : natural := 0;
end record;

type plant_constant_list is array (plant_list) of plant_constant_type;
type plant_variable_list is array (plant_mark) of plant_variable_type;

plant_constant_data : constant plant_constant_list := (
(ENTITY_PLANT, to_unbounded_string ("Oak Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 11),
(ENTITY_PLANT, to_unbounded_string ("Pine Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 23),
(ENTITY_PLANT, to_unbounded_string ("Birch Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 13),
(ENTITY_PLANT, to_unbounded_string ("Acacia Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 19),
(ENTITY_PLANT, to_unbounded_string ("Apple Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 17),
(ENTITY_PLANT, to_unbounded_string ("Peach Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 13),
(ENTITY_PLANT, to_unbounded_string ("Orange Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 11),
(ENTITY_PLANT, to_unbounded_string ("Pear Tree"), 'T', COLOUR_GREEN, EFFECT_BOLD, 13),
(ENTITY_PLANT, to_unbounded_string ("Bush"), '&', COLOUR_GREEN, EFFECT_NORMAL, 5),
(ENTITY_PLANT, to_unbounded_string ("Thorny Bush"), '&', COLOUR_GREEN, EFFECT_NORMAL, 7),
(ENTITY_PLANT, to_unbounded_string ("Tall Grass"), '%', COLOUR_GREEN, EFFECT_NORMAL, 3),
(ENTITY_PLANT, to_unbounded_string ("Reed"), '%', COLOUR_GREEN, EFFECT_NORMAL, 3)
);

plant_variable_data : plant_variable_list;

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Animal
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -409,7 +440,7 @@ function xabina return integer is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

type goblin_list is (
GOBLIN_FEMALE, GOBLIN_WORKER, GOBLIN_WARRIOR, GOBLIN_BOAR_RIDER, GOBLIN_SHAMAN, GOBLIN_CHIEF, GOBLIN_KING, GOBLIN_OGRE
GOBLIN_SLAVE, GOBLIN_WORKER, GOBLIN_WARRIOR, GOBLIN_BOAR_RIDER, GOBLIN_SHAMAN, GOBLIN_CHIEF, GOBLIN_KING, GOBLIN_OGRE
);

type goblin_constant_type is new entity_constant_type with
@@ -471,6 +502,12 @@ begin
put_line (" " & to_string (armour_constant_data (this).name));
end loop;

for this in plant_list
loop
x := x + render_character (plant_constant_data (this).symbol, plant_constant_data (this).colour, plant_constant_data (this).effect);
put_line (" " & to_string (plant_constant_data (this).name));
end loop;

return 0;

end xabina;

Loading…
Cancel
Save