From 021a7848388e5c4dfe0ac8778db1720d7ff2bca1 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 7 Jan 2024 05:29:00 +0200
Subject: [PATCH 36/36] Granularity: Add military techs

See RM #137

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 data/granularity/buildings.ruleset | 24 +++++++++++
 data/granularity/effects.ruleset   |  9 ++++
 data/granularity/techs.ruleset     | 20 +++++++++
 data/granularity/units.ruleset     | 68 +++++++++++++++++++++++-------
 4 files changed, 106 insertions(+), 15 deletions(-)

diff --git a/data/granularity/buildings.ruleset b/data/granularity/buildings.ruleset
index 4e6fa867e5..4e5d2258c7 100644
--- a/data/granularity/buildings.ruleset
+++ b/data/granularity/buildings.ruleset
@@ -75,6 +75,30 @@ format_version = 40
 ;
 ; */ <-- avoid gettext warnings
 
+[building_barracks]
+name		= _("Barracks")
+genus		= "Improvement"
+reqs	=
+    { "type", "name", "range"
+      "Tech", "Military Training", "Player"
+    }
+graphic         = "b.barracks"
+graphic_alt     = "b.barracks_i"
+graphic_alt2    = "-"
+obsolete_by	=
+    { "type", "name", "range"
+    }
+build_cost	= 1100
+upkeep		= 5
+sabotage	= 50
+sound		= "b_barracks"
+sound_alt	= "b_barracks_i"
+sound_alt2      = "b_generic"
+helptext	= _("\
+With a Barracks, each new land unit built in a city will \
+automatically have Veteran status.\
+")
+
 [building_city_walls]
 name		= _("City Walls")
 genus		= "Improvement"
diff --git a/data/granularity/effects.ruleset b/data/granularity/effects.ruleset
index be467d3538..6b1a47790b 100644
--- a/data/granularity/effects.ruleset
+++ b/data/granularity/effects.ruleset
@@ -205,6 +205,15 @@ reqs	=
       "Building", "Granary", "City"
     }
 
+[effect_barracks]
+type    = "Veteran_Build"
+value	= 1
+reqs	=
+    { "type",      "name",     "range", "present"
+      "Building",  "Barracks", "City",  TRUE
+      "UnitClass", "Land",     "Local", TRUE
+    }
+
 [effect_fortified]
 type    = "Fortify_Defense_Bonus"
 value   = 50
diff --git a/data/granularity/techs.ruleset b/data/granularity/techs.ruleset
index d5956065d9..ea2570dd27 100644
--- a/data/granularity/techs.ruleset
+++ b/data/granularity/techs.ruleset
@@ -153,6 +153,15 @@ graphic     = "a.art"
 graphic_alt = "-"
 ;helptext    =
 
+[advance_bronze_weapons]
+name        = _("Bronze Weapons")
+req1        = "Mining"
+req2        = "None"
+flags       = ""
+graphic     = "a.bronze_weapons"
+graphic_alt = "-"
+;helptext    =
+
 [advance_carving]
 name        = _("Carving")
 req1        = "Tools"
@@ -255,6 +264,17 @@ graphic     = "a.masonry"
 graphic_alt = "-"
 ;helptext    =
 
+[advance_military_training]
+name        = _("Military Training")
+req1        = "Government"
+req2        = "Animal Taming"
+flags       = ""
+graphic     = "a.military_training"
+graphic_alt = "-"
+helptext    = _("\
+Also humans can be trained.\
+")
+
 [advance_mining]
 name        = _("Mining")
 req1        = "Carving"
diff --git a/data/granularity/units.ruleset b/data/granularity/units.ruleset
index 42f3a09d2d..81e139cf50 100644
--- a/data/granularity/units.ruleset
+++ b/data/granularity/units.ruleset
@@ -46,23 +46,23 @@ class_flags =
 
 [veteran_system]
 ; What are the names of the levels?
-veteran_names = _("green")
+veteran_names = _("green"), _("regular")
 
 ; The percentage chance of increasing level through combat
