Added City states (#681)

* Add Milan as 1st city state. Choose box for number of city states.

* City states don't get settlers.

* Added diplomancy relationship. Now increase by gift and decreases every turn.

* Friendly culture city states provides culture bonus.

* 0 city states by default.

* Disable many trade items for city states.

* Fix part 1.

* Fix diplomacy screen and pop-ups.

* City state doesn't build world wonders.

* City states destroy city when conquering.

* Fixed : Trying to move into border of uncountered civs caused crash.

* City states don't exchange tech or declare war on others.

* Fix a very strange problem : you could trade introduction of AI to itself.

* City states automatically get all invented techs.

* Pops defeat msg before AI founds any city.

* Fix conquest victory with city states.

* Fixed : AI city under seige change production every turn.
This commit is contained in:
Duan Tao
2019-05-01 00:33:32 +08:00
committed by Yair Morgenstern
parent 307aea1cc0
commit f2333b5839
16 changed files with 199 additions and 39 deletions

View File

@ -18,6 +18,7 @@ class GameParameters{
var numberOfHumanPlayers=1
var humanNations=ArrayList<String>().apply { add("Babylon") }
var numberOfEnemies=3
var numberOfCityStates=0
var mapType= MapType.Perlin
var noBarbarians=false
var mapFileName :String?=null
@ -31,12 +32,15 @@ class GameStarter{
gameInfo.tileMap = TileMap(newGameParameters)
gameInfo.tileMap.gameInfo = gameInfo // need to set this transient before placing units in the map
val startingLocations = getStartingLocations(
newGameParameters.numberOfEnemies+newGameParameters.numberOfHumanPlayers, gameInfo.tileMap)
newGameParameters.numberOfEnemies+newGameParameters.numberOfHumanPlayers+newGameParameters.numberOfCityStates,
gameInfo.tileMap)
val availableCivNames = Stack<String>()
availableCivNames.addAll(GameBasics.Nations.keys.shuffled())
availableCivNames.addAll(GameBasics.Nations.filter { !it.value.isCityState() }.keys.shuffled())
availableCivNames.removeAll(newGameParameters.humanNations)
availableCivNames.remove("Barbarians")
val availableCityStatesNames = Stack<String>()
availableCityStatesNames.addAll(GameBasics.Nations.filter { it.value.isCityState() }.keys.shuffled())
for(nation in newGameParameters.humanNations) {
val playerCiv = CivilizationInfo(nation)
@ -53,6 +57,10 @@ class GameStarter{
gameInfo.civilizations.add(civ)
}
for (cityStateName in availableCityStatesNames.take(newGameParameters.numberOfCityStates)) {
val civ = CivilizationInfo(cityStateName)
gameInfo.civilizations.add(civ)
}
gameInfo.setTransients() // needs to be before placeBarbarianUnit because it depends on the tilemap having its gameinfo set