Merge remote-tracking branch 'upstream/master'

update
This commit is contained in:
YueR 2019-09-29 14:40:59 +08:00
commit 4c17e63c73
13 changed files with 60 additions and 27 deletions

View file

@ -60,6 +60,12 @@ If not, you can help by spreading the word - vote for Unciv where you can, menti
If you REALLY want to donate for some reason, I have a Patreon page [here!](https://www.patreon.com/yairm210) If you REALLY want to donate for some reason, I have a Patreon page [here!](https://www.patreon.com/yairm210)
## How can I get started workin on this?
- Install Android Studio
- Fork the repo, and clone your fork
- Configure an Application run configuration with DesktopLauncher as the Main Class and \<repo_folder\>\android\assets\ as the Working directory
# [Adding a new Civ](docs/NewCivs.md) # [Adding a new Civ](docs/NewCivs.md)
# [Credits and 3rd parties](docs/Credits.md) # [Credits and 3rd parties](docs/Credits.md)

View file

@ -115,6 +115,7 @@
name:"Oasis", name:"Oasis",
type:"TerrainFeature", type:"TerrainFeature",
food:3, food:3,
gold:1,
movementCost:1, movementCost:1,
unbuildable:true, unbuildable:true,
defenceBonus: -0.1, defenceBonus: -0.1,

View file

@ -265,6 +265,7 @@
German:"Gott" German:"Gott"
} }
//Civilization select
"AI":{ "AI":{
Italian:"IA" Italian:"IA"
@ -341,6 +342,14 @@
Russian:"Скопировать ID игры" Russian:"Скопировать ID игры"
} }
"Set current user":{
Italian:"Imposta utente attuale"
}
"Player ID from clipboard":{
Italian:"Copia ID giocatore dagli appunti"
}
/// tutorials for multiplayer /// tutorials for multiplayer
"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.":{ "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.":{
Italian:"Per creare una partita multigiocatore, attiva la spunta su 'Multigiocatore' nella schermata Nuova Partita, e inserisci l'ID utente per del giocatore per ogni rispettivo giocatore umano" Italian:"Per creare una partita multigiocatore, attiva la spunta su 'Multigiocatore' nella schermata Nuova Partita, e inserisci l'ID utente per del giocatore per ogni rispettivo giocatore umano"

View file

@ -286,6 +286,21 @@
] ]
] ]
ConqueredEnemyCity: [
[
"You have conquered an enemy city!",
"You can now choose to either or raze, puppet, or annex the city.",
"Razing the city will lower its population by 1 each turn until the city is destroyed."
],
[
"Puppeting the city will mean that you have no control on the city's production.",
"The city will not increase your tech or policy cost, but its citizens will generate 1.5x the regular unhappiness.",
"Annexing the city will give you control over the production, but will increase the citizen's unhappiness to 2x!",
"This can be mitigated by building a courthouse in the city, returning the citizen's unhappiness to normal.",
"A puppeted city can be annexed at any time, but annexed vities cannot be returned to a puppeted state!"
]
]
BarbarianEncountered: [ BarbarianEncountered: [
[ [
"You have encountered a barbarian unit!", "You have encountered a barbarian unit!",

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app" applicationId "com.unciv.app"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 29 targetSdkVersion 29
versionCode 301 versionCode 303
versionName "3.1.0-patch1" versionName "3.1.1"
} }
// Had to add this crap for Travis to build, it wanted to sign the app // Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -45,7 +45,9 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
} }
fun chooseNextConstruction() { fun chooseNextConstruction() {
if (!UnCivGame.Current.settings.autoAssignCityProduction && civInfo.playerType== PlayerType.Human) return if (!UnCivGame.Current.settings.autoAssignCityProduction
&& civInfo.playerType== PlayerType.Human && !cityInfo.isPuppet)
return
if (cityConstructions.getCurrentConstruction() !is SpecialConstruction) return // don't want to be stuck on these forever if (cityConstructions.getCurrentConstruction() !is SpecialConstruction) return // don't want to be stuck on these forever
addFoodBuildingChoice() addFoodBuildingChoice()

View file

@ -231,7 +231,8 @@ class UnitAutomation{
} }
fun getBombardTargets(city: CityInfo): List<TileInfo> { fun getBombardTargets(city: CityInfo): List<TileInfo> {
return city.getCenterTile().getViewableTiles(city.range).filter { containsAttackableEnemy(it, CityCombatant(city)) } return city.getCenterTile().getViewableTiles(city.range,true)
.filter { containsAttackableEnemy(it, CityCombatant(city)) }
} }
private fun tryAdvanceTowardsCloseEnemy(unit: MapUnit): Boolean { private fun tryAdvanceTowardsCloseEnemy(unit: MapUnit): Boolean {

View file

@ -83,7 +83,8 @@ class BattleDamage{
modifiers["Great General"] = greatGeneralModifier modifiers["Great General"] = greatGeneralModifier
} }
if(combatant.getCivInfo().nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength") if(combatant.getCivInfo().nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength"
&& combatant.getCivInfo().goldenAges.isGoldenAge())
modifiers["Golden Age"] = 0.1f modifiers["Golden Age"] = 0.1f
} }

