Nuclear Weapon setting moved to Options, s it can be more easily explored by players

This commit is contained in:
Yair Morgenstern 2019-11-19 22:00:16 +02:00
parent dd28711ee7
commit b1868accc5
12 changed files with 160 additions and 153 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 275 KiB

View File

@ -74,7 +74,7 @@ class Technology {
val replacedBuildings = enabledBuildings.mapNotNull { it.replaces }
enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings }
if (!civInfo.gameInfo.gameParameters.nuclearWeaponEnabled)
if (!UnCivGame.Current.settings.nuclearWeaponEnabled)
enabledBuildings=enabledBuildings.filterNot { it.name=="Manhattan Project" }
return enabledBuildings
@ -88,7 +88,7 @@ class Technology {
val replacedUnits = enabledUnits.mapNotNull { it.replaces }
enabledUnits = enabledUnits.filter { it.name !in replacedUnits }
if (!civInfo.gameInfo.gameParameters.nuclearWeaponEnabled)
if (!UnCivGame.Current.settings.nuclearWeaponEnabled)
enabledUnits=enabledUnits.filterNot { it.uniques.contains("Requires Manhattan Project") }

View File

@ -1,6 +1,7 @@
package com.unciv.models.gamebasics.unit
import com.unciv.Constants
import com.unciv.UnCivGame
import com.unciv.logic.city.CityConstructions
import com.unciv.logic.city.IConstruction
import com.unciv.logic.civilization.CivilizationInfo
@ -131,7 +132,7 @@ class BaseUnit : INamed, IConstruction {
if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return "Obsolete by $obsoleteTech"
if (uniqueTo!=null && uniqueTo!=civInfo.civName) return "Unique to $uniqueTo"
if (GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique unit replaces this"
if (!civInfo.gameInfo.gameParameters.nuclearWeaponEnabled
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"))
return "Requires Manhattan Project"

View File

@ -17,7 +17,6 @@ class GameParameters { // Default values are the default new game
var mapType = MapType.pangaea
var noBarbarians = false
var oneCityChallenge = false
var nuclearWeaponEnabled = false
var noRuins = false;
var mapFileName: String? = null
var victoryTypes: ArrayList<VictoryType> = VictoryType.values().toCollection(ArrayList()) // By default, all victory types

View File

@ -21,6 +21,7 @@ class GameSettings {
var showMinimap: Boolean = true
var showPixelUnits: Boolean = false
var showPixelImprovements: Boolean = false
var nuclearWeaponEnabled = false
var userId = ""

View File

@ -28,9 +28,7 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
addVictoryTypeCheckboxes()
addBarbariansCheckbox()
addOneCityChallengeCheckbox()
addNuclearWeaponCheckbox()
addNoRuinsCheckbox()
addIsOnlineMultiplayerCheckbox()
pack()
@ -58,18 +56,6 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
add(oneCityChallengeCheckbox).colspan(2).row()
}
private fun addNuclearWeaponCheckbox() {
add("HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!".tr()).colspan(2).row()
val nuclearWeaponCheckbox = CheckBox("Enable nuclear weapon".tr(), CameraStageBaseScreen.skin)
nuclearWeaponCheckbox.isChecked = newGameParameters.nuclearWeaponEnabled
nuclearWeaponCheckbox.addListener(object : ChangeListener() {
override fun changed(event: ChangeEvent?, actor: Actor?) {
newGameParameters.nuclearWeaponEnabled = nuclearWeaponCheckbox.isChecked
}
})
add(nuclearWeaponCheckbox).colspan(2).row()
}
private fun addNoRuinsCheckbox() {
val noRuinsCheckbox = CheckBox("No ancient ruins".tr(), CameraStageBaseScreen.skin)
noRuinsCheckbox.isChecked = newGameParameters.noRuins

View File

@ -29,8 +29,8 @@ class TechButton(techName:String, val techManager: TechManager, isWorldScreen: B
add(ImageGetter.getProgressBarVertical(2f, 50f, percentComplete, Color.BLUE, Color.WHITE))
} else add().width(2f)
if (isWorldScreen) rightSide.add(text).row()
else rightSide.add(text).height(25f).row()
if (isWorldScreen) rightSide.add(text).padBottom(5f).row()
else rightSide.add(text).height(25f).padBottom(5f).row()
addTechEnabledIcons(techName, isWorldScreen, rightSide)

View File

@ -104,6 +104,12 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
update()
}
innerTable.add("Enable nuclear weapons".toLabel())
innerTable.addButton(if (settings.nuclearWeaponEnabled) "Yes".tr() else "No".tr()) {
settings.nuclearWeaponEnabled = !settings.nuclearWeaponEnabled
update()
}
addLanguageSelectBox(innerTable)
addResolutionSelectBox(innerTable)