mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -04:00
Resolved #2035 - Strategic resources are affected by map generation parameters
This commit is contained in:
parent
8a9bbf4154
commit
27b9c93d6f
@ -38,7 +38,7 @@ class UncivGame(
|
|||||||
* This exists so that when debugging we can see the entire map.
|
* This exists so that when debugging we can see the entire map.
|
||||||
* Remember to turn this to false before commit and upload!
|
* Remember to turn this to false before commit and upload!
|
||||||
*/
|
*/
|
||||||
var viewEntireMapForDebug = false
|
var viewEntireMapForDebug = true
|
||||||
/** For when you need to test something in an advanced game and don't have time to faff around */
|
/** For when you need to test something in an advanced game and don't have time to faff around */
|
||||||
val superchargedForDebug = false
|
val superchargedForDebug = false
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ import com.unciv.models.ruleset.Ruleset
|
|||||||
import com.unciv.models.ruleset.tile.ResourceType
|
import com.unciv.models.ruleset.tile.ResourceType
|
||||||
import com.unciv.models.ruleset.tile.Terrain
|
import com.unciv.models.ruleset.tile.Terrain
|
||||||
import com.unciv.models.ruleset.tile.TerrainType
|
import com.unciv.models.ruleset.tile.TerrainType
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
import kotlin.collections.HashMap
|
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
@ -493,10 +491,10 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||||||
val suitableTiles = mapToReturn.values
|
val suitableTiles = mapToReturn.values
|
||||||
.filter { it.resource == null && resource.terrainsCanBeFoundOn.contains(it.getLastTerrain().name) }
|
.filter { it.resource == null && resource.terrainsCanBeFoundOn.contains(it.getLastTerrain().name) }
|
||||||
|
|
||||||
val averageTilesPerResource = 15 * resourcesOfType.count()
|
val numberOfResources = mapToReturn.values.count { it.isLand && !it.getBaseTerrain().impassable } *
|
||||||
val numberOfResources = mapToReturn.values.count { it.isLand && !it.getBaseTerrain().impassable } / averageTilesPerResource
|
mapToReturn.mapParameters.resourceRichness
|
||||||
|
|
||||||
val locations = chooseSpreadOutLocations(numberOfResources, suitableTiles, distance)
|
val locations = chooseSpreadOutLocations(numberOfResources.toInt(), suitableTiles, distance)
|
||||||
|
|
||||||
for (location in locations) location.resource = resource.name
|
for (location in locations) location.resource = resource.name
|
||||||
}
|
}
|
||||||
@ -508,8 +506,9 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||||||
|
|
||||||
val suitableTiles = mapToReturn.values
|
val suitableTiles = mapToReturn.values
|
||||||
.filter { it.resource == null && resourcesOfType.any { r -> r.terrainsCanBeFoundOn.contains(it.getLastTerrain().name) } }
|
.filter { it.resource == null && resourcesOfType.any { r -> r.terrainsCanBeFoundOn.contains(it.getLastTerrain().name) } }
|
||||||
val numberOfResources = (mapToReturn.values.count { it.isLand && !it.getBaseTerrain().impassable } * mapToReturn.mapParameters.resourceRichness).toInt()
|
val numberOfResources = mapToReturn.values.count { it.isLand && !it.getBaseTerrain().impassable } *
|
||||||
val locations = chooseSpreadOutLocations(numberOfResources, suitableTiles, distance)
|
mapToReturn.mapParameters.resourceRichness
|
||||||
|
val locations = chooseSpreadOutLocations(numberOfResources.toInt(), suitableTiles, distance)
|
||||||
|
|
||||||
val resourceToNumber = Counter<String>()
|
val resourceToNumber = Counter<String>()
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class MapParametersTable(val mapParameters: MapParameters, val isEmptyMapAllowed
|
|||||||
advancedSettingsTable.add(tempExtremeSlider).fillX().row()
|
advancedSettingsTable.add(tempExtremeSlider).fillX().row()
|
||||||
|
|
||||||
|
|
||||||
val resourceRichnessSlider = Slider(0f,1f,0.01f, false, skin).apply {
|
val resourceRichnessSlider = Slider(0f,0.2f,0.01f, false, skin).apply {
|
||||||
addListener(object : ChangeListener() {
|
addListener(object : ChangeListener() {
|
||||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
mapParameters.resourceRichness = this@apply.value
|
mapParameters.resourceRichness = this@apply.value
|
||||||
|
@ -347,10 +347,10 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
relationshipTable.add("Our relationship: ".toLabel())
|
relationshipTable.add("Our relationship: ".toLabel())
|
||||||
val relationshipLevel = otherCivDiplomacyManager.relationshipLevel()
|
val relationshipLevel = otherCivDiplomacyManager.relationshipLevel()
|
||||||
val relationshipText = relationshipLevel.name.tr() + " ($opinionOfUs)"
|
val relationshipText = relationshipLevel.name.tr() + " ($opinionOfUs)"
|
||||||
val relationshipColor = when {
|
val relationshipColor = when (relationshipLevel) {
|
||||||
relationshipLevel == RelationshipLevel.Neutral -> Color.WHITE
|
RelationshipLevel.Neutral -> Color.WHITE
|
||||||
relationshipLevel == RelationshipLevel.Favorable || relationshipLevel == RelationshipLevel.Friend
|
RelationshipLevel.Favorable, RelationshipLevel.Friend,
|
||||||
|| relationshipLevel == RelationshipLevel.Ally -> Color.GREEN
|
RelationshipLevel.Ally -> Color.GREEN
|
||||||
else -> Color.RED
|
else -> Color.RED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user