mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Unique units do not need to replace existing units
This commit is contained in:
@ -61,7 +61,7 @@ object SpecificUnitAutomation {
|
||||
|
||||
// try to build a citadel
|
||||
if (WorkerAutomation(unit).evaluateFortPlacement(unit.currentTile, unit.civInfo))
|
||||
UnitActions.getGreatPersonBuildImprovementAction(unit)?.action?.invoke()
|
||||
UnitActions.getBuildImprovementAction(unit)?.action?.invoke()
|
||||
|
||||
//if no unit to follow, take refuge in city or build citadel there.
|
||||
val reachableTest : (TileInfo) -> Boolean = {it.civilianUnit == null &&
|
||||
@ -189,7 +189,7 @@ object SpecificUnitAutomation {
|
||||
|
||||
unit.movement.headTowards(chosenTile)
|
||||
if (unit.currentTile == chosenTile)
|
||||
UnitActions.getGreatPersonBuildImprovementAction(unit)?.action?.invoke()
|
||||
UnitActions.getBuildImprovementAction(unit)?.action?.invoke()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -123,9 +123,9 @@ class Nation : INamed {
|
||||
private fun addUniqueUnitsText(textList: ArrayList<String>, ruleset: Ruleset) {
|
||||
for (unit in ruleset.units.values
|
||||
.filter { it.uniqueTo == name }) {
|
||||
if(unit.replaces != null) {
|
||||
val originalUnit = ruleset.units[unit.replaces!!]!!
|
||||
|
||||
textList += unit.name.tr() + " - "+"Replaces [${originalUnit.name}]".tr()
|
||||
textList += unit.name.tr() + " - " + "Replaces [${originalUnit.name}]".tr()
|
||||
if (unit.cost != originalUnit.cost)
|
||||
textList += " {Cost} " + "[${unit.cost}] vs [${originalUnit.cost}]".tr()
|
||||
if (unit.strength != originalUnit.strength)
|
||||
@ -144,6 +144,11 @@ class Nation : INamed {
|
||||
textList += " " + "Lost ability".tr() + "(vs " + originalUnit.name.tr() + "): " + Translations.translateBonusOrPenalty(unique)
|
||||
for (promotion in unit.promotions.filter { it !in originalUnit.promotions })
|
||||
textList += " " + promotion.tr() + " (" + Translations.translateBonusOrPenalty(ruleset.unitPromotions[promotion]!!.effect) + ")"
|
||||
}
|
||||
else {
|
||||
textList += unit.name.tr()
|
||||
textList += " " + unit.getDescription(true).split("\n").joinToString("\n ")
|
||||
}
|
||||
|
||||
textList += ""
|
||||
}
|
||||
|
@ -153,7 +153,8 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||
nationListTable.add(randomPlayerTable).pad(10f).width(nationsPopupWidth).row()
|
||||
|
||||
|
||||
for (nation in newGameScreen.ruleset.nations.values.filter { !it.isCityState() && it.name != "Barbarians" }) {
|
||||
for (nation in newGameScreen.ruleset.nations.values
|
||||
.filter { !it.isCityState() && it.name != "Barbarians" }) {
|
||||
if (player.chosenCiv != nation.name && newGameParameters.players.any { it.chosenCiv == nation.name })
|
||||
continue
|
||||
|
||||
|
@ -346,11 +346,11 @@ object UnitActions {
|
||||
}.takeIf { canConductTradeMission })
|
||||
}
|
||||
|
||||
val buildImprovementAction = getGreatPersonBuildImprovementAction(unit)
|
||||
val buildImprovementAction = getBuildImprovementAction(unit)
|
||||
if (buildImprovementAction != null) actionList += buildImprovementAction
|
||||
}
|
||||
|
||||
fun getGreatPersonBuildImprovementAction(unit: MapUnit): UnitAction? {
|
||||
fun getBuildImprovementAction(unit: MapUnit): UnitAction? {
|
||||
val tile = unit.currentTile
|
||||
for (unique in unit.getUniques().filter { it.startsWith("Can build improvement: ") }) {
|
||||
val improvementName = unique.replace("Can build improvement: ", "")
|
||||
|
Reference in New Issue
Block a user