From 06d347a771a5bf5bfeb526f845993d44d331528a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Mon, 1 Aug 2022 12:19:19 +0200
Subject: [PATCH] =?UTF-8?q?!OSDN=2045072:=20S=C5=82awomir=20Lach=20<slawek?=
 =?UTF-8?q?@lach.art.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ruleset author can look inside sandbox to figure
out how to use counters.

diff --git a/data/sandbox/README.sandbox b/data/sandbox/README.sandbox
index c8d219a898..a43d43b4e9 100644
--- a/data/sandbox/README.sandbox
+++ b/data/sandbox/README.sandbox
@@ -263,3 +263,13 @@ players are automatically shared to everyone.
 
 Shared Tiles clause
 Diplomatic treaties can include Shared Tiles clause.
+
+Counters
+Counters are used in this ruleset to provide some effects of conquering city:
+* After conquering an city, half of it's population will be unhappy (applies
+for first 5th turns after conquering an city).
+* After conquering an city, 20% of it's population will be unhappy (applies
+for two turns after previous effect).
+* After conquering an city, each tile of this city will produce one less unit
+of each extra: SHIELD,TRADE,FOOD (it applies for first 5th turns after
+conquering).
diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset
index 93b9a2d26c..9b265ee027 100644
--- a/data/sandbox/effects.ruleset
+++ b/data/sandbox/effects.ruleset
@@ -5408,3 +5408,31 @@ reqs    =
     { "type",   "name",         "range", "present"
       "Action", "Upgrade Unit", "Local", TRUE
     }
+
+; Additional unhappy for some turns after conquering the city
+[effect_rebel]
+type = "Enemy_Citizen_Unhappy_Pct"
+value = 30
+reqs =
+  { "type", "name", "range", "present", "quiet"
+     "Counter", "Reduce Enemy Happiness", "City", FALSE, FALSE
+    
+  }
+
+[effect_rebel2]
+type = "Enemy_Citizen_Unhappy_Pct"
+value = 20
+reqs =
+  { "type", "name", "range", "present", "quiet"
+     "Counter", "Further Reduce Enemy Happiness", "City", FALSE, FALSE
+    
+  }  
+  
+[effect_strike1]
+type = "Output_Add_Tile"
+value = -1
+reqs =
+  { "type", "name", "range", "present", "quiet"
+     "Counter", "Reduce production after conquering city", "City", FALSE, FALSE
+  }  
+    
diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset
index 470eddc932..72ea6335b9 100644
--- a/data/sandbox/game.ruleset
+++ b/data/sandbox/game.ruleset
@@ -3535,6 +3535,41 @@ type = "Embassy"
 [clause_sharedtiles]
 type = "SharedTiles"
 
+;Counter types
+;
+;name                    = translatable name as seen by user
+;rule_name               = (optional) internal name for savegames, rulesets
+;                          etc; if not present, "name" is used for this
+;                          purpose too. Since the name used in savegames must
+;                          not change, if you want to rename an item after a
+;                          ruleset has been released, you should set
+;                          "rule_name" to the original value of "name".
+;checkpoint              = Trigger value of the counter. When counter's
+;                          value is at least this much, the "Counter" requirement
+;                          is fulfilled.
+;def                     = Initial value of the counter.
+;type                    = Behavior of the counter:
+;                          "Owned" - Increased each turn, zeroed when city changes owner
+
+[counter_owned1]
+name = _("Reduce Enemy Happiness")
+def = 0
+checkpoint = 5
+type = "OWNED"
+
+[counter_owned2]
+name = _("Further Reduce Enemy Happiness")
+def = 0
+checkpoint = 7
+type = "OWNED"
+
+; Default value are 6, so citizens do not strike right after build the city
+; city may to be conquered to made citizens striking
+[counter_owned3_strike]
+name = _("Reduce production after conquering city")
+def = 6
+checkpoint = 5
+type = "OWNED"
 
 [playercolors]
 background.r = 86
-- 
2.38.0