-veteran_base_raise_chance = 0
+veteran_base_raise_chance = 40, 0
 
 ; Power factors are as a percentage.
 ; +50% is represented by 150
-veteran_power_fact = 100
+veteran_power_fact = 100, 125
 
 ; The percentage chance of a settler/engineer increasing level through
 ; performing useful work (per turn)
-veteran_work_raise_chance = 0
+veteran_work_raise_chance = 0, 0
 
 ; The additional number of movement points granted for different veteran
 ; levels. These are fractional move points as defined by move_fragments in
 ; terrain.ruleset.
-veteran_move_bonus = 0
+veteran_move_bonus = 0, 0
 
 ; /* <-- avoid gettext warnings
 ;
@@ -424,8 +424,8 @@ tp_defense    = "Alight"
 flags         = "Workers", "Cities"
 roles         = "ExplorerStartUnit", "Firstbuild", "CitiesStartUnit"
 helptext      = _("\
-  Nomads can both fight and found new cities, but unlike specialized\
-  units they cost two population points to build.\
+Nomads can both fight and found new cities, but unlike specialized \
+units they cost two population points to build.\
 ")
 
 [unit_warriors]
@@ -460,7 +460,42 @@ tp_defense    = "Alight"
 ;flags         =
 roles         = "Firstbuild"
 helptext      = _("\
-  Warriors are the first unit specialized in war.\
+Warriors are the first unit specialized in war.\
+")
+
+[unit_phalanx]
+name          = _("Phalanx")
+class         = "Land"
+reqs          =
+  { "type", "name", "range"
+    "Tech", "Bronze Weapons", "Player"
+  }
+obsolete_by   = "None"
+graphic       = "u.phalanx"
+graphic_alt   = "-"
+sound_move    = "m_phalanx"
+sound_move_alt = "m_generic"
+sound_fight   = "f_phalanx"
+sound_fight_alt = "f_generic"
+build_cost    = 2000
+pop_cost      = 0
+attack        = 10
+defense       = 20
+hitpoints     = 10
+firepower     = 1
+move_rate     = 100
+vision_radius_sq = 2
+transport_cap = 0
+fuel          = 0
+uk_happy      = 0
+uk_shield     = 100
+uk_food       = 0
+uk_gold       = 0
+tp_defense    = "Alight"
+;flags         =
+roles         = "Firstbuild", "DefendGoodStartUnit"
+helptext      = _("\
+Phalanx is a good defender for your early cities.\
 ")
 
 [unit_hunters]
@@ -495,8 +530,8 @@ tp_defense    = "Alight"
 ;flags         =
 ;roles         =
 helptext      = _("\
-Hunters and their dogs can mostly provide upkeep for themselves, not requiring\
- it from their homecity.\
+Hunters and their dogs can mostly provide upkeep for themselves, not requiring \
+as much of it from their homecity.\
 ")
 
 [unit_horsemen]
@@ -601,7 +636,7 @@ uk_gold       = 0
 tp_defense    = "Alight"
 flags         = "Cities"
 helptext      = _("\
-  Settlers are specialized in founding new cities.\
+Settlers are specialized in founding new cities.\
 ")
 
 [unit_worker]
@@ -636,8 +671,8 @@ tp_defense    = "Alight"
 flags         = "Workers", "NonMil"
 roles         = "Settlers", "WorkerStartUnit"
 helptext      = _("\
-Workers have the ability to transform terrain by cutting and planting trees\
- and plants.\
+Workers have the ability to transform terrain by cutting and planting trees \
+and plants.\
 ")
 
 [unit_boat]
@@ -673,7 +708,7 @@ tp_defense    = "Alight"
 flags         = ""
 roles         = "Ferryboat", "BarbarianBoat"
 helptext      = _("\
-  Boats carved from logs.\
+Boats carved from logs.\
 ")
 
 [unit_emissary]
@@ -707,4 +742,7 @@ uk_gold       = 0
 tp_defense    = "Alight"
 flags         = "Diplomat"
 roles         = "DiplomatStartUnit"
-;helptext      =
+helptext      = _("\
+Diplomatic unit.\
+")
+
-- 
2.43.0

