Index: binaries/data/mods/public/simulation/components/BuildRestrictions.js
===================================================================
--- binaries/data/mods/public/simulation/components/BuildRestrictions.js	(révision 15890)
+++ binaries/data/mods/public/simulation/components/BuildRestrictions.js	(copie de travail)
@@ -32,7 +32,7 @@
 			"</oneOrMore>" +
 		"</list>" +
 	"</element>" +
-	"<element name='Category' a:help='Specifies the category of this building, for satisfying special constraints. Choices include: CivilCentre, House, DefenseTower, Farmstead, Market, Barracks, Dock, Fortress, Field, Temple, Wall, Fence, Storehouse, Stoa, Resource, Special, Wonder, Apadana, Embassy, Monument'>" +
+	"<element name='Category' a:help='Specifies the category of this building, for satisfying special constraints. Choices include: CivilCentre, Colony, House, DefenseTower, Farmstead, Market, Barracks, Dock, Fortress, Field, Temple, Wall, Fence, Storehouse, Stoa, Resource, Special, Wonder, Apadana, Embassy, Monument'>" +
 		"<text/>" +
 	"</element>" +
 	"<optional>" +
Index: binaries/data/mods/public/simulation/components/Builder.js
===================================================================
--- binaries/data/mods/public/simulation/components/Builder.js	(révision 15890)
+++ binaries/data/mods/public/simulation/components/Builder.js	(copie de travail)
@@ -7,6 +7,14 @@
 		"<Entities datatype='tokens'>" +
 			"\n    structures/{civ}_barracks\n    structures/{civ}_civil_centre\n    structures/celt_sb1\n  " +
 		"</Entities>" +
+		"<ConditionalEntities>" +
+			"<Colony>" +
+				"<Template>structures/sele_military_colony</Template>" +
+				"<Condition>Greater</Condition>" +
+				"<Category>CivilCentre</Category>" +
+			        "<Number>0</Number>" +
+			"</Colony>" +
+		"</ConditionalEntities>" +
 	"</a:example>" +
 	"<element name='Rate' a:help='Construction speed multiplier (1.0 is normal speed, higher values are faster)'>" +
 		"<ref name='positiveDecimal'/>" +
@@ -16,10 +24,34 @@
 			"<value>tokens</value>" +
 		"</attribute>" +
 		"<text/>" +
-	"</element>";
+	"</element>" +
+	"<optional>" +
+		"<element name='ConditionalEntities' a:help='entity template name that this unit can build under some condition'>" +
+			"<zeroOrMore>" +
+				"<element a:help='Name of this condition'>" +
+					"<anyName />" +
+					"<interleave>" +
+						"<element name='Template' a:help='Specifies the template name'><text/></element>" +
+						"<element name='Condition' a:help='Specifies the condition (can be Smaller or Greater)'><text/></element>" +
+						"<element name='Category' a:help='Specifies a category of building/unit for the condition. See BuildRestrictions/TrainingRestrictions for possible categories'><text/></element>" +
+						"<element name='Number' a:help='Numerical value for the condition'><data type='integer'/></element>" +
+					"</interleave>" +
+				"</element>" +
+			"</zeroOrMore>" +
+		"</element>" +
+	"</optional>";
 
 Builder.prototype.Init = function()
 {
+	this.conditional = [];
+	if (this.template.ConditionalEntities)
+	{
+		for (var condition in this.template.ConditionalEntities)
+		{
+			let cond = this.template.ConditionalEntities[condition];
+			this.conditional.push( {"template": cond.Template, "condition": cond.Condition, "category": cond.Category, "number": cond.Number, "added": false} );
+		}
+	}
 };
 
 Builder.prototype.Serialize = null; // we have no dynamic state to save
@@ -35,15 +67,41 @@
 		if (cmpIdentity)
 			string = string.replace(/\{civ\}/g, cmpIdentity.GetCiv());
 		entities = string.split(/\s+/);
