mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 15:01:09 -04:00
Resolved #5520 - no tech icon errors from techs with era errors
This commit is contained in:
parent
4efc8b3195
commit
61b6e40cdc
@ -27,10 +27,10 @@ interface INonPerpetualConstruction : IConstruction, INamed, IHasUniques {
|
||||
|
||||
fun canBePurchasedWithStat(cityInfo: CityInfo?, stat: Stat): Boolean {
|
||||
if (stat in listOf(Stat.Production, Stat.Happiness)) return false
|
||||
if ("Cannot be purchased" in uniques) return false
|
||||
if (hasUnique(UniqueType.CannotBePurchased)) return false
|
||||
if (stat == Stat.Gold) return !hasUnique(UniqueType.Unbuildable)
|
||||
// Can be purchased with [Stat] [cityFilter]
|
||||
if (getMatchingUniques("Can be purchased with [] []")
|
||||
if (getMatchingUniques(UniqueType.CanBePurchasedWithStat)
|
||||
.any { it.params[0] == stat.name && (cityInfo != null && cityInfo.matchesFilter(it.params[1])) }
|
||||
) return true
|
||||
// Can be purchased for [amount] [Stat] [cityFilter]
|
||||
@ -65,7 +65,7 @@ interface INonPerpetualConstruction : IConstruction, INamed, IHasUniques {
|
||||
if (lowestCostUnique != null) return lowestCostUnique.params[0].toInt()
|
||||
|
||||
// Can be purchased with [Stat] [cityFilter]
|
||||
if (getMatchingUniques("Can be purchased with [] []")
|
||||
if (getMatchingUniques(UniqueType.CanBePurchasedWithStat)
|
||||
.any { it.params[0] == stat.name && cityInfo.matchesFilter(it.params[1])}
|
||||
) return cityInfo.civInfo.getEra().baseUnitBuyCost
|
||||
return null
|
||||
|
@ -138,9 +138,17 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
MayanGainGreatPerson("Receive a free Great Person at the end of every [comment] (every 394 years), after researching [tech]. Each bonus person can only be chosen once.", UniqueTarget.Nation),
|
||||
MayanCalendarDisplay("Once The Long Count activates, the year on the world screen displays as the traditional Mayan Long Count.", UniqueTarget.Nation),
|
||||
|
||||
///////////////////////////////////////// BUILDING UNIQUES /////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////// CONSTRUCTION UNIQUES /////////////////////////////////////////
|
||||
|
||||
Unbuildable("Unbuildable", UniqueTarget.Building, UniqueTarget.Unit),
|
||||
CannotBePurchased("Cannot be purchased", UniqueTarget.Building, UniqueTarget.Unit),
|
||||
CanBePurchasedWithStat("Can be purchased with [stat] [cityFilter]", UniqueTarget.Building, UniqueTarget.Unit),
|
||||
|
||||
|
||||
///////////////////////////////////////// BUILDING UNIQUES /////////////////////////////////////////
|
||||
|
||||
|
||||
CostIncreasesPerCity("Cost increases by [amount] per owned city", UniqueTarget.Building),
|
||||
CannotBeBuiltWith("Cannot be built with [buildingName]", UniqueTarget.Building),
|
||||
RequiresAnotherBuilding("Requires a [buildingName] in this city", UniqueTarget.Building),
|
||||
|
@ -355,7 +355,8 @@ object ImageGetter {
|
||||
fun getTechIconGroup(techName: String, circleSize: Float) = getTechIcon(techName).surroundWithCircle(circleSize)
|
||||
|
||||
fun getTechIcon(techName: String): Image {
|
||||
val techIconColor = ruleset.eras[ruleset.technologies[techName]!!.era()]!!.getColor()
|
||||
val techIconColor = ruleset.eras[ruleset.technologies[techName]?.era()]?.getColor()
|
||||
?: return getWhiteDot()
|
||||
return getImage("TechIcons/$techName").apply { color = techIconColor.lerp(Color.BLACK, 0.6f) }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user