Technology description no longer includes Manhatten Prokect or Nuclear Missile in description when nuclear weapons are disabled

This commit is contained in:
Yair Morgenstern 2019-11-19 19:34:48 +02:00
parent 1eb5ced75c
commit 15e59b161b
5 changed files with 43 additions and 20 deletions

View File

@ -440,7 +440,7 @@ BuildingIcons/Paper Maker
index: -1 index: -1
BuildingIcons/Pentagon BuildingIcons/Pentagon
rotate: false rotate: false
xy: 614, 344 xy: 512, 344
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -797,21 +797,21 @@ ImprovementIcons/Quarry
index: -1 index: -1
ImprovementIcons/Railroad ImprovementIcons/Railroad
rotate: false rotate: false
xy: 614, 242 xy: 512, 242
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
TileSets/Default/Railroad TileSets/Default/Railroad
rotate: false rotate: false
xy: 614, 242 xy: 512, 242
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
TileSets/FantasyHex/Railroad TileSets/FantasyHex/Railroad
rotate: false rotate: false
xy: 614, 242 xy: 512, 242
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -1028,7 +1028,7 @@ OtherIcons/MenuIcon
index: -1 index: -1
OtherIcons/Pentagon OtherIcons/Pentagon
rotate: false rotate: false
xy: 512, 344 xy: 614, 344
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -1742,7 +1742,7 @@ TechIcons/Radio
index: -1 index: -1
TechIcons/Railroad TechIcons/Railroad
rotate: false rotate: false
xy: 512, 242 xy: 614, 242
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 KiB

After

Width:  |  Height:  |  Size: 872 KiB

View File

@ -1,8 +1,11 @@
package com.unciv.models.gamebasics.tech package com.unciv.models.gamebasics.tech
import com.unciv.UnCivGame import com.unciv.UnCivGame
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tr import com.unciv.models.gamebasics.tr
import com.unciv.models.gamebasics.unit.BaseUnit
import java.util.* import java.util.*
class Technology { class Technology {
@ -30,30 +33,22 @@ class Technology {
} }
val viewingCiv = UnCivGame.Current.worldScreen.viewingCiv val viewingCiv = UnCivGame.Current.worldScreen.viewingCiv
var enabledUnits = GameBasics.Units.values.filter { val enabledUnits = getEnabledUnits(viewingCiv)
it.requiredTech == name &&
(it.uniqueTo == null || it.uniqueTo == viewingCiv.civName)
}
val replacedUnits = enabledUnits.mapNotNull { it.replaces }
enabledUnits = enabledUnits.filter { it.name !in replacedUnits }
if (enabledUnits.isNotEmpty()) { if (enabledUnits.isNotEmpty()) {
lineList += "{Units enabled}: " lineList += "{Units enabled}: "
for (unit in enabledUnits) for (unit in enabledUnits)
lineList += " * " + unit.name.tr() + " (" + unit.getShortDescription() + ")" lineList += " * " + unit.name.tr() + " (" + unit.getShortDescription() + ")"
} }
var enabledBuildings = GameBasics.Buildings.values.filter { var enabledBuildings = getEnabledBuildings(viewingCiv)
it.requiredTech == name &&
(it.uniqueTo == null || it.uniqueTo == viewingCiv.civName)
}
val replacedBuildings = enabledBuildings.mapNotNull { it.replaces }
enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings }
val regularBuildings = enabledBuildings.filter { !it.isWonder && !it.isNationalWonder } val regularBuildings = enabledBuildings.filter { !it.isWonder && !it.isNationalWonder }
if (regularBuildings.isNotEmpty()) { if (regularBuildings.isNotEmpty()) {
lineList += "{Buildings enabled}: " lineList += "{Buildings enabled}: "
for (building in regularBuildings) for (building in regularBuildings)
lineList += "* " + building.name.tr() + " (" + building.getShortDescription() + ")" lineList += "* " + building.name.tr() + " (" + building.getShortDescription() + ")"
} }
val wonders = enabledBuildings.filter { it.isWonder || it.isNationalWonder } val wonders = enabledBuildings.filter { it.isWonder || it.isNationalWonder }
if (wonders.isNotEmpty()) { if (wonders.isNotEmpty()) {
lineList += "{Wonders enabled}: " lineList += "{Wonders enabled}: "
@ -71,6 +66,35 @@ class Technology {
return lineList.joinToString("\n") { it.tr() } return lineList.joinToString("\n") { it.tr() }
} }
private fun getEnabledBuildings(civInfo: CivilizationInfo): List<Building> {
var enabledBuildings = GameBasics.Buildings.values.filter {
it.requiredTech == name &&
(it.uniqueTo == null || it.uniqueTo == civInfo.civName)
}
val replacedBuildings = enabledBuildings.mapNotNull { it.replaces }
enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings }
if (!civInfo.gameInfo.gameParameters.nuclearWeaponEnabled)
enabledBuildings=enabledBuildings.filterNot { it.name=="Manhattan Project" }
return enabledBuildings
}
fun getEnabledUnits(civInfo:CivilizationInfo): List<BaseUnit> {
var enabledUnits = GameBasics.Units.values.filter {
it.requiredTech == name &&
(it.uniqueTo == null || it.uniqueTo == civInfo.civName)
}
val replacedUnits = enabledUnits.mapNotNull { it.replaces }
enabledUnits = enabledUnits.filter { it.name !in replacedUnits }
if (!civInfo.gameInfo.gameParameters.nuclearWeaponEnabled)
enabledUnits=enabledUnits.filterNot { it.uniques.contains("Requires Manhattan Project") }
return enabledUnits
}
override fun toString(): String { override fun toString(): String {
return name return name
} }

