diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index d617963102..de17e72173 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -339,7 +339,8 @@ class CityConstructions { if (!getConstruction(constructionName).postBuildEvent(this, true)) return false // nothing built - no pay - cityInfo.civInfo.gold -= getConstruction(constructionName).getGoldCost(cityInfo.civInfo) + if (!cityInfo.civInfo.gameInfo.gameParameters.godMode) + cityInfo.civInfo.gold -= getConstruction(constructionName).getGoldCost(cityInfo.civInfo) if (queuePosition in 0 until constructionQueue.size) removeFromQueue(queuePosition, automatic) diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index 3a6b29edd4..ae03390a78 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -45,7 +45,8 @@ class CityExpansionManager { val goldCost = getGoldCostOfTile(tileInfo) class NotEnoughGoldToBuyTileException : Exception() - if (cityInfo.civInfo.gold < goldCost) throw NotEnoughGoldToBuyTileException() + if (cityInfo.civInfo.gold < goldCost && !cityInfo.civInfo.gameInfo.gameParameters.godMode) + throw NotEnoughGoldToBuyTileException() cityInfo.civInfo.gold -= goldCost takeOwnership(tileInfo) } diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 7bfc4df2e6..514fc59ef2 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -252,8 +252,10 @@ class UnitMovementAlgorithms(val unit:MapUnit) { if (destination.isCityCenter() && destination.getOwner() != unit.civInfo && !destination.getCity()!!.hasJustBeenConquered) throw Exception("This is an enemy city, you can't go here!") - unit.currentMovement -= distanceToTiles[destination]!!.totalDistance - if (unit.currentMovement < 0.1) unit.currentMovement = 0f // silly floats which are "almost zero" + if (!unit.civInfo.gameInfo.gameParameters.godMode) { + unit.currentMovement -= distanceToTiles[destination]!!.totalDistance + if (unit.currentMovement < 0.1) unit.currentMovement = 0f // silly floats which are "almost zero" + } if (unit.isFortified() || unit.action == Constants.unitActionSetUp || unit.isSleeping()) unit.action = null // unfortify/setup after moving diff --git a/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt b/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt index 317180b404..1f8c3312bd 100644 --- a/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt +++ b/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt @@ -196,6 +196,13 @@ class NaturalWonderGenerator(val ruleset: Ruleset){ for (tile in location.neighbors) { if (tile.baseTerrain == Constants.coast) continue if (tile.baseTerrain == Constants.mountain) continue + for (neighbor in tile.neighbors) + // This is so we don't have this tile turn into Coast, and then it's touching a Lake tile. + // We just turn the lake tiles into this kind of tile. + if (neighbor.baseTerrain == Constants.lakes) { + neighbor.baseTerrain = tile.baseTerrain + neighbor.setTerrainTransients() + } tile.baseTerrain = Constants.coast tile.terrainFeature = null diff --git a/core/src/com/unciv/models/metadata/GameParameters.kt b/core/src/com/unciv/models/metadata/GameParameters.kt index 855616830f..c825db9425 100644 --- a/core/src/com/unciv/models/metadata/GameParameters.kt +++ b/core/src/com/unciv/models/metadata/GameParameters.kt @@ -19,6 +19,7 @@ class GameParameters { // Default values are the default new game var noBarbarians = false var oneCityChallenge = false + var godMode = false var nuclearWeaponsEnabled = true var victoryTypes: ArrayList = arrayListOf(VictoryType.Cultural, VictoryType.Domination, VictoryType.Scientific) // By default, all victory types diff --git a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt index 4da3f9de1e..7a5ddd8a31 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt @@ -43,7 +43,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){ city.expansion.buyTile(selectedTile) UncivGame.Current.setScreen(CityScreen(city)) } - if(goldCostOfTile>city.civInfo.gold + if((goldCostOfTile>city.civInfo.gold && !city.civInfo.gameInfo.gameParameters.godMode) || city.isPuppet || !cityScreen.canChangeState) buyTileButton.disable() diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index cdf4ae7144..743fd823b7 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -327,7 +327,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre val button = "".toTextButton() - if (construction == null || !construction.canBePurchased() + if (construction == null || (!construction.canBePurchased() && !city.civInfo.gameInfo.gameParameters.godMode) ) { // fully disable a "buy" button only for "priceless" buildings such as wonders // for all other cases, the price should be displayed @@ -347,11 +347,11 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre YesNoPopup(purchasePrompt, { purchaseConstruction(construction) }, cityScreen, { cityScreen.update() }).open() } - if ( !construction.isBuildable(cityConstructions) + if (!construction.isBuildable(cityConstructions) || !cityScreen.canChangeState || city.isPuppet || city.isInResistance() || !city.canPurchase(construction) - || constructionGoldCost > city.civInfo.gold ) + || (constructionGoldCost > city.civInfo.gold && !city.civInfo.gameInfo.gameParameters.godMode) ) button.disable() } diff --git a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt index ac05b41798..888275e6d7 100644 --- a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt @@ -4,6 +4,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.CheckBox import com.badlogic.gdx.scenes.scene2d.ui.SelectBox import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Array +import com.unciv.UncivGame import com.unciv.models.metadata.BaseRuleset import com.unciv.models.metadata.GameSpeed import com.unciv.models.ruleset.RulesetCache @@ -46,6 +47,8 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick checkboxTable.addBarbariansCheckbox() checkboxTable.addOneCityChallengeCheckbox() checkboxTable.addNuclearWeaponsCheckbox() + if(UncivGame.Current.settings.extendedMapEditor) + checkboxTable.addGodmodeCheckbox() checkboxTable.addIsOnlineMultiplayerCheckbox() checkboxTable.addModCheckboxes() add(checkboxTable).colspan(2).row() @@ -73,6 +76,10 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick addCheckbox("Enable nuclear weapons", gameParameters.nuclearWeaponsEnabled) { gameParameters.nuclearWeaponsEnabled = it } + private fun Table.addGodmodeCheckbox() = + addCheckbox("Scenario Editor", gameParameters.godMode) + { gameParameters.godMode = it } + private fun Table.addIsOnlineMultiplayerCheckbox() = addCheckbox("Online Multiplayer", gameParameters.isOnlineMultiplayer) diff --git a/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt index 58db331f3f..3c9ad7f949 100644 --- a/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt @@ -29,7 +29,8 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() { add("{Map Type}:".toLabel()) val mapTypes = arrayListOf("Generated") if (MapSaver.getMaps().isNotEmpty()) mapTypes.add(MapType.custom) - if (MapSaver.getScenarios().isNotEmpty() && UncivGame.Current.settings.extendedMapEditor) mapTypes.add(MapType.scenario) + if (MapSaver.getScenarios().isNotEmpty() && UncivGame.Current.settings.extendedMapEditor) + mapTypes.add(MapType.scenario) val mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", CameraStageBaseScreen.skin) val mapFileSelectBox = getMapFileSelectBox() diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index 6090a8fbd0..ed4ca420d7 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -184,6 +184,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec private fun selectTechnology(tech: Technology?, center: Boolean = false, switchfromWorldScreen: Boolean = true) { + val previousSelectedTech = selectedTech selectedTech = tech descriptionLabel.setText(tech?.getDescription(civInfo.gameInfo.ruleSet)) @@ -204,6 +205,11 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec return } + if (civInfo.gameInfo.gameParameters.godMode && !civInfo.tech.isResearched(tech.name) + && selectedTech == previousSelectedTech){ + civInfo.tech.addTechnology(tech.name) + } + if (civTech.isResearched(tech.name) && tech.name != Constants.futureTech) { rightSideButton.setText("Pick a tech".tr()) rightSideButton.disable()