-		
-		// Remove disabled entities
-		var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player)
-		var disabledEntities = cmpPlayer.GetDisabledTemplates();
-		
-		for (var i = entities.length - 1; i >= 0; --i)
-			if (disabledEntities[entities[i]])
-				entities.splice(i, 1);
 	}
+
+	// Add the possible conditional entities
+	if (this.conditional.length)
+	{
+		var cmpPlayerEntityLimits = QueryOwnerInterface(this.entity, IID_EntityLimits);
+		var cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);
+		if (cmpPlayerEntityLimits && cmpIdentity)
+		{
+			for (let cond of this.conditional)
+			{
+				if (!cond.added)   // Add it in EntityLimits counts
+				{
+					cmpPlayerEntityLimits.AddConditionalCategory(cond.category);
+					cond.added = true;
+				}
+				let count = cmpPlayerEntityLimits.GetCounts();
+				if ((cond.condition == "Smaller" && count[cond.category] < cond.number) ||
+					(cond.condition == "Greater" && count[cond.category] > cond.number))
+					entities.push( cond.template.replace(/\{civ\}/g, cmpIdentity.GetCiv()) ); 
+			}
+		}
+	}
+
+	if (!entities.length)
+		return entities;
+
+	// Remove disabled entities
+	var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player)
+	var disabledEntities = cmpPlayer.GetDisabledTemplates();
+	
+	for (var i = entities.length - 1; i >= 0; --i)
+		if (disabledEntities[entities[i]])
+			entities.splice(i, 1);
+
 	return entities;
 };
 
Index: binaries/data/mods/public/simulation/components/EntityLimits.js
===================================================================
--- binaries/data/mods/public/simulation/components/EntityLimits.js	(révision 15890)
+++ binaries/data/mods/public/simulation/components/EntityLimits.js	(copie de travail)
@@ -13,9 +13,12 @@
 		"</Limits>" +
 		"<LimitChangers>" +
 			"<Monument>" +
-				"<CivCentre>2</CivCentre>" +
+				"<CivilCentre>2</CivilCentre>" +
 			"</Monument>" +
 		"</LimitChangers>" +
+		"<LimitRemovers>" +
+			"<CivilCentre>town_phase</CivilCentre>" +
+		"</LimitRemovers>" +
 	"</a:example>" +
 	"<element name='Limits'>" +
 		"<zeroOrMore>" +
@@ -37,6 +40,14 @@
 				"</zeroOrMore>" +
 			"</element>" +
 		"</zeroOrMore>" +
+	"</element>" +
+	"<element name='LimitRemovers'>" +
+		"<zeroOrMore>" +
+			"<element a:help='Specifies a category of building/unit on which to apply this limit. See BuildRestrictions/TrainingRestrictions for possible categories'>" +
+				"<anyName />" +
+				"<text/>" +
+			"</element>" +
+		"</zeroOrMore>" +
 	"</element>";
 
 
@@ -52,18 +63,50 @@
 	this.limit = {};
 	this.count = {};
 	this.changers = {};
+	this.removers = {};
+	this.conditional = new Set();
 	for (var category in this.template.Limits)
 	{
 		this.limit[category] = +this.template.Limits[category];
 		this.count[category] = 0;
-		if (!(category in this.template.LimitChangers))
-			continue;
-		this.changers[category] = {};
-		for (var c in this.template.LimitChangers[category])
-			this.changers[category][c] = +this.template.LimitChangers[category][c];
+		if (category in this.template.LimitChangers)
+		{
+			this.changers[category] = {};
+			for (var c in this.template.LimitChangers[category])
+				this.changers[category][c] = +this.template.LimitChangers[category][c];
+		}
+		if (category in this.template.LimitRemovers)
+			this.removers[category] = this.template.LimitRemovers[category];
 	}
 };
 