View File

@ -59,6 +59,7 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
} }
private fun addNuclearWeaponCheckbox() { private fun addNuclearWeaponCheckbox() {
add("HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!".tr()).colspan(2).row()
val nuclearWeaponCheckbox = CheckBox("Enable nuclear weapon".tr(), CameraStageBaseScreen.skin) val nuclearWeaponCheckbox = CheckBox("Enable nuclear weapon".tr(), CameraStageBaseScreen.skin)
nuclearWeaponCheckbox.isChecked = newGameParameters.nuclearWeaponEnabled nuclearWeaponCheckbox.isChecked = newGameParameters.nuclearWeaponEnabled
nuclearWeaponCheckbox.addListener(object : ChangeListener() { nuclearWeaponCheckbox.addListener(object : ChangeListener() {
@ -82,7 +83,6 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
private fun addIsOnlineMultiplayerCheckbox() { private fun addIsOnlineMultiplayerCheckbox() {
add("HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!".tr()).colspan(2).row()
val isOnlineMultiplayerCheckbox = CheckBox("Online Multiplayer".tr(), CameraStageBaseScreen.skin) val isOnlineMultiplayerCheckbox = CheckBox("Online Multiplayer".tr(), CameraStageBaseScreen.skin)
isOnlineMultiplayerCheckbox.isChecked = newGameParameters.isOnlineMultiplayer isOnlineMultiplayerCheckbox.isChecked = newGameParameters.isOnlineMultiplayer
isOnlineMultiplayerCheckbox.addListener(object : ChangeListener() { isOnlineMultiplayerCheckbox.addListener(object : ChangeListener() {

View File

@ -93,7 +93,6 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree
close() close()
val multiplayerPopup = PopupTable(screen) val multiplayerPopup = PopupTable(screen)
multiplayerPopup.addGoodSizedLabel("HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!").row()
multiplayerPopup.addGoodSizedLabel("To create a multiplayer game, check the 'multiplayer' toggle in the New Game screen, and for each human player insert that player's user ID.").row() multiplayerPopup.addGoodSizedLabel("To create a multiplayer game, check the 'multiplayer' toggle in the New Game screen, and for each human player insert that player's user ID.").row()
multiplayerPopup.addGoodSizedLabel("You can assign your own user ID there easily, and other players can copy their user IDs here and send them to you for you to include them in the game.").row() multiplayerPopup.addGoodSizedLabel("You can assign your own user ID there easily, and other players can copy their user IDs here and send them to you for you to include them in the game.").row()