From 49d3ea2c0e0b48e7215e01efa0c56932fc3ec828 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 27 Sep 2019 11:25:23 +0300 Subject: [PATCH 1/6] Resolved #1125 - cities can bombard over all tiles in a radius of 2 --- android/assets/jsons/Terrains.json | 1 + android/build.gradle | 2 +- core/src/com/unciv/logic/automation/UnitAutomation.kt | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/android/assets/jsons/Terrains.json b/android/assets/jsons/Terrains.json index 857d086b..bdb1f32f 100644 --- a/android/assets/jsons/Terrains.json +++ b/android/assets/jsons/Terrains.json @@ -115,6 +115,7 @@ name:"Oasis", type:"TerrainFeature", food:3, + gold:1, movementCost:1, unbuildable:true, defenceBonus: -0.1, diff --git a/android/build.gradle b/android/build.gradle index 31a2514f..e4b5dc3a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,7 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 301 + versionCode 302 versionName "3.1.0-patch1" } diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 281a509e..226b2c31 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -231,7 +231,8 @@ class UnitAutomation{ } fun getBombardTargets(city: CityInfo): List { - 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 { From ba3103277a73c88705f142b11524721811e9f9e3 Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Sat, 28 Sep 2019 11:39:28 +0800 Subject: [PATCH 2/6] Fix Persia civ battle bonus. --- core/src/com/unciv/logic/battle/BattleDamage.kt | 3 ++- core/src/com/unciv/logic/city/CityExpansionManager.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index df543a01..8484ddf6 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -81,7 +81,8 @@ class BattleDamage{ 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 } diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index b6ea29d0..dcfb8809 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -77,7 +77,7 @@ class CityExpansionManager { relinquishOwnership(tile) 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) } } From 58fd3b2c6cb64d7c7c105510a1de62c33f000e64 Mon Sep 17 00:00:00 2001 From: Smashfanful <41149920+Smashfanful@users.noreply.github.com> Date: Sat, 28 Sep 2019 15:57:25 +0200 Subject: [PATCH 3/6] Update NewGame,SaveGame,LoadGame,Options.json Added new lines --- .../Translations/NewGame,SaveGame,LoadGame,Options.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json index 6a316d4a..8a1058ff 100644 --- a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json +++ b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json @@ -265,6 +265,7 @@ German:"Gott" } + //Civilization select "AI":{ Italian:"IA" @@ -341,6 +342,14 @@ Russian:"Скопировать ID игры" } + "Set current user":{ + Italian:"Imposta utente attuale" + } + + "Player ID from clipboard":{ + Italian:"Copia ID giocatore dagli appunti" + } + /// 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.":{ 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" From 5980f18f892dbb260d21c1efce4c981e8b9139c8 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 28 Sep 2019 21:43:27 +0300 Subject: [PATCH 4/6] Puppeted cities now always auto assign production Resolved #1124 - added annex and puppet tutorial --- .../assets/jsons/Tutorials/Tutorials_English.json | 15 +++++++++++++++ .../logic/automation/ConstructionAutomation.kt | 4 +++- .../unciv/ui/newgamescreen/PlayerPickerTable.kt | 2 +- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 15 ++++++++------- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/android/assets/jsons/Tutorials/Tutorials_English.json b/android/assets/jsons/Tutorials/Tutorials_English.json index d6aad305..78c5cbc9 100644 --- a/android/assets/jsons/Tutorials/Tutorials_English.json +++ b/android/assets/jsons/Tutorials/Tutorials_English.json @@ -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: [ [ "You have encountered a barbarian unit!", diff --git a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt index e39b8468..60f98c9d 100644 --- a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt +++ b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt @@ -45,7 +45,9 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ } 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 addFoodBuildingChoice() diff --git a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt index 5f228371..c82da9c6 100644 --- a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt @@ -88,7 +88,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: } playerIdTable.add(setCurrentUserButton) - val copyFromClipboardButton = TextButton("Player ID from clipboard",CameraStageBaseScreen.skin) + val copyFromClipboardButton = TextButton("Player ID from clipboard".tr(),CameraStageBaseScreen.skin) copyFromClipboardButton.onClick { playerIdTextfield.text = Gdx.app.clipboard.contents onPlayerIdTextUpdated() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index ef7f7a5f..e5e7233e 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -10,7 +10,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.Constants import com.unciv.UnCivGame -import com.unciv.logic.GameInfo import com.unciv.logic.GameSaver import com.unciv.logic.civilization.CivilizationInfo 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! 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! battleTable.update() @@ -196,7 +195,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { updateNextTurnButton() } - private fun displayTutorialsOnUpdate(cloneCivilization: CivilizationInfo, gameClone: GameInfo) { + private fun displayTutorialsOnUpdate() { if (UnCivGame.Current.settings.hasCrashedRecently) { displayTutorials("GameCrashed") UnCivGame.Current.settings.tutorialsShown.remove("GameCrashed") @@ -210,18 +209,20 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { 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 }) { 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") } } + 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") - if (gameClone.getCurrentPlayerCivilization().getCivUnits().any { it.name == Constants.worker }) + if (gameInfo.getCurrentPlayerCivilization().getCivUnits().any { it.name == Constants.worker }) displayTutorials("WorkerTrained") } From 4728423a268d3e6b6e46823ae55564e2b639bfa5 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 28 Sep 2019 21:57:25 +0300 Subject: [PATCH 5/6] Resolved #1098 - added developer steps --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a01f8ae8..aac02958 100644 --- a/README.md +++ b/README.md @@ -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) +## 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 \\android\assets\ as the Working directory + # [Adding a new Civ](docs/NewCivs.md) # [Credits and 3rd parties](docs/Credits.md) From 7e274cae84affc2d641fd46bb3769f3c5cbc8d89 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 28 Sep 2019 22:06:52 +0300 Subject: [PATCH 6/6] Added translations in map editor --- android/build.gradle | 4 ++-- .../com/unciv/ui/mapeditor/MapEditorScreen.kt | 4 ++-- .../ui/mapeditor/TileEditorOptionsTable.kt | 19 ++++++++----------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index e4b5dc3a..97867856 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 302 - versionName "3.1.0-patch1" + versionCode 303 + versionName "3.1.1" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt index 6069a1f8..c7f40fdc 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt @@ -18,8 +18,8 @@ class MapEditorScreen(): CameraStageBaseScreen(){ var tileMap = TileMap(GameParameters()) var mapName = "My first map" lateinit var mapHolder: TileGroupMap - val tileEditorOptions = TileEditorOptionsTable(this) - val showHideEditorOptionsButton = TextButton(">",skin) + private val tileEditorOptions = TileEditorOptionsTable(this) + private val showHideEditorOptionsButton = TextButton(">",skin) constructor(mapNameToLoad:String?):this(){ var mapToLoad = mapNameToLoad diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index a47029bc..27124045 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -3,7 +3,6 @@ package com.unciv.ui.mapeditor import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Actor 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.Table 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.TileImprovement import com.unciv.models.gamebasics.tile.TileResource +import com.unciv.models.gamebasics.tr import com.unciv.ui.tilegroups.TileGroup import com.unciv.ui.tilegroups.TileSetStrings -import com.unciv.ui.utils.CameraStageBaseScreen -import com.unciv.ui.utils.ImageGetter -import com.unciv.ui.utils.center -import com.unciv.ui.utils.onClick +import com.unciv.ui.utils.* class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){ val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/" @@ -45,11 +42,11 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera setTerrainsAndResources() val tabPickerTable = Table().apply { defaults().pad(10f) } - val terrainsAndResourcesTabButton = TextButton("Terrains & Resources",skin) + val terrainsAndResourcesTabButton = TextButton("Terrains & Resources".tr(),skin) .onClick { setTerrainsAndResources() } tabPickerTable.add(terrainsAndResourcesTabButton) - val civLocationsButton = TextButton("Improvements",skin) + val civLocationsButton = TextButton("Improvements".tr(),skin) .onClick { setImprovements() } tabPickerTable.add(civLocationsButton) tabPickerTable.pack() @@ -78,7 +75,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera clearSelection() selectedImprovement=improvement 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() } @@ -128,7 +125,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera group.onClick { clearSelection() selectedTerrain = terrain - setCurrentHex(tileInfo,terrain.name+"\n"+terrain.clone().toString()) + setCurrentHex(tileInfo,terrain.name.tr()+"\n"+terrain.clone().toString()) } if (terrain.type == TerrainType.TerrainFeature) @@ -163,7 +160,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera tileInfo.resource = resource.name tileInfo.setTransients() - setCurrentHex(tileInfo,resource.name+"\n"+resource.clone().toString()) + setCurrentHex(tileInfo,resource.name.tr()+"\n"+resource.clone().toString()) } resources.add(resourceHex) } @@ -258,7 +255,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera fun setCurrentHex(actor:Actor, text:String){ currentHex.remove() val currentHexTable = Table() - currentHexTable.add(Label(text,skin)).padRight(20f) + currentHexTable.add(text.toLabel()).padRight(20f) currentHexTable.add(actor).pad(10f) currentHexTable.pack() currentHex=currentHexTable