diff --git a/android/Images.Construction/BuildingIcons/Recycling Center.png b/android/Images.Construction/BuildingIcons/Recycling Center.png new file mode 100644 index 0000000000..10e80c07d0 Binary files /dev/null and b/android/Images.Construction/BuildingIcons/Recycling Center.png differ diff --git a/android/assets/Construction.atlas b/android/assets/Construction.atlas index 15c3c03f4c..9e26e87998 100644 --- a/android/assets/Construction.atlas +++ b/android/assets/Construction.atlas @@ -599,415 +599,422 @@ BuildingIcons/Pyramid orig: 100, 100 offset: 0, 0 index: -1 -BuildingIcons/Research Lab +BuildingIcons/Recycling Center rotate: false xy: 1192, 1142 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 -BuildingIcons/SS Booster +BuildingIcons/Research Lab rotate: false - xy: 1516, 1466 + xy: 1300, 1250 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 -BuildingIcons/SS Cockpit +BuildingIcons/SS Booster rotate: false xy: 1624, 1574 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 -BuildingIcons/SS Engine +BuildingIcons/SS Cockpit rotate: false xy: 1732, 1683 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 -BuildingIcons/SS Stasis Chamber +BuildingIcons/SS Engine rotate: false xy: 1840, 1790 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 +BuildingIcons/SS Stasis Chamber + rotate: false + xy: 220, 62 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 BuildingIcons/Satrap's Court rotate: false - xy: 328, 170 + xy: 436, 278 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Seaport rotate: false - xy: 652, 494 + xy: 760, 602 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Shrine rotate: false - xy: 976, 818 + xy: 1084, 932 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Sistine Chapel rotate: false - xy: 1192, 1034 + xy: 1300, 1142 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Solar Plant rotate: false - xy: 1516, 1358 + xy: 1624, 1466 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Spaceship Factory rotate: false - xy: 1624, 1466 + xy: 1732, 1575 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stable rotate: false - xy: 1840, 1682 + xy: 328, 62 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stadium rotate: false - xy: 328, 62 + xy: 436, 170 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Statue of Liberty rotate: false - xy: 436, 170 + xy: 544, 278 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Statue of Zeus rotate: false - xy: 544, 278 + xy: 652, 386 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stele rotate: false - xy: 760, 494 + xy: 868, 602 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stock Exchange rotate: false - xy: 868, 602 + xy: 976, 710 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stone Works rotate: false - xy: 976, 710 + xy: 1084, 824 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Stonehenge rotate: false - xy: 1084, 824 + xy: 1192, 926 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Sydney Opera House rotate: false - xy: 1408, 1142 + xy: 1516, 1250 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Taj Mahal rotate: false - xy: 1516, 1250 + xy: 1624, 1358 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Temple rotate: false - xy: 1732, 1467 + xy: 1840, 1574 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Temple of Artemis rotate: false - xy: 1840, 1574 + xy: 436, 62 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Terracotta Army rotate: false - xy: 544, 170 + xy: 652, 278 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/The Great Library rotate: false - xy: 652, 278 + xy: 760, 386 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/The Great Lighthouse rotate: false - xy: 760, 386 + xy: 868, 494 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/The Louvre rotate: false - xy: 868, 494 + xy: 976, 602 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/The Oracle rotate: false - xy: 976, 602 + xy: 1084, 716 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/The Pyramids rotate: false - xy: 1084, 716 + xy: 1192, 818 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Theatre rotate: false - xy: 1192, 818 + xy: 1300, 926 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/United Nations rotate: false - xy: 1732, 1359 + xy: 1840, 1466 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/University rotate: false - xy: 1840, 1466 + xy: 544, 62 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Utopia Project rotate: false - xy: 544, 62 + xy: 652, 170 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Walls rotate: false - xy: 652, 170 + xy: 760, 278 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Walls of Babylon rotate: false - xy: 760, 278 + xy: 868, 386 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Wat rotate: false - xy: 1192, 710 + xy: 1300, 818 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Water Mill rotate: false - xy: 1300, 818 + xy: 1408, 926 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Windmill rotate: false - xy: 1408, 926 + xy: 1516, 1034 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 BuildingIcons/Workshop rotate: false - xy: 1732, 1251 + xy: 1840, 1358 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 MayaCalendar/0 rotate: false - xy: 1840, 1300 + xy: 62, 4 size: 25, 50 orig: 25, 50 offset: 0, 0 index: -1 MayaCalendar/1 rotate: false - xy: 916, 328 + xy: 1024, 436 size: 13, 50 orig: 13, 50 offset: 0, 0 index: -1 MayaCalendar/10 rotate: false - xy: 818, 220 + xy: 926, 328 size: 21, 50 orig: 21, 50 offset: 0, 0 index: -1 MayaCalendar/11 rotate: false - xy: 1300, 760 + xy: 1408, 868 size: 35, 50 orig: 35, 50 offset: 0, 0 index: -1 MayaCalendar/12 rotate: false - xy: 1408, 868 + xy: 1516, 976 size: 35, 50 orig: 35, 50 offset: 0, 0 index: -1 MayaCalendar/13 rotate: false - xy: 1516, 975 + xy: 1624, 1083 size: 35, 50 orig: 35, 50 offset: 0, 0 index: -1 MayaCalendar/14 rotate: false - xy: 1624, 1084 + xy: 1732, 1193 size: 35, 50 orig: 35, 50 offset: 0, 0 index: -1 MayaCalendar/15 rotate: false - xy: 1732, 1193 + xy: 1840, 1300 size: 30, 50 orig: 30, 50 offset: 0, 0 index: -1 MayaCalendar/16 rotate: false - xy: 868, 328 + xy: 976, 436 size: 40, 50 orig: 40, 50 offset: 0, 0 index: -1 MayaCalendar/17 rotate: false - xy: 976, 436 + xy: 1084, 550 size: 40, 50 orig: 40, 50 offset: 0, 0 index: -1 MayaCalendar/18 rotate: false - xy: 1084, 550 + xy: 1192, 652 size: 40, 50 orig: 40, 50 offset: 0, 0 index: -1 MayaCalendar/19 rotate: false - xy: 1192, 652 + xy: 1300, 760 size: 40, 50 orig: 40, 50 offset: 0, 0 index: -1 MayaCalendar/2 rotate: false - xy: 1024, 436 + xy: 1132, 550 size: 13, 50 orig: 13, 50 offset: 0, 0 index: -1 MayaCalendar/3 rotate: false - xy: 1132, 550 + xy: 1240, 652 size: 13, 50 orig: 13, 50 offset: 0, 0 index: -1 MayaCalendar/4 rotate: false - xy: 1240, 652 + xy: 1348, 760 size: 13, 50 orig: 13, 50 offset: 0, 0 index: -1 MayaCalendar/5 rotate: false - xy: 1343, 760 + xy: 1451, 868 size: 10, 50 orig: 10, 50 offset: 0, 0 index: -1 MayaCalendar/6 rotate: false - xy: 62, 4 + xy: 1948, 1890 size: 25, 50 orig: 25, 50 offset: 0, 0 index: -1 MayaCalendar/7 rotate: false - xy: 1948, 1890 + xy: 2006, 1948 size: 25, 50 orig: 25, 50 offset: 0, 0 index: -1 MayaCalendar/8 rotate: false - xy: 2006, 1948 + xy: 760, 162 size: 25, 50 orig: 25, 50 offset: 0, 0 index: -1 MayaCalendar/9 rotate: false - xy: 710, 112 + xy: 818, 220 size: 25, 50 orig: 25, 50 offset: 0, 0 @@ -1028,14 +1035,14 @@ MayaCalendar/Katun index: -1 MayaCalendar/Maya rotate: false - xy: 652, 112 + xy: 760, 220 size: 50, 50 orig: 50, 50 offset: 0, 0 index: -1 MayaCalendar/Tun rotate: false - xy: 760, 220 + xy: 868, 328 size: 50, 50 orig: 50, 50 offset: 0, 0 @@ -1714,182 +1721,182 @@ UnitIcons/Quinquereme index: -1 UnitIcons/Rifleman rotate: false - xy: 1300, 1250 + xy: 1408, 1358 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Rocket Artillery rotate: false - xy: 1408, 1358 + xy: 1516, 1466 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Samurai rotate: false - xy: 220, 62 + xy: 328, 170 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Scout rotate: false - xy: 436, 278 + xy: 544, 386 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Sea Beggar rotate: false - xy: 544, 386 + xy: 652, 494 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Settler rotate: false - xy: 760, 602 + xy: 868, 710 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Ship of the Line rotate: false - xy: 868, 710 + xy: 976, 818 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Sipahi rotate: false - xy: 1084, 932 + xy: 1192, 1034 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Skirmisher rotate: false - xy: 1300, 1142 + xy: 1408, 1250 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Slinger rotate: false - xy: 1408, 1250 + xy: 1516, 1358 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Spearman rotate: false - xy: 1732, 1575 + xy: 1840, 1682 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Stealth Bomber rotate: false - xy: 652, 386 + xy: 760, 494 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Submarine rotate: false - xy: 1192, 926 + xy: 1300, 1034 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Swordsman rotate: false - xy: 1300, 1034 + xy: 1408, 1142 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Tank rotate: false - xy: 1624, 1358 + xy: 1732, 1467 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Tercio rotate: false - xy: 436, 62 + xy: 544, 170 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Trebuchet rotate: false - xy: 1300, 926 + xy: 1408, 1034 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Triplane rotate: false - xy: 1408, 1034 + xy: 1516, 1142 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Trireme rotate: false - xy: 1516, 1141 + xy: 1624, 1249 size: 100, 101 orig: 100, 101 offset: 0, 0 index: -1 UnitIcons/Turtle Ship rotate: false - xy: 1624, 1250 + xy: 1732, 1359 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/War Chariot rotate: false - xy: 868, 386 + xy: 976, 494 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/War Elephant rotate: false - xy: 976, 494 + xy: 1084, 608 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Warrior rotate: false - xy: 1084, 608 + xy: 1192, 710 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Work Boats rotate: false - xy: 1516, 1033 + xy: 1624, 1141 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Worker rotate: false - xy: 1624, 1142 + xy: 1732, 1251 size: 100, 100 orig: 100, 100 offset: 0, 0 index: -1 UnitIcons/Zero rotate: false - xy: 1840, 1358 + xy: 652, 62 size: 100, 100 orig: 100, 100 offset: 0, 0 diff --git a/android/assets/Construction.png b/android/assets/Construction.png index 76ee65cb69..a145fec5a3 100644 Binary files a/android/assets/Construction.png and b/android/assets/Construction.png differ diff --git a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json index 535203b2bb..322eef2bb4 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json @@ -1049,6 +1049,12 @@ "requiredTech": "Ecology", "uniques": ["Must be next to [Desert]", "Cannot be built with [Nuclear Plant]"] }, + { + "name": "Recycling Center", + "maintenance": 3, + "requiredTech": "Ecology", + "uniques": ["Provides [2] [Aluminum]","Limited to [5] per Civilization"] + }, { "name": "Sydney Opera House", "isWonder": true, diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 0409e0fb69..e98f4646c6 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -332,7 +332,7 @@ class CityInfo { cityResources.add(resource, -amount, "Buildings") } } - + for (unique in getLocalMatchingUniques(UniqueType.ProvidesResources)) { // E.G "Provides [1] [Iron]" if (!unique.conditionalsApply(civInfo, this)) continue val resource = getRuleset().tileResources[unique.params[1]] diff --git a/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt b/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt index 98d10aad4b..6f9d626da1 100644 --- a/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt +++ b/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt @@ -10,6 +10,7 @@ import com.unciv.logic.civilization.diplomacy.DiplomaticStatus import com.unciv.logic.trade.TradeLogic import com.unciv.logic.trade.TradeOffer import com.unciv.logic.trade.TradeType +import com.unciv.models.ruleset.unique.UniqueType import com.unciv.ui.utils.withoutItem import java.util.* import kotlin.math.max @@ -259,7 +260,20 @@ class CityInfoConquestFunctions(val city: CityInfo){ // Remove their free buildings from this city and remove free buildings provided by the city from their cities removeBuildingsOnMoveToCiv(oldCiv) // Add our free buildings to this city and add free buildings provided by the city to other cities - civInfo.civConstructions.tryAddFreeBuildings() + civInfo.civConstructions.tryAddFreeBuildings() + // Check if we exceed MaxNumberBuildable for any buildings + for (building in cityConstructions.getBuiltBuildings()) { + for (unique in building.getMatchingUniques(UniqueType.MaxNumberBuildable)) { + if (civInfo.cities.count { + it.cityConstructions.containsBuildingOrEquivalent(building.name) || + it.cityConstructions.isBeingConstructedOrEnqueued(building.name) + } + >= unique.params[0].toInt()) { + // For now, just destroy in new city. Even if constructing in own cities + city.cityConstructions.removeBuilding(building.name) + } + } + } // Place palace for newCiv if this is the only city they have if (newCivInfo.cities.count() == 1) { diff --git a/core/src/com/unciv/logic/city/IConstruction.kt b/core/src/com/unciv/logic/city/IConstruction.kt index e48398d3e2..700f673967 100644 --- a/core/src/com/unciv/logic/city/IConstruction.kt +++ b/core/src/com/unciv/logic/city/IConstruction.kt @@ -120,7 +120,8 @@ class RejectionReasons: HashSet() { RejectionReason.RequiresBuildingInSomeCity, RejectionReason.PopulationRequirement, RejectionReason.ConsumesResources, - RejectionReason.CanOnlyBePurchased + RejectionReason.CanOnlyBePurchased, + RejectionReason.MaxNumberBuildable ) } } @@ -142,6 +143,7 @@ enum class RejectionReason(val shouldShow: Boolean, var errorMessage: String) { MustOwnTile(false, "Must own a specific tile close by"), WaterUnitsInCoastalCities(false, "May only built water units in coastal cities"), CanOnlyBeBuiltInSpecificCities(false, "Can only be built in specific cities"), + MaxNumberBuildable(true, "Maximum number being built"), UniqueToOtherNation(false, "Unique to another nation"), ReplacedByOurUnique(false, "Our unique replaces this"), diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 4d8d5f247a..48f4b517be 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -454,6 +454,11 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction { override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean { if (cityConstructions.isBeingConstructedOrEnqueued(name)) return false + for (unique in getMatchingUniques(UniqueType.MaxNumberBuildable)){ + if (cityConstructions.cityInfo.civInfo.cities.count{it.cityConstructions.containsBuildingOrEquivalent(name)}>=unique.params[0].toInt()) + return false + } + val rejectionReasons = getRejectionReasons(cityConstructions) return rejectionReasons.none { !it.shouldShow } || ( @@ -539,6 +544,15 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction { UniqueType.HiddenWithoutReligion.text -> if (!civInfo.gameInfo.isReligionEnabled()) rejectionReasons.add(RejectionReason.DisabledBySetting) + + UniqueType.MaxNumberBuildable.placeholderText -> + if (civInfo.cities.count { + it.cityConstructions.containsBuildingOrEquivalent(name) || + it.cityConstructions.isBeingConstructedOrEnqueued(name) + } + >= unique.params[0].toInt()) { + rejectionReasons.add(RejectionReason.MaxNumberBuildable) + } } } diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 14326152ea..fd5a49284f 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -202,7 +202,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: CannotBePurchased("Cannot be purchased", UniqueTarget.Building, UniqueTarget.Unit), CanBePurchasedWithStat("Can be purchased with [stat] [cityFilter]", UniqueTarget.Building, UniqueTarget.Unit), CanBePurchasedForAmountStat("Can be purchased for [amount] [stat] [cityFilter]", UniqueTarget.Building, UniqueTarget.Unit), - + MaxNumberBuildable("Limited to [amount] per Civilization", UniqueTarget.Building, UniqueTarget.Unit), ///////////////////////////////////////// BUILDING UNIQUES ///////////////////////////////////////// diff --git a/docs/Credits.md b/docs/Credits.md index 9631e70afa..60c6879825 100644 --- a/docs/Credits.md +++ b/docs/Credits.md @@ -325,6 +325,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https: * [Chemistry](https://thenounproject.com/term/chemistry/175847/) By Creative Stall for Medical Lab * [Pentagon](https://thenounproject.com/search/?q=the%20pentagon&i=1788323) By Maxim Kulikov * [Solar panel](https://thenounproject.com/term/solar-panel/1131/) By Modik for Solar Plant +* [Recycle](https://thenounproject.com/search/?q=recycling&i=4397434) By Umer Younas, PK for Recycling Center * [Opera House Sydney](https://thenounproject.com/term/opera-house-sydney/1626283/) By Pham Duy Phuong Hung for Sydney Opera House * [Water dam](https://thenounproject.com/term/water-dam/1002726/) By Symbolon for Hydro Plant * [Manhattan Project](https://thenounproject.com/search/?q=Nuclear%20Bomb&i=2041074) By corpus delicti, GR