added "required nearby improved resource" limitation to some buildings

added circus, stone works and notre dame buildings
This commit is contained in:
Yair Morgenstern 2017-12-13 21:54:34 +02:00
parent 2d12f1fa80
commit 561b1b5fdc
3 changed files with 35 additions and 8 deletions

View File

@ -41,6 +41,17 @@
hurryCostModifier:25,
requiredTech:"Pottery"
},
{
name:"Stone Works",
description: "Stone and marble provide +1 production.",
happiness:1,
production:1
requiredNearbyImprovedResources:["Marble","Stone"]
resourceBonusStats:{production:1},
maintainance:1,
hurryCostModifier:25,
requiredTech:"Calendar"
},
{
name:"Library",
description: "Adds 1 science for each 2 population in the city.",
@ -49,6 +60,14 @@
unique:"SciencePer2Pop",
requiredTech:"Writing"
},
{
name:"Circus",
description: "",
requiredNearbyImprovedResources:["Ivory","Horses"]
happiness:2,
hurryCostModifier:25,
requiredTech:"Trapping"
},
{
name:"Great Library",
description: "Provides a free technology, and a library in the city it is built in",
@ -90,7 +109,7 @@
name:"Stable",
description: "Cattle, sheep and horses provide +1 production.",
maintainance:1,
resourceBoostingBuilding:true,
requiredNearbyImprovedResources:["Horses","Sheep","Cattle"]
resourceBonusStats:{production:1},
hurryCostModifier:25,
requiredTech:"Horseback Riding"
@ -128,19 +147,27 @@
percentStatBonus:{gold:25},
requiredTech:"Currency"
},
{
name:"Notre Dame",
description: "",
culture:1,
happiness:10,
isWonder:true,
requiredTech:"Theology"
},
{
name:"Chichen Itza",
description: "Length of golden ages increased +50%",
gold:5,
culture:1,
isWonder:true,
unique:"GoldenAgeLengthIncrease",
requiredTech:"Currency"
},
{
name:"Mint",
description: "",
maintainance:0,
resourceBoostingBuilding:true,
requiredNearbyImprovedResources:["Gold","Silver"],
resourceBonusStats:{gold:2},
hurryCostModifier:25,
requiredTech:"Currency"
@ -177,7 +204,7 @@
description: "Iron provides +1 production",
maintainance:1,
hurryCostModifier:25,
resourceBoostingBuilding:true,
requiredNearbyImprovedResources:["Iron"],
resourceBonusStats:{production:1},
requiredTech:"Metal Casting"
},

View File

@ -111,13 +111,13 @@ public class CityBuildings
{
CivilizationInfo civInfo = UnCivGame.Current.civInfo;
if(isBuilt(building.name)) return false;
if(building.resourceBoostingBuilding) {
if(building.requiredNearbyImprovedResources!=null) {
boolean containsResourceWithImprovement = getCity().getTilesInRange()
.any(new Predicate<TileInfo>() {
@Override
public boolean evaluate(TileInfo tile) {
return tile.resource != null
&& building.name.equals(tile.getTileResource().building)
&& building.requiredNearbyImprovedResources.contains(tile.resource)
&& tile.getTileResource().improvement.equals(tile.improvement);
}
});

View File

@ -17,10 +17,10 @@ public class Building extends NamedStats implements ICivilopedia {
public FullStats percentStatBonus = new FullStats();
public int hurryCostModifier; // Extra cost percentage when purchasing
public boolean isWonder = false;
public boolean resourceBoostingBuilding = false;
public String requiredBuilding;
public String requiredBuildingInAllCities;
public String requiredResource;
public String requiredResource; // A strategic resource that will be consumed by this building
public LinqCollection requiredNearbyImprovedResources; // City can only be built if one of these resources is nearby - it must be improved!
public String cannotBeBuiltWith;
// Uniques