+EntityLimits.prototype.AddConditionalCategory = function(category)
+{
+	if (this.count[category] === undefined)
+	{
+		// category not yet registred in this.count, add it.
+		var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
+		var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
+		var entities = cmpRangeManager.GetEntitiesByPlayer(cmpPlayer.GetPlayerID());
+		var count = 0;
+		for (let entity of entities)
+		{
+			var cmpBuildRestrictions = Engine.QueryInterface(entity, IID_BuildRestrictions);
+			if (cmpBuildRestrictions && cmpBuildRestrictions.GetCategory() == category)
+			{
+				count++;
+				continue;
+			}
+			var cmpTrainingRestrictions = Engine.QueryInterface(entity, IID_TrainingRestrictions);
+			if (cmpTrainingRestrictions && cmpTrainingRestrictions.GetCategory() == category)
+				count++;
+		}
+		this.count[category] = count;
+	}
+
+	this.conditional.add(category);
+};
+
 EntityLimits.prototype.ChangeLimit = function(category, value)
 {
 	this.limit[category] += value;
@@ -71,8 +114,18 @@
 
 EntityLimits.prototype.ChangeCount = function(category, value)
 {
-	if (this.count[category] !== undefined)
-		this.count[category] += value;
+	// Categories without limits may not have been initialised, but should be kept for possible conditional limits
+	if (this.count[category] === undefined)
+		this.count[category] = 0;
+		
+	this.count[category] += value;
+
+	if (this.conditional.has(category))
+	{
+		var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
+		var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
+		cmpGuiInterface.PushNotification({"type": "resetselectionpannel", "players": [cmpPlayer.GetPlayerID()]});
+	}
 };
 
 EntityLimits.prototype.GetLimits = function()
@@ -161,7 +214,7 @@
 	if (cmpTrainingRestrictions)
 		category = cmpTrainingRestrictions.GetCategory();
 	if (category)
-		this.ChangeCount(category,modifier);
+		this.ChangeCount(category, modifier);
 
 	// Update entity limits
 	var cmpIdentity = Engine.QueryInterface(msg.entity, IID_Identity);
@@ -178,4 +231,11 @@
 				this.ChangeLimit(category, modifier * this.changers[category][c]);
 };
 
+EntityLimits.prototype.RemoveLimits = function(tech)
+{
+	for (var category in this.removers)
+		if (this.removers[category] === tech)
+			this.limit[category] = undefined;
+};
+
 Engine.RegisterComponentType(IID_EntityLimits, "EntityLimits", EntityLimits);
Index: binaries/data/mods/public/simulation/components/TechnologyManager.js
===================================================================
--- binaries/data/mods/public/simulation/components/TechnologyManager.js	(révision 15890)
+++ binaries/data/mods/public/simulation/components/TechnologyManager.js	(copie de travail)
@@ -346,6 +346,11 @@
 	var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
 	var ents = cmpRangeManager.GetEntitiesByPlayer(playerID);
 
+	// Change the EntityLimit if any
+	var cmpPlayerEntityLimits = QueryPlayerIDInterface(playerID, IID_EntityLimits);
+	if (cmpPlayerEntityLimits)
+		cmpPlayerEntityLimits.RemoveLimits(tech);
+
 	// Call the related trigger event 
 	var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
 	cmpTrigger.CallEvent("ResearchFinished", {"player": playerID, "tech": tech});
Index: binaries/data/mods/public/simulation/templates/special/player.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/special/player.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/special/player.xml	(copie de travail)
@@ -15,6 +15,8 @@
   </BattleDetection>
   <EntityLimits>
     <Limits>
+      <CivilCentre>1</CivilCentre>
+      <Colony>0</Colony>
       <DefenseTower>30</DefenseTower>
       <Fortress>10</Fortress>
       <Wonder>1</Wonder>
@@ -41,6 +43,10 @@
         <PtolemyIV>4</PtolemyIV>
       </Juggernaut>
     </LimitChangers>
