Added "scenario editing" mode for creating prebuild scenarios
This commit is contained in:
parent
451234c3bb
commit
42c8a64943
10 changed files with 35 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<VictoryType> = arrayListOf(VictoryType.Cultural, VictoryType.Domination, VictoryType.Scientific) // By default, all victory types
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue