From 51a0d7727a184c3d75ebb5e4472b97c6f53ebc80 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Dec 2019 20:22:34 +0200 Subject: [PATCH] Renamed gameInfo.gameBasics to ruleSet --- core/src/com/unciv/UncivGame.kt | 8 ++++---- core/src/com/unciv/logic/GameInfo.kt | 10 +++++----- core/src/com/unciv/logic/GameStarter.kt | 2 +- .../logic/automation/ConstructionAutomation.kt | 2 +- .../unciv/logic/automation/NextTurnAutomation.kt | 4 ++-- .../com/unciv/logic/automation/UnitAutomation.kt | 2 +- .../unciv/logic/automation/WorkerAutomation.kt | 4 ++-- core/src/com/unciv/logic/battle/CityCombatant.kt | 2 +- core/src/com/unciv/logic/city/CityInfo.kt | 2 +- .../civilization/CivInfoTransientUpdater.kt | 2 +- .../unciv/logic/civilization/CivilizationInfo.kt | 16 ++++++++-------- .../com/unciv/logic/civilization/Notification.kt | 2 +- .../unciv/logic/civilization/PolicyManager.kt | 4 ++-- .../com/unciv/logic/civilization/TechManager.kt | 2 +- .../civilization/diplomacy/DiplomacyManager.kt | 4 ++-- core/src/com/unciv/logic/map/MapUnit.kt | 4 ++-- core/src/com/unciv/logic/map/TileInfo.kt | 2 +- core/src/com/unciv/logic/map/TileMap.kt | 2 +- core/src/com/unciv/logic/map/UnitPromotions.kt | 2 +- .../logic/map/action/BuildLongRoadAction.kt | 2 +- .../src/com/unciv/logic/trade/TradeEvaluation.kt | 6 +++--- core/src/com/unciv/models/gamebasics/Building.kt | 10 +++++----- .../unciv/models/gamebasics/tech/Technology.kt | 4 ++-- .../com/unciv/models/gamebasics/unit/BaseUnit.kt | 2 +- core/src/com/unciv/ui/VictoryScreen.kt | 2 +- .../src/com/unciv/ui/cityscreen/CityInfoTable.kt | 2 +- .../unciv/ui/cityscreen/ConstructionsTable.kt | 2 +- .../unciv/ui/pickerscreens/PolicyPickerScreen.kt | 2 +- .../ui/pickerscreens/PromotionPickerScreen.kt | 2 +- .../src/com/unciv/ui/pickerscreens/TechButton.kt | 2 +- .../unciv/ui/pickerscreens/TechPickerScreen.kt | 12 ++++++------ core/src/com/unciv/ui/worldscreen/AlertPopup.kt | 6 +++--- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 2 +- .../unciv/ui/worldscreen/WorldScreenTopBar.kt | 4 ++-- .../optionstable/WorldScreenOptionsTable.kt | 6 ++++-- .../com/unciv/ui/worldscreen/unit/UnitActions.kt | 6 +++--- 36 files changed, 75 insertions(+), 73 deletions(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 68499eeef1..4cd6d20625 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -51,11 +51,11 @@ class UncivGame(val version: String) : Game() { settings.save() } if (GameSaver().getSave("Autosave").exists()) { -// try { + try { loadGame("Autosave") -// } catch (ex: Exception) { // silent fail if we can't read the autosave -// startNewGame() -// } + } catch (ex: Exception) { // silent fail if we can't read the autosave + startNewGame() + } } else setScreen(LanguagePickerScreen()) diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 945e2a810d..713b638a93 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -20,7 +20,7 @@ class GameInfo { /** This is used in multiplayer games, where I may have a saved game state on my phone * that is inconsistent with the saved game on the cloud */ @Transient var isUpToDate=false - @Transient var gameBasics = UncivGame.Current.ruleSet + @Transient var ruleSet = UncivGame.Current.ruleSet var civilizations = mutableListOf() var difficulty="Chieftain" // difficulty is game-wide, think what would happen if 2 human players could play on different difficulties? @@ -165,13 +165,13 @@ class GameInfo { fun placeBarbarianUnit(tileToPlace: TileInfo) { // if we don't make this into a separate list then the retain() will happen on the Tech keys, // which effectively removes those techs from the game and causes all sorts of problems - val allResearchedTechs = gameBasics.Technologies.keys.toMutableList() + val allResearchedTechs = ruleSet.Technologies.keys.toMutableList() for (civ in civilizations.filter { !it.isBarbarian() && !it.isDefeated() }) { allResearchedTechs.retainAll(civ.tech.techsResearched) } val barbarianCiv = getBarbarianCivilization() barbarianCiv.tech.techsResearched = allResearchedTechs.toHashSet() - val unitList = gameBasics.Units.values + val unitList = ruleSet.Units.values .filter { !it.unitType.isCivilian()} .filter { it.isBuildable(barbarianCiv) } @@ -203,7 +203,7 @@ class GameInfo { } } - tileMap.setTransients(gameBasics) + tileMap.setTransients(ruleSet) if(currentPlayer=="") currentPlayer=civilizations.first { it.isPlayerCivilization() }.civName currentPlayerCiv=getCivilization(currentPlayer) @@ -217,7 +217,7 @@ class GameInfo { getCurrentPlayerCivilization().playerType=PlayerType.Human if(getCurrentPlayerCivilization().difficulty!="Chieftain") difficulty= getCurrentPlayerCivilization().difficulty - difficultyObject = gameBasics.Difficulties[difficulty]!! + difficultyObject = ruleSet.Difficulties[difficulty]!! // We have to remove all deprecated buildings from all cities BEFORE we update a single one, or run setTransients on the civs, // because updating leads to getting the building uniques from the civ info, diff --git a/core/src/com/unciv/logic/GameStarter.kt b/core/src/com/unciv/logic/GameStarter.kt index b8c9ed3bda..14286173ae 100644 --- a/core/src/com/unciv/logic/GameStarter.kt +++ b/core/src/com/unciv/logic/GameStarter.kt @@ -99,7 +99,7 @@ class GameStarter{ // For later starting eras, or for civs like Polynesia with a different Warrior, we need different starting units fun getWarriorEquivalent(civ: CivilizationInfo): String { - val availableMilitaryUnits = gameInfo.gameBasics.Units.values.filter { + val availableMilitaryUnits = gameInfo.ruleSet.Units.values.filter { it.isBuildable(civ) && it.unitType.isLandUnit() && !it.unitType.isCivilian() diff --git a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt index 9efac79400..1110afe19d 100644 --- a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt +++ b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt @@ -257,7 +257,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ private fun addFoodBuildingChoice() { val foodBuilding = buildableNotWonders.filter { it.isStatRelated(Stat.Food) - || it.getBaseBuilding(civInfo.gameInfo.gameBasics).name == "Aqueduct" || it.getBaseBuilding(civInfo.gameInfo.gameBasics).name == "Medical Lab"} // only stat related in unique + || it.getBaseBuilding(civInfo.gameInfo.ruleSet).name == "Aqueduct" || it.getBaseBuilding(civInfo.gameInfo.ruleSet).name == "Medical Lab"} // only stat related in unique .minBy { it.cost } if (foodBuilding != null) { var modifier = 1f diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 1841314af2..307c267409 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -170,7 +170,7 @@ class NextTurnAutomation{ private fun chooseTechToResearch(civInfo: CivilizationInfo) { if (civInfo.tech.techsToResearch.isEmpty()) { - val researchableTechs = civInfo.gameInfo.gameBasics.Technologies.values + val researchableTechs = civInfo.gameInfo.ruleSet.Technologies.values .filter { !civInfo.tech.isResearched(it.name) && civInfo.tech.canBeResearched(it.name) } val techsGroups = researchableTechs.groupBy { it.cost } val costs = techsGroups.keys.sorted() @@ -198,7 +198,7 @@ class NextTurnAutomation{ private fun adoptPolicy(civInfo: CivilizationInfo) { while (civInfo.policies.canAdoptPolicy()) { - val adoptablePolicies = civInfo.gameInfo.gameBasics.PolicyBranches.values + val adoptablePolicies = civInfo.gameInfo.ruleSet.PolicyBranches.values .flatMap { it.policies.union(listOf(it)) } .filter { civInfo.policies.isAdoptable(it) } diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index f60ecc81fd..64948967b0 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -266,7 +266,7 @@ class UnitAutomation{ private fun tryUpgradeUnit(unit: MapUnit, unitActions: List): Boolean { if (unit.baseUnit().upgradesTo != null) { - val upgradedUnit = unit.civInfo.gameInfo.gameBasics.Units[unit.baseUnit().upgradesTo!!]!! + val upgradedUnit = unit.civInfo.gameInfo.ruleSet.Units[unit.baseUnit().upgradesTo!!]!! if (upgradedUnit.isBuildable(unit.civInfo)) { val upgradeAction = unitActions.firstOrNull { it.name.startsWith("Upgrade to") } if (upgradeAction != null && upgradeAction.canAct) { diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 08e0fe4f1f..9240583412 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -106,7 +106,7 @@ class WorkerAutomation(val unit: MapUnit) { } if(unit.currentMovement>0 && unit.currentTile==tileToConstructRoadOn && unit.currentTile.improvementInProgress!=targetRoad.name) { - val improvement = targetRoad.improvement(unit.civInfo.gameInfo.gameBasics)!! + val improvement = targetRoad.improvement(unit.civInfo.gameInfo.ruleSet)!! tileToConstructRoadOn.startWorkingOnImprovement(improvement, unit.civInfo) } return true @@ -199,7 +199,7 @@ class WorkerAutomation(val unit: MapUnit) { else -> throw Exception("No improvement found for "+tile.baseTerrain) } if (improvementString == null) return null - return unit.civInfo.gameInfo.gameBasics.TileImprovements[improvementString]!! + return unit.civInfo.gameInfo.ruleSet.TileImprovements[improvementString]!! } } \ No newline at end of file diff --git a/core/src/com/unciv/logic/battle/CityCombatant.kt b/core/src/com/unciv/logic/battle/CityCombatant.kt index e506eee007..47e339d457 100644 --- a/core/src/com/unciv/logic/battle/CityCombatant.kt +++ b/core/src/com/unciv/logic/battle/CityCombatant.kt @@ -41,7 +41,7 @@ class CityCombatant(val city: CityInfo) : ICombatant { if(cityTile.baseTerrain== Constants.hill) strength+=5 // as tech progresses so does city strength val techsPercentKnown: Float = city.civInfo.tech.techsResearched.count().toFloat() / - getCivInfo().gameInfo.gameBasics.Technologies.count() + getCivInfo().gameInfo.ruleSet.Technologies.count() strength += (techsPercentKnown * 5.5).pow(2.8).toFloat() // The way all of this adds up... diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index f36fbbaede..a1a2fe4db2 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -119,7 +119,7 @@ class CityInfo { fun getTiles(): List = tiles.map { tileMap[it] } fun getWorkableTiles() = getTiles().filter { it in tilesInRange } - fun getGameBasics() = civInfo.gameInfo.gameBasics + fun getGameBasics() = civInfo.gameInfo.ruleSet fun getCityResources(): ResourceSupplyList { val cityResources = ResourceSupplyList() diff --git a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt index 7c56adbbd7..f09ce4da14 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt @@ -163,7 +163,7 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){ for (dip in civInfo.diplomacy.values) newDetailedCivResources.add(dip.resourcesFromTrade()) for(resource in civInfo.getCivUnits().mapNotNull { it.baseUnit.requiredResource } - .map { civInfo.gameInfo.gameBasics.TileResources[it]!! }) + .map { civInfo.gameInfo.ruleSet.TileResources[it]!! }) newDetailedCivResources.add(resource,-1,"Units") civInfo.detailedCivResources = newDetailedCivResources } diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 4041d0470e..c207b126ce 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -107,13 +107,13 @@ class CivilizationInfo { //region pure functions fun getDifficulty():Difficulty { if (isPlayerCivilization()) return gameInfo.getDifficulty() - return gameInfo.gameBasics.Difficulties["Chieftain"]!! + return gameInfo.ruleSet.Difficulties["Chieftain"]!! } fun getTranslatedNation(): Nation { val language = UncivGame.Current.settings.language.replace(" ","_") if(!Gdx.files.internal("jsons/Nations/Nations_$language.json").exists()) return nation - val translatedNation = gameInfo.gameBasics.getFromJson(Array::class.java, "Nations/Nations_$language") + val translatedNation = gameInfo.ruleSet.getFromJson(Array::class.java, "Nations/Nations_$language") .firstOrNull { it.name==civName} if(translatedNation==null) // this language's trnslation doesn't contain this nation yet, return nation // default to english @@ -170,7 +170,7 @@ class CivilizationInfo { */ fun getCivResourcesByName():HashMap{ val hashMap = HashMap() - for(resource in gameInfo.gameBasics.TileResources.keys) hashMap[resource]=0 + for(resource in gameInfo.ruleSet.TileResources.keys) hashMap[resource]=0 for(entry in getCivResources()) hashMap[entry.resource.name] = entry.amount return hashMap @@ -228,19 +228,19 @@ class CivilizationInfo { fun getEquivalentBuilding(buildingName:String): Building { - val baseBuilding = gameInfo.gameBasics.Buildings[buildingName]!!.getBaseBuilding(gameInfo.gameBasics) + val baseBuilding = gameInfo.ruleSet.Buildings[buildingName]!!.getBaseBuilding(gameInfo.ruleSet) - for(building in gameInfo.gameBasics.Buildings.values) + for(building in gameInfo.ruleSet.Buildings.values) if(building.replaces==baseBuilding.name && building.uniqueTo==civName) return building return baseBuilding } fun getEquivalentUnit(baseUnitName:String):BaseUnit { - for (unit in gameInfo.gameBasics.Units.values) + for (unit in gameInfo.ruleSet.Units.values) if (unit.replaces == baseUnitName && unit.uniqueTo == civName) return unit - return gameInfo.gameBasics.Units[baseUnitName]!! + return gameInfo.ruleSet.Units[baseUnitName]!! } fun meetCivilization(otherCiv: CivilizationInfo) { @@ -295,7 +295,7 @@ class CivilizationInfo { * And if they civs on't yet know who they are then they don;t know if they're barbarians =\ * */ fun setNationTransient(){ - nation = gameInfo.gameBasics.Nations[civName]!! + nation = gameInfo.ruleSet.Nations[civName]!! } fun setTransients() { diff --git a/core/src/com/unciv/logic/civilization/Notification.kt b/core/src/com/unciv/logic/civilization/Notification.kt index 1c282bde2e..cc56d1552d 100644 --- a/core/src/com/unciv/logic/civilization/Notification.kt +++ b/core/src/com/unciv/logic/civilization/Notification.kt @@ -40,7 +40,7 @@ data class LocationAction(var locations: ArrayList = ArrayList()) : Not /** show tech screen */ class TechAction(val techName: String = "") : NotificationAction { override fun execute(worldScreen: WorldScreen) { - val tech = worldScreen.gameInfo.gameBasics.Technologies[techName] + val tech = worldScreen.gameInfo.ruleSet.Technologies[techName] worldScreen.game.setScreen(TechPickerScreen(worldScreen.viewingCiv, tech)) } } diff --git a/core/src/com/unciv/logic/civilization/PolicyManager.kt b/core/src/com/unciv/logic/civilization/PolicyManager.kt index 624a33739a..43a82f0d6e 100644 --- a/core/src/com/unciv/logic/civilization/PolicyManager.kt +++ b/core/src/com/unciv/logic/civilization/PolicyManager.kt @@ -53,7 +53,7 @@ class PolicyManager { if (freePolicies == 0 && storedCulture < getCultureNeededForNextPolicy()) return false - val hasAdoptablePolicies = civInfo.gameInfo.gameBasics.PolicyBranches.values + val hasAdoptablePolicies = civInfo.gameInfo.ruleSet.PolicyBranches.values .flatMap { it.policies.union(listOf(it)) } .any { civInfo.policies.isAdoptable(it) } return hasAdoptablePolicies @@ -100,7 +100,7 @@ class PolicyManager { VictoryType.Cultural -> "Great Artist" VictoryType.Scientific -> "Great Scientist" VictoryType.Domination,VictoryType.Neutral -> - civInfo.gameInfo.gameBasics.Units.keys.filter { it.startsWith("Great") }.random() + civInfo.gameInfo.ruleSet.Units.keys.filter { it.startsWith("Great") }.random() } civInfo.addGreatPerson(greatPerson) } diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index aa94789f58..94e7a4ac4c 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -43,7 +43,7 @@ class TechManager { return toReturn } - fun getGameBasics() = civInfo.gameInfo.gameBasics + fun getGameBasics() = civInfo.gameInfo.ruleSet fun costOfTech(techName: String): Int { var techCost = getGameBasics().Technologies[techName]!!.cost.toFloat() diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 288ccc1b6d..1f18c882c9 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -163,10 +163,10 @@ class DiplomacyManager() { for(trade in trades){ for(offer in trade.ourOffers) if(offer.type== TradeType.Strategic_Resource || offer.type== TradeType.Luxury_Resource) - counter.add(civInfo.gameInfo.gameBasics.TileResources[offer.name]!!,-offer.amount,"Trade") + counter.add(civInfo.gameInfo.ruleSet.TileResources[offer.name]!!,-offer.amount,"Trade") for(offer in trade.theirOffers) if(offer.type== TradeType.Strategic_Resource || offer.type== TradeType.Luxury_Resource) - counter.add(civInfo.gameInfo.gameBasics.TileResources[offer.name]!!,offer.amount,"Trade") + counter.add(civInfo.gameInfo.ruleSet.TileResources[offer.name]!!,offer.amount,"Trade") } return counter } diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 864df50aa9..dbe257c3b4 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -113,7 +113,7 @@ class MapUnit { val uniques = ArrayList() val baseUnit = baseUnit() uniques.addAll(baseUnit.uniques) - uniques.addAll(promotions.promotions.map { currentTile.tileMap.gameInfo.gameBasics.UnitPromotions[it]!!.effect }) + uniques.addAll(promotions.promotions.map { currentTile.tileMap.gameInfo.ruleSet.UnitPromotions[it]!!.effect }) tempUniques = uniques if("Ignores terrain cost" in uniques) ignoresTerrainCost=true @@ -454,7 +454,7 @@ class MapUnit { city.population.autoAssignPopulation() civInfo.addNotification("We have found survivors in the ruins - population added to ["+city.name+"]",tile.position, Color.GREEN) } - val researchableAncientEraTechs = tile.tileMap.gameInfo.gameBasics.Technologies.values + val researchableAncientEraTechs = tile.tileMap.gameInfo.ruleSet.Technologies.values .filter { !civInfo.tech.isResearched(it.name) && civInfo.tech.canBeResearched(it.name) diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 5c8d14e550..7da59194e0 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -159,7 +159,7 @@ open class TileInfo { val resource = getTileResource() stats.add(getTileResource()) // resource base if (resource.building != null && city != null && city.cityConstructions.isBuilt(resource.building!!)) { - val resourceBuilding = tileMap.gameInfo.gameBasics.Buildings[resource.building!!]!! + val resourceBuilding = tileMap.gameInfo.ruleSet.Buildings[resource.building!!]!! stats.add(resourceBuilding.resourceBonusStats!!) // resource-specific building (eg forge, stable) bonus } if(resource.resourceType==ResourceType.Strategic diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index 88bc388a3a..05bd0a958a 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -64,7 +64,7 @@ class TileMap { } fun placeUnitNearTile(position: Vector2, unitName: String, civInfo: CivilizationInfo): MapUnit? { - val unit = gameInfo.gameBasics.Units[unitName]!!.getMapUnit(gameInfo.gameBasics) + val unit = gameInfo.ruleSet.Units[unitName]!!.getMapUnit(gameInfo.ruleSet) fun isTileMovePotential(tileInfo:TileInfo): Boolean { if(unit.type.isWaterUnit()) return tileInfo.isWater || tileInfo.isCityCenter() diff --git a/core/src/com/unciv/logic/map/UnitPromotions.kt b/core/src/com/unciv/logic/map/UnitPromotions.kt index aa6164741e..b844f2a15e 100644 --- a/core/src/com/unciv/logic/map/UnitPromotions.kt +++ b/core/src/com/unciv/logic/map/UnitPromotions.kt @@ -36,7 +36,7 @@ class UnitPromotions{ } fun getAvailablePromotions(): List { - return unit.civInfo.gameInfo.gameBasics.UnitPromotions.values + return unit.civInfo.gameInfo.ruleSet.UnitPromotions.values .filter { unit.type.toString() in it.unitTypes && it.name !in promotions } .filter { it.prerequisites.isEmpty() || it.prerequisites.any { p->p in promotions } } } diff --git a/core/src/com/unciv/logic/map/action/BuildLongRoadAction.kt b/core/src/com/unciv/logic/map/action/BuildLongRoadAction.kt index 90eccea75c..092306e8b6 100644 --- a/core/src/com/unciv/logic/map/action/BuildLongRoadAction.kt +++ b/core/src/com/unciv/logic/map/action/BuildLongRoadAction.kt @@ -89,7 +89,7 @@ class BuildLongRoadAction( val tile = unit.currentTile if (unit.currentMovement > 0 && isRoadableTile(tile)) { val roadToBuild = unit.civInfo.tech.getBestRoadAvailable() - roadToBuild.improvement(unit.civInfo.gameInfo.gameBasics)?.let { improvement -> + roadToBuild.improvement(unit.civInfo.gameInfo.ruleSet)?.let { improvement -> if (tile.roadStatus < roadToBuild && tile.improvementInProgress != improvement.name) { tile.startWorkingOnImprovement(improvement, unit.civInfo) return true diff --git a/core/src/com/unciv/logic/trade/TradeEvaluation.kt b/core/src/com/unciv/logic/trade/TradeEvaluation.kt index 159f50d703..163c65c3d9 100644 --- a/core/src/com/unciv/logic/trade/TradeEvaluation.kt +++ b/core/src/com/unciv/logic/trade/TradeEvaluation.kt @@ -117,7 +117,7 @@ class TradeEvaluation{ } TradeType.Technology -> - return (sqrt(civInfo.gameInfo.gameBasics.Technologies[offer.name]!!.cost.toDouble()) + return (sqrt(civInfo.gameInfo.ruleSet.Technologies[offer.name]!!.cost.toDouble()) * civInfo.gameInfo.gameParameters.gameSpeed.getModifier()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { @@ -167,7 +167,7 @@ class TradeEvaluation{ TradeType.Strategic_Resource -> { if(!civInfo.isAtWar()) return 50*offer.amount - val canUseForUnits = civInfo.gameInfo.gameBasics.Units.values + val canUseForUnits = civInfo.gameInfo.ruleSet.Units.values .any { it.requiredResource==offer.name && it.isBuildable(civInfo) } if(!canUseForUnits) return 50*offer.amount @@ -188,7 +188,7 @@ class TradeEvaluation{ } return totalCost } - TradeType.Technology -> return sqrt(civInfo.gameInfo.gameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 + TradeType.Technology -> return sqrt(civInfo.gameInfo.ruleSet.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { val civToDeclareWarOn = civInfo.gameInfo.getCivilization(offer.name) diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index fd8db8c1b1..c65d5d4afd 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -123,7 +123,7 @@ class Building : NamedStats(), IConstruction{ val stats = this.clone() if(civInfo != null) { val adoptedPolicies = civInfo.policies.adoptedPolicies - val baseBuildingName = getBaseBuilding(civInfo.gameInfo.gameBasics).name + val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(baseBuildingName )) stats.happiness += 1 @@ -161,7 +161,7 @@ class Building : NamedStats(), IConstruction{ if(civInfo==null) return stats // initial stats val adoptedPolicies = civInfo.policies.adoptedPolicies - val baseBuildingName = getBaseBuilding(civInfo.gameInfo.gameBasics).name + val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name if (adoptedPolicies.contains("Theocracy") && baseBuildingName == "Temple") stats.gold = 10f @@ -250,7 +250,7 @@ class Building : NamedStats(), IConstruction{ val civInfo = construction.cityInfo.civInfo if (uniqueTo!=null && uniqueTo!=civInfo.civName) return "Unique to $uniqueTo" - if (civInfo.gameInfo.gameBasics.Buildings.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique building replaces this" + if (civInfo.gameInfo.ruleSet.Buildings.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique building replaces this" if (requiredTech != null && !civInfo.tech.isResearched(requiredTech!!)) return "$requiredTech not researched" // Regular wonders @@ -323,7 +323,7 @@ class Building : NamedStats(), IConstruction{ if (providesFreeBuilding != null && !construction.containsBuildingOrEquivalent(providesFreeBuilding!!)) { var buildingToAdd = providesFreeBuilding!! - for(building in civInfo.gameInfo.gameBasics.Buildings.values) + for(building in civInfo.gameInfo.ruleSet.Buildings.values) if(building.replaces == buildingToAdd && building.uniqueTo==civInfo.civName) buildingToAdd = building.name @@ -345,7 +345,7 @@ class Building : NamedStats(), IConstruction{ if ("Free Social Policy" in uniques) civInfo.policies.freePolicies++ if ("Free Great Person" in uniques) { if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++ - else civInfo.addGreatPerson(civInfo.gameInfo.gameBasics.Units.keys.filter { it.startsWith("Great") }.random()) + else civInfo.addGreatPerson(civInfo.gameInfo.ruleSet.Units.keys.filter { it.startsWith("Great") }.random()) } if ("+1 population in each city" in uniques) { for(city in civInfo.cities){ diff --git a/core/src/com/unciv/models/gamebasics/tech/Technology.kt b/core/src/com/unciv/models/gamebasics/tech/Technology.kt index f05769feb1..10384c1604 100644 --- a/core/src/com/unciv/models/gamebasics/tech/Technology.kt +++ b/core/src/com/unciv/models/gamebasics/tech/Technology.kt @@ -67,7 +67,7 @@ class Technology { } fun getEnabledBuildings(civInfo: CivilizationInfo): List { - var enabledBuildings = civInfo.gameInfo.gameBasics.Buildings.values.filter { + var enabledBuildings = civInfo.gameInfo.ruleSet.Buildings.values.filter { it.requiredTech == name && (it.uniqueTo == null || it.uniqueTo == civInfo.civName) } @@ -81,7 +81,7 @@ class Technology { } fun getEnabledUnits(civInfo:CivilizationInfo): List { - var enabledUnits = civInfo.gameInfo.gameBasics.Units.values.filter { + var enabledUnits = civInfo.gameInfo.ruleSet.Units.values.filter { it.requiredTech == name && (it.uniqueTo == null || it.uniqueTo == civInfo.civName) } diff --git a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt index 0be1fdd226..b0fb1960e9 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -131,7 +131,7 @@ class BaseUnit : INamed, IConstruction { if (requiredTech!=null && !civInfo.tech.isResearched(requiredTech!!)) return "$requiredTech not researched" if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return "Obsolete by $obsoleteTech" if (uniqueTo!=null && uniqueTo!=civInfo.civName) return "Unique to $uniqueTo" - if (civInfo.gameInfo.gameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique unit replaces this" + if (civInfo.gameInfo.ruleSet.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique unit replaces this" if (!UncivGame.Current.settings.nuclearWeaponEnabled && (name == "Manhattan Project" || uniques.contains("Requires Manhattan Project"))) return "Disabled by setting" if (uniques.contains("Requires Manhattan Project") && !civInfo.containsBuildingUnique("Enables nuclear weapon")) diff --git a/core/src/com/unciv/ui/VictoryScreen.kt b/core/src/com/unciv/ui/VictoryScreen.kt index f4019dd331..14d9880a81 100644 --- a/core/src/com/unciv/ui/VictoryScreen.kt +++ b/core/src/com/unciv/ui/VictoryScreen.kt @@ -133,7 +133,7 @@ class VictoryScreen : PickerScreen() { fun culturalVictoryColumn():Table{ val t=Table() t.defaults().pad(5f) - for(branch in playerCivInfo.gameInfo.gameBasics.PolicyBranches.values) { + for(branch in playerCivInfo.gameInfo.ruleSet.PolicyBranches.values) { val finisher = branch.policies.last().name t.add(getMilestone(finisher, playerCivInfo.policies.isAdopted(finisher))).row() } diff --git a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt index c4305b44c8..ee13ff8712 100644 --- a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt @@ -67,7 +67,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS wonderDetailsTable.clear() else{ val detailsString = building.getDescription(true, - cityScreen.city.civInfo, cityScreen.city.civInfo.gameInfo.gameBasics) + cityScreen.city.civInfo, cityScreen.city.civInfo.gameInfo.ruleSet) wonderDetailsTable.add(detailsString.toLabel().apply { setWrap(true)}) .width(cityScreen.stage.width/4 - 2*pad ).row() // when you set wrap, then you need to manually set the size of the label if(!building.isWonder && !building.isNationalWonder) { diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index 7aacf61a06..9016d4a9eb 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -198,7 +198,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre description = construction.getDescription(true) else if (construction is Building) description = construction.getDescription(true, city.civInfo, - city.civInfo.gameInfo.gameBasics) + city.civInfo.gameInfo.ruleSet) else if(construction is SpecialConstruction) description = construction.description.tr() else description="" // Should never happen diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index 8fef925ff2..a0bc6e4670 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -52,7 +52,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo topTable.row().pad(30f) - for (branch in viewingCiv.gameInfo.gameBasics.PolicyBranches.values) { + for (branch in viewingCiv.gameInfo.ruleSet.PolicyBranches.values) { if (branch.name == "Commerce") topTable.addSeparator() val branchGroup = Table() branchGroup.row().pad(20f) diff --git a/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt index c70d396cdd..ac3f3807fb 100644 --- a/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt @@ -42,7 +42,7 @@ class PromotionPickerScreen(val unit: MapUnit) : PickerScreen() { availablePromotionsGroup.space(10f) val unitType = unit.type - val promotionsForUnitType = unit.civInfo.gameInfo.gameBasics.UnitPromotions.values.filter { it.unitTypes.contains(unitType.toString()) } + val promotionsForUnitType = unit.civInfo.gameInfo.ruleSet.UnitPromotions.values.filter { it.unitTypes.contains(unitType.toString()) } val unitAvailablePromotions = unit.promotions.getAvailablePromotions() for (promotion in promotionsForUnitType) { diff --git a/core/src/com/unciv/ui/pickerscreens/TechButton.kt b/core/src/com/unciv/ui/pickerscreens/TechButton.kt index 008ec74816..f96c408e53 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechButton.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechButton.kt @@ -42,7 +42,7 @@ class TechButton(techName:String, val techManager: TechManager, isWorldScreen: B techEnabledIcons.defaults().pad(5f) val civName = techManager.civInfo.civName - val gameBasics = techManager.civInfo.gameInfo.gameBasics + val gameBasics = techManager.civInfo.gameInfo.ruleSet val tech = gameBasics.Technologies[techName]!! diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index c648a926bf..df0da768e5 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -24,7 +24,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec private var lines=ArrayList() // All these are to counter performance problems when updating buttons for all techs. - private var researchableTechs = civInfo.gameInfo.gameBasics.Technologies.keys + private var researchableTechs = civInfo.gameInfo.ruleSet.Technologies.keys .filter { civTech.canBeResearched(it) }.toHashSet() private val currentTechColor = colorFromRGB(7,46,43) @@ -33,7 +33,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec private val queuedTechColor = colorFromRGB(39,114,154) - private val turnsToTech = civInfo.gameInfo.gameBasics.Technologies.values.associateBy ({ it.name },{civTech.turnsToTech(it.name)}) + private val turnsToTech = civInfo.gameInfo.ruleSet.Technologies.values.associateBy ({ it.name },{civTech.turnsToTech(it.name)}) constructor(freeTechPick: Boolean, civInfo: CivilizationInfo) : this(civInfo) { isFreeTechPick = freeTechPick @@ -75,10 +75,10 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec } private fun createTechTable() { - val columns = civInfo.gameInfo.gameBasics.Technologies.values.map { it.column!!.columnNumber}.max()!! +1 + val columns = civInfo.gameInfo.ruleSet.Technologies.values.map { it.column!!.columnNumber}.max()!! +1 val techMatrix = Array>(columns) { arrayOfNulls(10) } // Divided into columns, then rows - for (technology in civInfo.gameInfo.gameBasics.Technologies.values) { + for (technology in civInfo.gameInfo.ruleSet.Technologies.values) { techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology } @@ -145,7 +145,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec for (line in lines) line.remove() lines.clear() - for (tech in civInfo.gameInfo.gameBasics.Technologies.values) { + for (tech in civInfo.gameInfo.ruleSet.Technologies.values) { val techButton = techNameToButton[tech.name]!! for (prerequisite in tech.prerequisites) { val prerequisiteButton = techNameToButton[prerequisite]!! @@ -176,7 +176,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec private fun selectTechnology(tech: Technology?, center: Boolean = false, switchfromWorldScreen: Boolean = true) { selectedTech = tech - descriptionLabel.setText(tech?.getDescription(civInfo.gameInfo.gameBasics)) + descriptionLabel.setText(tech?.getDescription(civInfo.gameInfo.ruleSet)) if (!switchfromWorldScreen) return diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index 91a20f0c81..e80ff05699 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -149,19 +149,19 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu add(getCloseButton("Very well.")) } AlertType.WonderBuilt -> { - val wonder = worldScreen.gameInfo.gameBasics.Buildings[popupAlert.value]!! + val wonder = worldScreen.gameInfo.ruleSet.Buildings[popupAlert.value]!! addGoodSizedLabel(wonder.name) addSeparator() val centerTable = Table() centerTable.add(wonder.quote.toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) centerTable.add(ImageGetter.getConstructionImage(wonder.name).surroundWithCircle(100f)).pad(20f) - centerTable.add(wonder.getShortDescription(worldScreen.gameInfo.gameBasics) + centerTable.add(wonder.getShortDescription(worldScreen.gameInfo.ruleSet) .toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) add(centerTable).row() add(getCloseButton("Close")) } AlertType.TechResearched -> { - val gameBasics = worldScreen.gameInfo.gameBasics + val gameBasics = worldScreen.gameInfo.ruleSet val tech = gameBasics.Technologies[popupAlert.value]!! addGoodSizedLabel(tech.name) addSeparator() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 487e46b8c1..7459b96ff8 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -254,7 +254,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { techButtonHolder.isVisible = viewingCiv.cities.isNotEmpty() techButtonHolder.clearChildren() - val researchableTechs = viewingCiv.gameInfo.gameBasics.Technologies.values.filter { !viewingCiv.tech.isResearched(it.name) && viewingCiv.tech.canBeResearched(it.name) } + val researchableTechs = viewingCiv.gameInfo.ruleSet.Technologies.values.filter { !viewingCiv.tech.isResearched(it.name) && viewingCiv.tech.canBeResearched(it.name) } if (viewingCiv.tech.currentTechnology() == null && researchableTechs.isEmpty()) viewingCiv.tech.techsToResearch.add(Constants.futureTech) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index e401fae798..f2fd9e4ea2 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -57,7 +57,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() { private fun getResourceTable(): Table { val resourceTable = Table() resourceTable.defaults().pad(5f) - val revealedStrategicResources = screen.gameInfo.gameBasics.TileResources.values + val revealedStrategicResources = screen.gameInfo.ruleSet.TileResources.values .filter { it.resourceType == ResourceType.Strategic } // && currentPlayerCivInfo.tech.isResearched(it.revealedBy!!) } for (resource in revealedStrategicResources) { val resourceImage = ImageGetter.getResourceImage(resource.name,20f) @@ -105,7 +105,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() { internal fun update(civInfo: CivilizationInfo) { - val revealedStrategicResources = civInfo.gameInfo.gameBasics.TileResources.values + val revealedStrategicResources = civInfo.gameInfo.ruleSet.TileResources.values .filter { it.resourceType == ResourceType.Strategic } val civResources = civInfo.getCivResources() for (resource in revealedStrategicResources) { diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index 30a92535c2..57de6c6cec 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -7,12 +7,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.utils.Array import com.unciv.UncivGame +import com.unciv.models.gamebasics.RuleSet import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.WorldScreen import kotlin.concurrent.thread -class Language(val language:String){ +class Language(val language:String, ruleSet: RuleSet){ val percentComplete:Int init{ val availableTranslations = UncivGame.Current.ruleSet.Translations.count { it.value.containsKey(language) } @@ -263,7 +264,8 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr innerTable.add("Language".toLabel()) val languageSelectBox = SelectBox(skin) val languageArray = Array() - UncivGame.Current.ruleSet.Translations.getLanguages().map { Language(it) } + val ruleSet = worldScreen.gameInfo.ruleSet + ruleSet.Translations.getLanguages().map { Language(it, ruleSet) } .sortedByDescending { it.percentComplete } .forEach { languageArray.add(it) } languageSelectBox.items = languageArray diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index 261753036d..0423d84523 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -142,7 +142,7 @@ class UnitActions { actionList += UnitAction("Construct improvement", unit.currentMovement > 0 && !tile.isCityCenter() - && unit.civInfo.gameInfo.gameBasics.TileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) }, + && unit.civInfo.gameInfo.ruleSet.TileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) }, currentAction = unit.currentTile.hasImprovementInProgress() ) { worldScreen.game.setScreen(ImprovementPickerScreen(tile) { unitTable.selectedUnit = null }) } @@ -161,7 +161,7 @@ class UnitActions { && tile.roadStatus==RoadStatus.None && tile.improvementInProgress != "Road" && tile.isLand - && unit.civInfo.tech.isResearched(RoadStatus.Road.improvement(unit.civInfo.gameInfo.gameBasics)!!.techRequired!!)) + && unit.civInfo.tech.isResearched(RoadStatus.Road.improvement(unit.civInfo.gameInfo.ruleSet)!!.techRequired!!)) actionList+=UnitAction("Construct road", unit.currentMovement >0){ tile.improvementInProgress="Road" tile.turnsToImprovement=4 @@ -172,7 +172,7 @@ class UnitActions { && tile.isWater // because fishing boats can enter cities, and if there's oil in the city... ;) && tile.improvement==null && tile.getTileResource().improvement == improvement - && unit.civInfo.tech.isResearched(unit.civInfo.gameInfo.gameBasics.TileImprovements[improvement]!!.techRequired!!) + && unit.civInfo.tech.isResearched(unit.civInfo.gameInfo.ruleSet.TileImprovements[improvement]!!.techRequired!!) ) actionList += UnitAction("Create [$improvement]", unit.currentMovement >0) { tile.improvement = improvement