+    <LimitRemovers>
+      <CivilCentre>phase_town</CivilCentre>
+      <Colony>phase_town</Colony>
+    </LimitRemovers>
   </EntityLimits>
   <Player/>
   <StatisticsTracker/>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_military_colony.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_military_colony.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/structures/ptol_military_colony.xml	(copie de travail)
@@ -3,6 +3,7 @@
   <Attack disable=""/>
   <BuildRestrictions>
     <Territory>own neutral</Territory>
+    <Category>Colony</Category>
     <Distance>
       <FromClass>Colony</FromClass>
       <MinDistance>120</MinDistance>
@@ -27,7 +28,7 @@
   <Identity>
     <Civ>ptol</Civ>
     <GenericName>Military Colony</GenericName>
-	<SpecificName>Klēroukhia</SpecificName>
+    <SpecificName>Klēroukhia</SpecificName>
     <Classes datatype="tokens">Town Colony</Classes>
     <History>The Ptolemaic kings invited Greeks, Macedonians, Galatians (Gauls), Cretans, and Thracians alike to settle within Egypt in military colonies called cleruchies (klēroukhia). Under this arrangement, the settlers were given a plot of land, or a kleros, and in return were required to serve in the great king's army when called to duty. This created a upper-middle class of military settlers who owed their livelihoods and fortunes to the Ptolemaic kings and helped grow the available manpower for the imperial Ptolemaic army. A side effect of this system was that it drained the Greek homeland of military-aged men, a contributing factor to Greece's eventual conquest by Rome.</History>
     <Tooltip>This is the Ptolemaic expansion building, similar to Civic Centers for other factions. It is weaker and carries a smaller territory influence, but is cheaper and built faster.
@@ -42,7 +43,7 @@
   <ProductionQueue>
     <Entities datatype="tokens">
       units/ptol_infantry_spearman_2_b
-	  units/ptol_infantry_swordsman_b
+      units/ptol_infantry_swordsman_b
       units/ptol_cavalry_spearman_b
       units/ptol_cavalry_javelinist_b
     </Entities>
Index: binaries/data/mods/public/simulation/templates/structures/sele_military_colony.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_military_colony.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/structures/sele_military_colony.xml	(copie de travail)
@@ -3,6 +3,7 @@
   <Attack disable=""/>
   <BuildRestrictions>
     <Territory>own neutral</Territory>
+    <Category>Colony</Category>
     <Distance>
       <FromClass>Colony</FromClass>
       <MinDistance>120</MinDistance>
@@ -27,7 +28,7 @@
   <Identity>
     <Civ>sele</Civ>
     <GenericName>Military Colony</GenericName>
-	<SpecificName>Klēroukhia</SpecificName>
+    <SpecificName>Klēroukhia</SpecificName>
     <Classes datatype="tokens">Town Colony</Classes>
     <History>The Seleucid kings invited Greeks, Macedonians, Galatians (Gauls), Cretans, and Thracians alike to settle in within the vast territories of the empire. They settled in military colonies called cleruchies (klēroukhia). Under this arrangement, the settlers were given a plot of land, or a kleros, and in return were required to serve in the great king's army when called to duty. This created a upper-middle class of military settlers who owed their livelihoods and fortunes to the Syrian kings and helped grow the available manpower for the imperial Seleucid army. A side effect of this system was that it drained the Greek homeland of military-aged men, a contributing factor to Greece's eventual conquest by Rome.</History>
     <Tooltip>This is the Seleucid expansion building, similar to Civic Centers for other factions. It is weaker and carries a smaller territory influence, but is cheaper and built faster.
@@ -34,7 +35,6 @@
 - Train settler-soldiers of various nationalities.
 - Min. distance from other Military Colonies: 120 meters.</Tooltip>
     <Icon>structures/military_settlement.png</Icon>
