mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-17 03:09:27 +07:00
Great merchant trade mission gold increases with era (as per original civ)
Added Great People actions translations
This commit is contained in:
@ -43,8 +43,9 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
|
||||
|
||||
fun tryConnectingCities():Boolean{ // returns whether we actually did anything
|
||||
val citiesThatNeedConnecting = unit.civInfo.cities.filter { it.population.population>3 && !it.isCapital()
|
||||
&& !it.cityStats.isConnectedToCapital(RoadStatus.Road) }
|
||||
val citiesThatNeedConnecting = unit.civInfo.cities
|
||||
.filter { it.population.population>3 && !it.isCapital()
|
||||
&& !it.cityStats.isConnectedToCapital(RoadStatus.Road) }
|
||||
if(citiesThatNeedConnecting.isEmpty()) return false // do nothing.
|
||||
|
||||
val citiesThatNeedConnectingBfs = citiesThatNeedConnecting
|
||||
@ -147,22 +148,19 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
// Either generalize or delete
|
||||
fun constructRoadTo(destination:TileInfo) {
|
||||
val currentTile = unit.getTile()
|
||||
if (currentTile.roadStatus == RoadStatus.None) {
|
||||
currentTile.startWorkingOnImprovement(GameBasics.TileImprovements["Road"]!!, unit.civInfo)
|
||||
return
|
||||
}
|
||||
if (currentTile.roadStatus == RoadStatus.None)
|
||||
return currentTile.startWorkingOnImprovement(GameBasics.TileImprovements["Road"]!!, unit.civInfo)
|
||||
|
||||
val pathToDestination = unit.movementAlgs().getShortestPath(destination)
|
||||
val destinationThisTurn = pathToDestination.first()
|
||||
val fullPathToCurrentDestination = unit.movementAlgs().getFullPathToCloseTile(destinationThisTurn)
|
||||
val firstTileWithoutRoad = fullPathToCurrentDestination.firstOrNull { it.roadStatus == RoadStatus.None && unit.canMoveTo(it) }
|
||||
if (firstTileWithoutRoad == null) {
|
||||
unit.moveToTile(destinationThisTurn)
|
||||
return
|
||||
}
|
||||
if (firstTileWithoutRoad == null)
|
||||
return unit.moveToTile(destinationThisTurn)
|
||||
|
||||
unit.moveToTile(firstTileWithoutRoad)
|
||||
if (unit.currentMovement > 0)
|
||||
firstTileWithoutRoad.startWorkingOnImprovement(GameBasics.TileImprovements["Road"]!!, unit.civInfo)
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -37,19 +37,19 @@ open class SpecialConstruction(override var name: String, override val descripti
|
||||
|
||||
|
||||
override fun getProductionCost(adoptedPolicies: HashSet<String>): Int {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw Exception("Impossible!")
|
||||
}
|
||||
|
||||
override fun getGoldCost(adoptedPolicies: HashSet<String>): Int {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw Exception("Impossible!")
|
||||
}
|
||||
|
||||
override fun isBuildable(construction: CityConstructions): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw Exception("Impossible!")
|
||||
}
|
||||
|
||||
override fun postBuildEvent(construction: CityConstructions) {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw Exception("Impossible!")
|
||||
}
|
||||
|
||||
}
|
@ -97,7 +97,7 @@ class TechManager {
|
||||
.firstOrNull { it.isCityCenter() }
|
||||
if (closestCityTile != null) {
|
||||
civInfo.addNotification("{"+revealedResource.name + "} {revealed near} "
|
||||
+ closestCityTile.getCity()!!.name, tileInfo.position, Color.BLUE)
|
||||
+ closestCityTile.getCity()!!.name, tileInfo.position, Color.BLUE) // todo change to [] notation
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class LoadScreen : PickerScreen() {
|
||||
loadedGame.setTransients()
|
||||
UnCivGame.Current.loadGame(loadedGame)
|
||||
}catch (ex:Exception){
|
||||
errorLabel.setText("Could not load game from clipboard!")
|
||||
errorLabel.setText("Could not load game from clipboard!".tr())
|
||||
}
|
||||
}
|
||||
|
||||
|
35
core/src/com/unciv/ui/utils/UnitGroup.kt
Normal file
35
core/src/com/unciv/ui/utils/UnitGroup.kt
Normal file
@ -0,0 +1,35 @@
|
||||
package com.unciv.ui.utils
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.unciv.logic.map.MapUnit
|
||||
|
||||
class UnitImage(val unit: MapUnit, val size: Float): Group() {
|
||||
init {
|
||||
val unitBaseImage = ImageGetter.getUnitIcon(unit.name, unit.civInfo.getNation().getSecondaryColor())
|
||||
.apply { setSize(size * 0.75f, size * 0.75f) }
|
||||
|
||||
val background = getBackgroundImageForUnit(unit)
|
||||
background.apply {
|
||||
this.color = unit.civInfo.getNation().getColor()
|
||||
setSize(size, size)
|
||||
}
|
||||
setSize(size, size)
|
||||
addActor(background)
|
||||
unitBaseImage.center(this)
|
||||
addActor(unitBaseImage)
|
||||
|
||||
|
||||
if (unit.health < 100) { // add health bar
|
||||
addActor(ImageGetter.getHealthBar(unit.health.toFloat(), 100f, size))
|
||||
}
|
||||
}
|
||||
|
||||
fun getBackgroundImageForUnit(unit: MapUnit): Image {
|
||||
return when {
|
||||
unit.isEmbarked() -> ImageGetter.getImage("OtherIcons/Banner")
|
||||
unit.isFortified() -> ImageGetter.getImage("OtherIcons/Shield.png")
|
||||
else -> ImageGetter.getCircle()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.worldscreen.unit
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.automation.UnitAutomation
|
||||
import com.unciv.logic.automation.WorkerAutomation
|
||||
@ -131,7 +132,7 @@ class UnitActions {
|
||||
&& tile.getTileResource().improvement == improvement
|
||||
&& unit.civInfo.tech.isResearched(GameBasics.TileImprovements[improvement]!!.techRequired!!)
|
||||
)
|
||||
actionList += UnitAction("Create $improvement", unit.currentMovement != 0f) {
|
||||
actionList += UnitAction("Create [$improvement]", unit.currentMovement != 0f) {
|
||||
tile.improvement = improvement
|
||||
unit.destroy()
|
||||
}
|
||||
@ -139,7 +140,7 @@ class UnitActions {
|
||||
|
||||
for(unique in unit.getUniques().filter { it.startsWith("Can build improvement: ") }){
|
||||
val improvementName = unique.replace("Can build improvement: ","")
|
||||
actionList += UnitAction("Construct $improvementName",
|
||||
actionList += UnitAction("Create [$improvementName]",
|
||||
unit.currentMovement != 0f && !tile.isCityCenter(),
|
||||
constructImprovementAndDestroyUnit(unit, improvementName))
|
||||
}
|
||||
@ -177,7 +178,10 @@ class UnitActions {
|
||||
if (unit.name == "Great Merchant" && !unit.isEmbarked()) {
|
||||
actionList += UnitAction("Conduct Trade Mission", unit.currentMovement != 0f
|
||||
) {
|
||||
unit.civInfo.gold += 350 // + 50 * era_number - todo!
|
||||
// http://civilization.wikia.com/wiki/Great_Merchant_(Civ5)
|
||||
val goldGained = 350 + 50 * unit.civInfo.getEra().ordinal
|
||||
unit.civInfo.gold += goldGained
|
||||
unit.civInfo.addNotification("Your trade mission has earned you [$goldGained] gold!",null, Color.GOLD)
|
||||
unit.destroy()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user