diff --git a/Credits.md b/Credits.md index 76f65536..ad28aec8 100644 --- a/Credits.md +++ b/Credits.md @@ -446,8 +446,9 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc * [Resistance](https://thenounproject.com/term/revolution/1315305/) By HeadsOfBirds * [Viking Hat](https://thenounproject.com/search/?q=pillage&i=185405) By my name is mud for pillaging improvements * [Aim](https://thenounproject.com/search/?q=aim&i=2034920) By Kaviashri for ranged strength -* [Capitol](https://thenounproject.com/search/?q=capitol&i=160031) By Loren Klein, US for city states +* [Capitol](https://thenounproject.com/search/?q=capitol&i=160031) By Loren Klein for city states * [Aircraft](https://thenounproject.com/search/?q=aircraft&i=1629000) By Tom Fricker +* [radar scan](https://thenounproject.com/search/?q=range&i=1500234) By icon 54 # Sound credits diff --git a/android/Images/BuildingIcons/Opera House.png b/android/Images/BuildingIcons/Opera House.png index b107b9ff..d1448338 100644 Binary files a/android/Images/BuildingIcons/Opera House.png and b/android/Images/BuildingIcons/Opera House.png differ diff --git a/android/assets/game.png b/android/assets/game.png index 18e49e07..b7321cc4 100644 Binary files a/android/assets/game.png and b/android/assets/game.png differ diff --git a/android/assets/jsons/Units.json b/android/assets/jsons/Units.json index 3a130e26..c86211c6 100644 --- a/android/assets/jsons/Units.json +++ b/android/assets/jsons/Units.json @@ -838,7 +838,7 @@ hurryCostModifier:20, attackSound:"shot" }, - + /* { name:"Triplane", unitType:"AirFighter", diff --git a/core/src/com/unciv/GameStarter.kt b/core/src/com/unciv/GameStarter.kt index fb4fd939..4ee849f5 100644 --- a/core/src/com/unciv/GameStarter.kt +++ b/core/src/com/unciv/GameStarter.kt @@ -108,22 +108,42 @@ class GameStarter{ .toMutableList() val startingLocations = HashMap() - for(civ in civs){ - if(freeTiles.isEmpty()) break // we failed to get all the starting locations with this minimum distance - var preferredTiles = freeTiles.toList() - for(startBias in civ.getNation().startBias){ - if(startBias.startsWith("Avoid ")) { - val tileToAvoid = startBias.removePrefix("Avoid ") - preferredTiles = preferredTiles.filter { it.baseTerrain != tileToAvoid && it.terrainFeature != tileToAvoid} + + val tilesWithStartingLocations = tileMap.values + .filter { it.improvement!=null && it.improvement!!.startsWith("StartingLocation ") } + + val civsOrderedByAvailableLocations = civs.sortedBy {civ -> + when { + tilesWithStartingLocations.any { it.improvement=="StartingLocation "+civ.civName } -> 1 // harshest requirements + civ.getNation().startBias.isNotEmpty() -> 2 // less harsh + else -> 3 + } // no requirements + } + + for(civ in civsOrderedByAvailableLocations){ + var startingLocation:TileInfo + val presetStartingLocation = tilesWithStartingLocations.firstOrNull { it.improvement=="StartingLocation "+civ.civName } + if(presetStartingLocation!=null) startingLocation = presetStartingLocation + else { + if (freeTiles.isEmpty()) break // we failed to get all the starting locations with this minimum distance + var preferredTiles = freeTiles.toList() + + for (startBias in civ.getNation().startBias) { + if (startBias.startsWith("Avoid ")) { + val tileToAvoid = startBias.removePrefix("Avoid ") + preferredTiles = preferredTiles.filter { it.baseTerrain != tileToAvoid && it.terrainFeature != tileToAvoid } + } else if (startBias == Constants.coast) preferredTiles = preferredTiles.filter { it.neighbors.any { n -> n.baseTerrain == startBias } } + else preferredTiles = preferredTiles.filter { it.baseTerrain == startBias || it.terrainFeature == startBias } } - else if(startBias==Constants.coast) preferredTiles = preferredTiles.filter { it.neighbors.any { n -> n.baseTerrain==startBias } } - else preferredTiles = preferredTiles.filter { it.baseTerrain == startBias || it.terrainFeature==startBias } + + startingLocation = if (preferredTiles.isNotEmpty()) preferredTiles.random() else freeTiles.random() } - val randomLocation = if(preferredTiles.isNotEmpty()) preferredTiles.random() else freeTiles.random() - startingLocations.put(civ, randomLocation) - freeTiles.removeAll(tileMap.getTilesInDistance(randomLocation.position,minimumDistanceBetweenStartingLocations)) + startingLocations[civ] = startingLocation + freeTiles.removeAll(tileMap.getTilesInDistance(startingLocation.position,minimumDistanceBetweenStartingLocations)) } if(startingLocations.size < civs.size) continue // let's try again with less minimum distance! + + for(tile in tilesWithStartingLocations) tile.improvement=null // get rid of the starting location improvements return startingLocations } throw Exception("Didn't manage to get starting locations even with distance of 1?") diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 65affb3b..0c4f3898 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -129,6 +129,8 @@ class CivilizationInfo { fun isMajorCiv() = !isBarbarianCivilization() && !isCityState() fun victoryType(): VictoryType { + if(gameInfo.gameParameters.victoryTypes.size==1) + return gameInfo.gameParameters.victoryTypes.first() // That is the most relevant one val victoryType = getNation().preferredVictoryType if(gameInfo.gameParameters.victoryTypes.contains(victoryType)) return victoryType else return VictoryType.Neutral diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index 8638a17f..a545afb5 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -59,8 +59,10 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera } private fun setImprovements() { - val improvementsTable = Table() + editorPickTable.clear() + + val improvementsTable = Table() improvementsTable.add(getHex(Color.WHITE).apply { onClick { clearSelection() @@ -79,9 +81,20 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera } improvementsTable.add(improvementImage).row() } - - editorPickTable.clear() editorPickTable.add(ScrollPane(improvementsTable)).height(mapEditorScreen.stage.height*0.7f) + + val nationsTable = Table() + for(nation in GameBasics.Nations.values){ + val nationImage = getHex(Color.WHITE,ImageGetter.getNationIndicator(nation,40f)) + nationImage.onClick { + clearSelection() + selectedImprovement=TileImprovement().apply { name="StartingLocation "+nation.name } + setCurrentHex(getHex(Color.WHITE,ImageGetter.getNationIndicator(nation,40f))) + } + nationsTable.add(nationImage).row() + } + + editorPickTable.add(ScrollPane(nationsTable)).height(mapEditorScreen.stage.height*0.7f) } fun setTerrainsAndResources(){ diff --git a/core/src/com/unciv/ui/utils/ImageGetter.kt b/core/src/com/unciv/ui/utils/ImageGetter.kt index 3f03a68a..d9caa283 100644 --- a/core/src/com/unciv/ui/utils/ImageGetter.kt +++ b/core/src/com/unciv/ui/utils/ImageGetter.kt @@ -89,8 +89,13 @@ object ImageGetter { val productionCircleColor = Color.BROWN.cpy().lerp(Color.WHITE,0.5f)!! val goldCircleColor = Color.GOLD.cpy().lerp(Color.WHITE,0.5f)!! fun getImprovementIcon(improvementName:String, size:Float=20f):Actor{ - val iconGroup = getImage("ImprovementIcons/$improvementName").surroundWithCircle(size) + if(improvementName.startsWith("StartingLocation ")){ + val nationName = improvementName.removePrefix("StartingLocation ") + val nation = GameBasics.Nations[nationName]!! + return getNationIndicator(nation,size) + } + val iconGroup = getImage("ImprovementIcons/$improvementName").surroundWithCircle(size) val improvement = GameBasics.TileImprovements[improvementName]!! when { diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt index a6b723b6..003b4ee8 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt @@ -20,6 +20,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree for(tile in tileMapClone.values){ tile.militaryUnit=null tile.civilianUnit=null + tile.airUnits=ArrayList() } UnCivGame.Current.screen = MapEditorScreen(tileMapClone) remove()