diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index cb338602..60e9f47d 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -3,7 +3,6 @@ package com.unciv.logic.battle import com.badlogic.gdx.graphics.Color import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CivilizationInfo diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index a53e685d..faea4566 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -1,7 +1,6 @@ package com.unciv.logic.battle import com.unciv.Constants -import com.unciv.UniqueAbility import com.unciv.logic.map.MapUnit import com.unciv.logic.map.TileInfo import com.unciv.models.ruleset.unit.UnitType diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index b42d52e8..3a6b29ed 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -1,7 +1,6 @@ package com.unciv.logic.city import com.badlogic.gdx.graphics.Color -import com.unciv.UniqueAbility import com.unciv.logic.automation.Automation import com.unciv.logic.map.TileInfo import com.unciv.ui.utils.withItem diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 90c518da..2d952ed8 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.math.Vector2 import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.battle.Battle import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.diplomacy.DiplomacyFlags @@ -27,7 +26,10 @@ import com.unciv.ui.utils.withoutItem import java.util.* import kotlin.collections.HashMap import kotlin.collections.HashSet -import kotlin.math.* +import kotlin.math.ceil +import kotlin.math.max +import kotlin.math.min +import kotlin.math.roundToInt class CityInfo { @Transient lateinit var civInfo: CivilizationInfo diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index 67eeaa19..592dd911 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -2,7 +2,6 @@ package com.unciv.logic.city import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.civilization.CityStateType import com.unciv.logic.civilization.diplomacy.RelationshipLevel import com.unciv.logic.map.RoadStatus @@ -12,8 +11,6 @@ import com.unciv.models.ruleset.unit.BaseUnit import com.unciv.models.ruleset.unit.UnitType import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats -import com.unciv.models.translations.equalsPlaceholderText -import com.unciv.models.translations.getPlaceholderParameters class CityStats { diff --git a/core/src/com/unciv/logic/civilization/CivInfoStats.kt b/core/src/com/unciv/logic/civilization/CivInfoStats.kt index c7a1a44e..ddb7fdbd 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoStats.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoStats.kt @@ -1,7 +1,6 @@ package com.unciv.logic.civilization import com.unciv.Constants -import com.unciv.UniqueAbility import com.unciv.logic.civilization.diplomacy.RelationshipLevel import com.unciv.logic.map.RoadStatus import com.unciv.models.metadata.BASE_GAME_DURATION_TURNS diff --git a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt index db6210ad..923be2b4 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt @@ -1,7 +1,6 @@ package com.unciv.logic.civilization import com.badlogic.gdx.graphics.Color -import com.unciv.UniqueAbility import com.unciv.logic.map.TileInfo import com.unciv.models.ruleset.tile.ResourceSupplyList diff --git a/core/src/com/unciv/logic/civilization/GoldenAgeManager.kt b/core/src/com/unciv/logic/civilization/GoldenAgeManager.kt index 8640e8c4..40685b30 100644 --- a/core/src/com/unciv/logic/civilization/GoldenAgeManager.kt +++ b/core/src/com/unciv/logic/civilization/GoldenAgeManager.kt @@ -1,7 +1,6 @@ package com.unciv.logic.civilization import com.badlogic.gdx.graphics.Color -import com.unciv.UniqueAbility class GoldenAgeManager{ @Transient diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 91e31491..b00a3ec7 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -2,7 +2,6 @@ package com.unciv.logic.civilization.diplomacy import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UniqueAbility import com.unciv.logic.civilization.* import com.unciv.logic.trade.Trade import com.unciv.logic.trade.TradeOffer diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 18bba34d..fd4b1fa1 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.math.Vector2 import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.civilization.CivilizationInfo diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 06fd240a..2b5e6aa0 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -3,7 +3,6 @@ import com.badlogic.gdx.math.Vector2 import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.HexMath import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 3cb0b915..6b469a20 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -2,7 +2,6 @@ package com.unciv.logic.map import com.badlogic.gdx.math.Vector2 import com.unciv.Constants -import com.unciv.UniqueAbility import com.unciv.logic.civilization.CivilizationInfo class UnitMovementAlgorithms(val unit:MapUnit) { diff --git a/core/src/com/unciv/models/ruleset/Nation.kt b/core/src/com/unciv/models/ruleset/Nation.kt index 1d6c8bf7..6a117cc4 100644 --- a/core/src/com/unciv/models/ruleset/Nation.kt +++ b/core/src/com/unciv/models/ruleset/Nation.kt @@ -19,45 +19,52 @@ enum class VictoryType{ class Nation : INamed { override lateinit var name: String - var leaderName="" - fun getLeaderDisplayName() = if(isCityState()) name - else "[$leaderName] of [$name]" + var leaderName = "" + fun getLeaderDisplayName() = if (isCityState()) name + else "[$leaderName] of [$name]" var cityStateType: CityStateType? = null - var preferredVictoryType:VictoryType = VictoryType.Neutral - var declaringWar="" - var attacked="" - var defeated="" - var introduction="" - var tradeRequest="" + var preferredVictoryType: VictoryType = VictoryType.Neutral + var declaringWar = "" + var attacked = "" + var defeated = "" + var introduction = "" + var tradeRequest = "" - var neutralHello="" - var hateHello="" + var neutralHello = "" + var hateHello = "" lateinit var outerColor: List var unique: UniqueAbility? = null - val uniques = HashSet() - val uniqueObjects:List by lazy { uniques.map { Unique(it) } } + var uniqueName = "" + var uniques = HashSet() + val uniqueObjects: List by lazy { uniques.map { Unique(it) } } var innerColor: List? = null var startBias = ArrayList() - @Transient private lateinit var outerColorObject:Color + @Transient + private lateinit var outerColorObject: Color fun getOuterColor(): Color = outerColorObject - @Transient private lateinit var innerColorObject:Color + @Transient + private lateinit var innerColorObject: Color fun getInnerColor(): Color = innerColorObject - fun isCityState()= cityStateType != null - fun isMajorCiv() = !isBarbarian() && !isCityState() &&!isSpectator() - fun isBarbarian() = name== Constants.barbarians + fun isCityState() = cityStateType != null + fun isMajorCiv() = !isBarbarian() && !isCityState() && !isSpectator() + fun isBarbarian() = name == Constants.barbarians fun isSpectator() = name == Constants.spectator // This is its own transient because we'll need to check this for every tile-to-tile movement which is harsh - @Transient var forestsAndJunglesAreRoads = false + @Transient + var forestsAndJunglesAreRoads = false + // Same for Inca unique - @Transient var ignoreHillMovementCost = false - @Transient var embarkDisembarkCosts1 = false + @Transient + var ignoreHillMovementCost = false + @Transient + var embarkDisembarkCosts1 = false fun setTransients() { outerColorObject = colorFromRGB(outerColor[0], outerColor[1], outerColor[2]) @@ -69,19 +76,17 @@ class Nation : INamed { forestsAndJunglesAreRoads = true if (uniques.contains("Units ignore terrain costs when moving into any tile with Hills")) ignoreHillMovementCost = true - if(uniques.contains("Units pay only 1 movement point to embark and disembark")) + if (uniques.contains("Units pay only 1 movement point to embark and disembark")) embarkDisembarkCosts1 = true } lateinit var cities: ArrayList - - fun getUniqueString(ruleset: Ruleset, forPickerScreen: Boolean = true): String { val textList = ArrayList() - if (leaderName.isNotEmpty() && !forPickerScreen){ + if (leaderName.isNotEmpty() && !forPickerScreen) { textList += getLeaderDisplayName().tr() textList += "" } @@ -91,13 +96,18 @@ class Nation : INamed { textList += "" } +// if (uniqueName!="") { +// textList += uniqueName.tr() + ":" +// textList += " " + uniques.joinToString(", ").tr() +// textList += "" +// } if (startBias.isNotEmpty()) { textList += "Start bias:".tr() + startBias.joinToString(", ", " ") { it.tr() } textList += "" } - addUniqueBuildingsText(textList,ruleset) - addUniqueUnitsText(textList,ruleset) - addUniqueImprovementsText(textList,ruleset) + addUniqueBuildingsText(textList, ruleset) + addUniqueUnitsText(textList, ruleset) + addUniqueImprovementsText(textList, ruleset) return textList.joinToString("\n").tr().trim() } @@ -133,7 +143,7 @@ class Nation : INamed { private fun addUniqueUnitsText(textList: ArrayList, ruleset: Ruleset) { for (unit in ruleset.units.values .filter { it.uniqueTo == name }) { - if(unit.replaces != null) { + if (unit.replaces != null) { val originalUnit = ruleset.units[unit.replaces!!]!! textList += unit.name.tr() + " - " + "Replaces [${originalUnit.name}]".tr() if (unit.cost != originalUnit.cost) @@ -154,8 +164,7 @@ 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 { + } else { textList += unit.name.tr() textList += " " + unit.getDescription(true).split("\n").joinToString("\n ") } @@ -169,9 +178,9 @@ class Nation : INamed { .filter { it.uniqueTo == name }) { textList += improvement.name.tr() - textList += " "+improvement.clone().toString() - for(unique in improvement.uniques) - textList += " "+unique.tr() + textList += " " + improvement.clone().toString() + for (unique in improvement.uniques) + textList += " " + unique.tr() } } } diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index a8b50962..23f746eb 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -3,7 +3,6 @@ package com.unciv.ui.worldscreen.unit import com.badlogic.gdx.graphics.Color import com.unciv.Constants import com.unciv.UncivGame -import com.unciv.UniqueAbility import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.civilization.CivilizationInfo