diff --git a/android/assets/jsons/Units.json b/android/assets/jsons/Units.json index dfdd36d06a..cf69bb4927 100644 --- a/android/assets/jsons/Units.json +++ b/android/assets/jsons/Units.json @@ -17,7 +17,7 @@ }, { name:"Scout", - baseDescription: "Has no abilites, can only explore", + baseDescription: "", cost:25, unitType:"Melee", strength:5, diff --git a/android/build.gradle b/android/build.gradle index fd50cd809c..e09be85c79 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.game" minSdkVersion 14 targetSdkVersion 26 - versionCode 47 - versionName "2.0.4" + versionCode 48 + versionName "2.1.0" } buildTypes { release { diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 24867cf9f4..262a8aa776 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -46,8 +46,6 @@ class UnitAutomation{ if(unit.name.startsWith("Great")) return // DON'T MOVE A MUSCLE - if(unit.getTile().isCityCenter()) return // It's always good to have a unit in the city center - if (unit.health < 50) { healUnit(unit) return @@ -78,6 +76,9 @@ class UnitAutomation{ } } + if(unit.getTile().isCityCenter()) return // It's always good to have a unit in the city center, so if you havn't found annyonw aroud to attack, forget it. + + if (unit.health < 80) { healUnit(unit) return diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 12c4a12e73..021c2c75af 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -94,7 +94,7 @@ class Battle(val gameInfo:GameInfo) { var damageToDefender = calculateDamageToDefender(attacker,defender) var damageToAttacker = calculateDamageToAttacker(attacker,defender) - if(defender.getUnitType() == CombatantType.Civilian){ + if(defender.getUnitType() == UnitType.Civilian){ defender.takeDamage(100) // kill } else if (attacker.isRanged()) { @@ -127,7 +127,7 @@ class Battle(val gameInfo:GameInfo) { if (attacker.isDefeated()) " was destroyed while attacking" else " has " + (if (defender.isDefeated()) "destroyed" else "attacked") val defenderString = - if (defender.getUnitType() == CombatantType.City) defender.getName() + if (defender.getUnitType() == UnitType.City) defender.getName() else " our " + defender.getName() val notificationString = "An enemy " + attacker.getName() + whatHappenedString + defenderString gameInfo.getPlayerCivilization().addNotification(notificationString, attackedTile.position) @@ -135,7 +135,7 @@ class Battle(val gameInfo:GameInfo) { if(defender.isDefeated() - && defender.getUnitType() == CombatantType.City + && defender.getUnitType() == UnitType.City && attacker.isMelee()){ conquerCity((defender as CityCombatant).city, attacker) } @@ -154,7 +154,7 @@ class Battle(val gameInfo:GameInfo) { city.civInfo = attacker.getCivilization() city.health = city.getMaxHealth() / 2 // I think that cities recover to half health? city.getCenterTile().unit = null - city.expansion.cultureStored = 0; + city.expansion.cultureStored = 0 city.expansion.reset() // now that the tiles have changed, we need to reassign population diff --git a/core/src/com/unciv/logic/battle/CityCombatant.kt b/core/src/com/unciv/logic/battle/CityCombatant.kt index bb065de3cc..59e74c9811 100644 --- a/core/src/com/unciv/logic/battle/CityCombatant.kt +++ b/core/src/com/unciv/logic/battle/CityCombatant.kt @@ -28,7 +28,7 @@ class CityCombatant(val city: CityInfo) : ICombatant { // as tech progresses so does city strength val techsPercentKnown: Float = city.civInfo.tech.techsResearched.count().toFloat() / GameBasics.Technologies.count() - val strengthFromTechs = Math.pow(techsPercentKnown*5.0,2.0) *5 + val strengthFromTechs = Math.pow(techsPercentKnown*3.0,2.0) *5 // The way all of this adds up... // 25% of the way through the game provides an extra 3.12 diff --git a/core/src/com/unciv/models/gamebasics/Unit.kt b/core/src/com/unciv/models/gamebasics/Unit.kt index d3840804ce..9cd086bd2d 100644 --- a/core/src/com/unciv/models/gamebasics/Unit.kt +++ b/core/src/com/unciv/models/gamebasics/Unit.kt @@ -9,15 +9,32 @@ import com.unciv.models.stats.INamed class Unit : INamed, IConstruction, ICivilopedia { override val description: String get(){ - val sb = StringBuilder() - sb.appendln(baseDescription) - if(unbuildable) sb.appendln("Unbuildable") - else sb.appendln("Cost: $cost") - if(strength!=0) sb.appendln("Strength: $strength") - if(rangedStrength!=0) sb.appendln("Ranged strength: $rangedStrength") - return sb.toString() + return getDescription(false) } + fun getDescription(forPickerScreen:Boolean): String { + val sb = StringBuilder() + if(baseDescription!="") sb.appendln(baseDescription) + if(!forPickerScreen) { + if (unbuildable) sb.appendln("Unbuildable") + else sb.appendln("Cost: $cost") + if(requiredResource!=null) sb.appendln("Required resource: $requiredResource") + if(requiredTech!=null) sb.appendln("Required tech: $requiredTech") + } + if(strength!=0){ + sb.append("Strength: $strength") + if(rangedStrength!=0) sb.append(", Ranged strength: $rangedStrength") + sb.appendln() + } + + if(uniques!=null){ + for(unique in uniques!!) + sb.appendln(unique) + } + sb.appendln("Movement: $movement") + return sb.toString() + } + override lateinit var name: String var baseDescription: String? = null var cost: Int = 0 @@ -30,6 +47,7 @@ class Unit : INamed, IConstruction, ICivilopedia { var requiredTech:String? = null var requiredResource:String? = null var uniques:HashSet?=null + var upgradesTo:String? = null fun getMapUnit(): MapUnit { val unit = MapUnit() diff --git a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt index 8ebfa98da5..bb8f9b4e07 100644 --- a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt @@ -60,7 +60,7 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() { for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions)}) { units.addActor(getProductionButton(unit.name, unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " turns", - unit.baseDescription, "Train " + unit.name)) + unit.getDescription(true), "Train " + unit.name)) } if (civInfo.tech.isResearched("Education")) diff --git a/core/src/com/unciv/ui/worldscreen/BattleTable.kt b/core/src/com/unciv/ui/worldscreen/BattleTable.kt index a6632765ca..437d0b7d83 100644 --- a/core/src/com/unciv/ui/worldscreen/BattleTable.kt +++ b/core/src/com/unciv/ui/worldscreen/BattleTable.kt @@ -4,7 +4,10 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.logic.battle.* +import com.unciv.logic.battle.Battle +import com.unciv.logic.battle.CityCombatant +import com.unciv.logic.battle.ICombatant +import com.unciv.logic.battle.MapUnitCombatant import com.unciv.logic.map.TileInfo import com.unciv.logic.map.UnitType import com.unciv.ui.cityscreen.addClickListener @@ -120,7 +123,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() { val attackerCanReachDefender:Boolean var tileToMoveTo:TileInfo? = null - if(attacker.getCombatantType() == CombatantType.Melee){ + if(attacker.isMelee()){ if(attacker.getTile().neighbors.contains(defender.getTile())){ attackerCanReachDefender=true } diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index e5fe7ed4f8..1f3fcc09d3 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -108,7 +108,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: when(unit.getBaseUnit().unitType){ UnitType.Civilian -> return UnitType.Melee, UnitType.Mounted -> attackableTiles = unit.getDistanceToTiles().keys.toList() - UnitType.Ranged, UnitType.Siege -> attackableTiles = unit.getTile().getTilesInDistance(2) + UnitType.Archery, UnitType.Siege -> attackableTiles = unit.getTile().getTilesInDistance(2) UnitType.City -> throw Exception("How are you attacking with a city?") } diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt index cd0db6bbae..4bb6074934 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt @@ -47,7 +47,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){ unitLabelText += "\r\nHealth: " + unit.health + "\r\nStrength: " + unit.getBaseUnit().strength } - if (unit.getBaseUnit().unitType == UnitType.Ranged) + if (unit.getBaseUnit().rangedStrength!=0) unitLabelText += "\r\nRanged strength: "+unit.getBaseUnit().rangedStrength unitLabel.setText(unitLabelText)