View file

@ -77,7 +77,7 @@ class CityExpansionManager {
relinquishOwnership(tile) relinquishOwnership(tile)
cityInfo.getCenterTile().getTilesInDistance(1) cityInfo.getCenterTile().getTilesInDistance(1)
.filter { it.getCity()==null || it.getCity()!!.civInfo==cityInfo.civInfo } // can't take ownership of owned tiles .filter { it.getCity()==null } // can't take ownership of owned tiles
.forEach { takeOwnership(it) } .forEach { takeOwnership(it) }
} }

View file

@ -18,8 +18,8 @@ class MapEditorScreen(): CameraStageBaseScreen(){
var tileMap = TileMap(GameParameters()) var tileMap = TileMap(GameParameters())
var mapName = "My first map" var mapName = "My first map"
lateinit var mapHolder: TileGroupMap<TileGroup> lateinit var mapHolder: TileGroupMap<TileGroup>
val tileEditorOptions = TileEditorOptionsTable(this) private val tileEditorOptions = TileEditorOptionsTable(this)
val showHideEditorOptionsButton = TextButton(">",skin) private val showHideEditorOptionsButton = TextButton(">",skin)
constructor(mapNameToLoad:String?):this(){ constructor(mapNameToLoad:String?):this(){
var mapToLoad = mapNameToLoad var mapToLoad = mapNameToLoad

View file

@ -3,7 +3,6 @@ package com.unciv.ui.mapeditor
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Group import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.ui.TextButton
@ -15,12 +14,10 @@ import com.unciv.models.gamebasics.tile.Terrain
import com.unciv.models.gamebasics.tile.TerrainType import com.unciv.models.gamebasics.tile.TerrainType
import com.unciv.models.gamebasics.tile.TileImprovement import com.unciv.models.gamebasics.tile.TileImprovement
import com.unciv.models.gamebasics.tile.TileResource import com.unciv.models.gamebasics.tile.TileResource
import com.unciv.models.gamebasics.tr
import com.unciv.ui.tilegroups.TileGroup import com.unciv.ui.tilegroups.TileGroup
import com.unciv.ui.tilegroups.TileSetStrings import com.unciv.ui.tilegroups.TileSetStrings
import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.*
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.center
import com.unciv.ui.utils.onClick
class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){
val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/" val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/"
@ -45,11 +42,11 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
setTerrainsAndResources() setTerrainsAndResources()
val tabPickerTable = Table().apply { defaults().pad(10f) } val tabPickerTable = Table().apply { defaults().pad(10f) }
val terrainsAndResourcesTabButton = TextButton("Terrains & Resources",skin) val terrainsAndResourcesTabButton = TextButton("Terrains & Resources".tr(),skin)
.onClick { setTerrainsAndResources() } .onClick { setTerrainsAndResources() }
tabPickerTable.add(terrainsAndResourcesTabButton) tabPickerTable.add(terrainsAndResourcesTabButton)
val civLocationsButton = TextButton("Improvements",skin) val civLocationsButton = TextButton("Improvements".tr(),skin)
.onClick { setImprovements() } .onClick { setImprovements() }
tabPickerTable.add(civLocationsButton) tabPickerTable.add(civLocationsButton)
tabPickerTable.pack() tabPickerTable.pack()
@ -78,7 +75,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
clearSelection() clearSelection()
selectedImprovement=improvement selectedImprovement=improvement
val improvementIcon = getHex(Color.WHITE,ImageGetter.getImprovementIcon(improvement.name,40f)) val improvementIcon = getHex(Color.WHITE,ImageGetter.getImprovementIcon(improvement.name,40f))
setCurrentHex(improvementIcon, improvement.name+"\n"+improvement.clone().toString()) setCurrentHex(improvementIcon, improvement.name.tr()+"\n"+improvement.clone().toString())
} }
improvementsTable.add(improvementImage).row() improvementsTable.add(improvementImage).row()
} }
@ -128,7 +125,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
group.onClick { group.onClick {
clearSelection() clearSelection()
selectedTerrain = terrain selectedTerrain = terrain
setCurrentHex(tileInfo,terrain.name+"\n"+terrain.clone().toString()) setCurrentHex(tileInfo,terrain.name.tr()+"\n"+terrain.clone().toString())
} }
if (terrain.type == TerrainType.TerrainFeature) if (terrain.type == TerrainType.TerrainFeature)
@ -163,7 +160,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
tileInfo.resource = resource.name tileInfo.resource = resource.name
tileInfo.setTransients() tileInfo.setTransients()
setCurrentHex(tileInfo,resource.name+"\n"+resource.clone().toString()) setCurrentHex(tileInfo,resource.name.tr()+"\n"+resource.clone().toString())
} }
resources.add(resourceHex) resources.add(resourceHex)
} }
@ -258,7 +255,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
fun setCurrentHex(actor:Actor, text:String){ fun setCurrentHex(actor:Actor, text:String){
currentHex.remove() currentHex.remove()
val currentHexTable = Table() val currentHexTable = Table()
currentHexTable.add(Label(text,skin)).padRight(20f) currentHexTable.add(text.toLabel()).padRight(20f)
currentHexTable.add(actor).pad(10f) currentHexTable.add(actor).pad(10f)
currentHexTable.pack() currentHexTable.pack()
currentHex=currentHexTable currentHex=currentHexTable

View file

@ -88,7 +88,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
} }
playerIdTable.add(setCurrentUserButton) playerIdTable.add(setCurrentUserButton)
val copyFromClipboardButton = TextButton("Player ID from clipboard",CameraStageBaseScreen.skin) val copyFromClipboardButton = TextButton("Player ID from clipboard".tr(),CameraStageBaseScreen.skin)
copyFromClipboardButton.onClick { copyFromClipboardButton.onClick {
playerIdTextfield.text = Gdx.app.clipboard.contents playerIdTextfield.text = Gdx.app.clipboard.contents
onPlayerIdTextUpdated() onPlayerIdTextUpdated()

View file

@ -10,7 +10,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.unciv.Constants import com.unciv.Constants
import com.unciv.UnCivGame import com.unciv.UnCivGame
import com.unciv.logic.GameInfo
import com.unciv.logic.GameSaver import com.unciv.logic.GameSaver
import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
@ -155,7 +154,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
// and we don't get any silly concurrency problems! // and we don't get any silly concurrency problems!
private fun update() { private fun update() {
displayTutorialsOnUpdate(viewingCiv, gameInfo) displayTutorialsOnUpdate()
bottomBar.update(tileMapHolder.selectedTile) // has to come before tilemapholder update because the tilemapholder actions depend on the selected unit! bottomBar.update(tileMapHolder.selectedTile) // has to come before tilemapholder update because the tilemapholder actions depend on the selected unit!
battleTable.update() battleTable.update()
@ -196,7 +195,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
updateNextTurnButton() updateNextTurnButton()
} }
private fun displayTutorialsOnUpdate(cloneCivilization: CivilizationInfo, gameClone: GameInfo) { private fun displayTutorialsOnUpdate() {
if (UnCivGame.Current.settings.hasCrashedRecently) { if (UnCivGame.Current.settings.hasCrashedRecently) {
displayTutorials("GameCrashed") displayTutorials("GameCrashed")
UnCivGame.Current.settings.tutorialsShown.remove("GameCrashed") UnCivGame.Current.settings.tutorialsShown.remove("GameCrashed")
@ -210,18 +209,20 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
if (!UnCivGame.Current.settings.tutorialsShown.contains("EnemyCityNeedsConqueringWithMeleeUnit")) { if (!UnCivGame.Current.settings.tutorialsShown.contains("EnemyCityNeedsConqueringWithMeleeUnit")) {
for (enemyCity in cloneCivilization.diplomacy.values.filter { it.diplomaticStatus == DiplomaticStatus.War } for (enemyCity in viewingCiv.diplomacy.values.filter { it.diplomaticStatus == DiplomaticStatus.War }
.map { it.otherCiv() }.flatMap { it.cities }) { .map { it.otherCiv() }.flatMap { it.cities }) {
if (enemyCity.health == 1 && enemyCity.getCenterTile().getTilesInDistance(2) if (enemyCity.health == 1 && enemyCity.getCenterTile().getTilesInDistance(2)
.any { it.getUnits().any { unit -> unit.civInfo == cloneCivilization } }) .any { it.getUnits().any { unit -> unit.civInfo == viewingCiv} })
displayTutorials("EnemyCityNeedsConqueringWithMeleeUnit") displayTutorials("EnemyCityNeedsConqueringWithMeleeUnit")
} }
} }
if(viewingCiv.cities.any { it.hasJustBeenConquered })
displayTutorials("ConqueredEnemyCity")
if (gameClone.getCurrentPlayerCivilization().getCivUnits().any { it.health < 100 }) if (gameInfo.getCurrentPlayerCivilization().getCivUnits().any { it.health < 100 })
displayTutorials("InjuredUnits") displayTutorials("InjuredUnits")
if (gameClone.getCurrentPlayerCivilization().getCivUnits().any { it.name == Constants.worker }) if (gameInfo.getCurrentPlayerCivilization().getCivUnits().any { it.name == Constants.worker })
displayTutorials("WorkerTrained") displayTutorials("WorkerTrained")
} }