From 0d652301f5ffb548622871c9b669b120617045a2 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 10 Dec 2023 07:46:07 +0200
Subject: [PATCH 13/13] Granularity: Demonstrate aircraft "Relocate" action

See RM #51

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 data/granularity/actions.ruleset | 23 +++++++++++++-----
 data/granularity/effects.ruleset |  8 +++++++
 data/granularity/techs.ruleset   |  9 +++++++
 data/granularity/units.ruleset   | 41 ++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/data/granularity/actions.ruleset b/data/granularity/actions.ruleset
index efef40b696..0d6a86aa4d 100644
--- a/data/granularity/actions.ruleset
+++ b/data/granularity/actions.ruleset
@@ -203,6 +203,9 @@ ui_name_transport_embark = _("%sEmbark%s")
 ; /* TRANS: Regular _Move (100% chance of success). */
 ui_name_unit_move = _("%sKeep moving%s")
 
+; /* TRANS: Teleport (100% chance of success). */
+ui_name_teleport = _("%sRelocate%s")
+
 ; Blank ruleset defined user actions.
 ; See the section "Ruleset defined actions" in doc/README.actions
 ; Example: set up "User Action 1"
@@ -232,14 +235,14 @@ ui_name_unit_move = _("%sKeep moving%s")
 quiet_actions = "Transport Disembark 2", "Unit Move"
 
 [actionenabler_found_city]
-action = "Found City"
+action        = "Found City"
 actor_reqs    =
     { "type",   "name", "range"
       "UnitFlag", "Cities", "Local"
       "UnitState", "OnLivableTile", "Local"
       "MinMoveFrags", "5", "Local"
     }
-target_reqs    =
+target_reqs   =
     { "type",   "name", "range", "present"
       "TerrainFlag","NoCities","Tile",FALSE
     }
@@ -265,7 +268,7 @@ actor_reqs    =
       "UnitState", "OnLivableTile", "Local"
       "UnitState", "Transported",   "Local"
     }
-target_reqs    =
+target_reqs   =
     { "type",      "name",         "range"
       "UnitState", "Transporting", "Local"
     }
@@ -287,7 +290,7 @@ actor_reqs    =
     { "type",      "name",         "range"
       "UnitState", "Transporting", "Local"
     }
-target_reqs    =
+target_reqs   =
     { "type",      "name",          "range"
       "UnitState", "OnLivableTile", "Local"
       "UnitState", "Transported",   "Local"
@@ -334,9 +337,17 @@ actor_reqs    =
     }
 
 [actionenabler_regular_move]
-action     = "Unit Move"
-actor_reqs =
+action        = "Unit Move"
+actor_reqs    =
     { "type",         "name",        "range", "present"
       "MinMoveFrags", "5",           "Local", TRUE
       "UnitState",    "Transported", "Local", FALSE
     }
+
+[actionenabler_relocate]
+action        = "Teleport"
+actor_reqs    =
+    { "type",         "name",        "range", "present"
+      "UnitClass",    "Air",         "Local", TRUE
+      "UnitState",    "Transported", "Local", FALSE
+    }
diff --git a/data/granularity/effects.ruleset b/data/granularity/effects.ruleset
index aa8cd94dcb..52b37dd103 100644
--- a/data/granularity/effects.ruleset
+++ b/data/granularity/effects.ruleset
@@ -231,6 +231,14 @@ reqs    =
       "UnitClassFlag", "TerrainSpeed",          "Local", TRUE
     }
 
+[effect_action_success_relocate]
+type    = "Action_Success_Actor_Move_Cost"
+value   = 100
+reqs    =
+    { "type",          "name",                  "range", "present"
+      "Action",        "Teleport",              "Local", TRUE
+    }
+
 [effect_no_tools]
 type    = "Output_Bonus"
 value   = -50
diff --git a/data/granularity/techs.ruleset b/data/granularity/techs.ruleset
index b36881b4ed..601ba7b469 100644
--- a/data/granularity/techs.ruleset
+++ b/data/granularity/techs.ruleset
@@ -169,6 +169,15 @@ graphic     = "a.fishing"
 graphic_alt = "-"
 helptext    = _("Makes it possible to use Oceanic tiles.")
 
+[advance_flight]
+name        = _("Flight")
+req1        = "Masonry"
+req2        = "Carving"
+flags       = ""
+graphic     = "a.flight"
+graphic_alt = "-"
+helptext    = _("First flying machines.")
+
 [advance_government]
 name        = _("Government")
 req1        = "Cave Painting"
diff --git a/data/granularity/units.ruleset b/data/granularity/units.ruleset
index 4f1350da3b..b0086ba78f 100644
--- a/data/granularity/units.ruleset
+++ b/data/granularity/units.ruleset
@@ -134,6 +134,12 @@ min_speed     = 5
 hp_loss_pct   = 0
 flags         = "TerrainSpeed"
 
+[unitclass_air]
+name          = _("Air")
+min_speed     = 0
+hp_loss_pct   = 0
+flags         = "BuildAnywhere"
+
 ; /* <-- avoid gettext warnings
 ;
 ; Below: The individual unit types, one per section.
@@ -524,6 +530,41 @@ helptext      = _("\
 Horsemen are the first fast unit.\
 ")
 
+[unit_bomber]
+name          = _("Bomber")
+class         = "Air"
+reqs          =
+  { "type", "name", "range"
+    "Tech", "Flight", "Player"
+  }
+obsolete_by   = "None"
+graphic       = "u.bomber"
+graphic_alt   = "-"
+sound_move    = "m_bomber"
+sound_move_alt = "m_generic"
+sound_fight   = "f_bomber"
+sound_fight_alt = "f_generic"
+build_cost    = 20000
+pop_cost      = 0
+attack        = 200
+defense       = 50
+hitpoints     = 30
+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         =
+helptext      = _("\
+Unit capable of bombing enemy cities, and more.\
+")
+
 [unit_settlers]
 name          = _("Settlers")
 class         = "Land"
-- 
2.42.0