-    <RequiredTechnology>phase_town</RequiredTechnology>
   </Identity>
   <Obstruction>
     <Static width="23.0" depth="23.0"/>
@@ -41,8 +41,8 @@
   </Obstruction>
   <ProductionQueue>
     <Entities datatype="tokens">
-	  units/sele_infantry_swordsman_b
-	  units/sele_infantry_archer_b
+      units/sele_infantry_swordsman_b
+      units/sele_infantry_archer_b
       units/sele_cavalry_spearman_b
     </Entities>
     <Technologies datatype="tokens">
Index: binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml	(copie de travail)
@@ -70,7 +70,6 @@
     </Classes>
     <VisibleClasses datatype="tokens">CivilCentre</VisibleClasses>
     <Icon>structures/civic_centre.png</Icon>
-    <RequiredTechnology>phase_town</RequiredTechnology>
   </Identity>
   <Loot>
     <xp>200</xp>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_archer_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_archer_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_archer_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Cost>
     <BuildTime>7</BuildTime>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_javelinist_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_javelinist_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>ptol</Civ>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_slinger_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_slinger_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_slinger_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>ptol</Civ>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_2_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_2_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_2_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Cost>
     <Resources>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_spearman_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>ptol</Civ>
Index: binaries/data/mods/public/simulation/templates/units/ptol_infantry_swordsman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_infantry_swordsman_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_infantry_swordsman_b.xml	(copie de travail)
@@ -3,11 +3,24 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-      structures/ptol_military_colony
       structures/ptol_lighthouse
       structures/ptol_library
       structures/ptol_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/ptol_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Cost>
     <Resources>
Index: binaries/data/mods/public/simulation/templates/units/ptol_support_female_citizen.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/ptol_support_female_citizen.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/ptol_support_female_citizen.xml	(copie de travail)
@@ -4,6 +4,14 @@
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/ptol_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>ptol</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_infantry_archer_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_infantry_archer_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_infantry_archer_b.xml	(copie de travail)
@@ -3,10 +3,23 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-	  structures/sele_military_colony
       structures/sele_library
       structures/sele_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/sele_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_infantry_javelinist_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_infantry_javelinist_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_infantry_javelinist_b.xml	(copie de travail)
@@ -3,10 +3,23 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-	  structures/sele_military_colony
       structures/sele_library
       structures/sele_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/sele_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_2_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_2_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_2_b.xml	(copie de travail)
@@ -3,10 +3,23 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-	  structures/sele_military_colony
       structures/sele_library
       structures/sele_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/sele_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_infantry_spearman_b.xml	(copie de travail)
@@ -3,10 +3,23 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-	  structures/sele_military_colony
       structures/sele_library
       structures/sele_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/sele_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_infantry_swordsman_b.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_infantry_swordsman_b.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_infantry_swordsman_b.xml	(copie de travail)
@@ -3,10 +3,23 @@
   <Builder>
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
-	  structures/sele_military_colony
       structures/sele_library
       structures/sele_wonder
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+      <Colony>
+        <Template>structures/sele_military_colony</Template>
+        <Condition>Greater</Condition>
+        <Category>CivilCentre</Category>
+        <Number>0</Number>
+      </Colony>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
Index: binaries/data/mods/public/simulation/templates/units/sele_support_female_citizen.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/sele_support_female_citizen.xml	(révision 15890)
+++ binaries/data/mods/public/simulation/templates/units/sele_support_female_citizen.xml	(copie de travail)
@@ -4,6 +4,14 @@
     <Entities datatype="tokens">
       -structures/{civ}_civil_centre
     </Entities>
+    <ConditionalEntities>
+      <CivilCentre>
+        <Template>structures/sele_civil_centre</Template>
+        <Condition>Smaller</Condition>
+        <Category>CivilCentre</Category>
+        <Number>1</Number>
+      </CivilCentre>
+    </ConditionalEntities>
   </Builder>
   <Identity>
     <Civ>sele</Civ>
