Add tech cost uniques (#12986)

* Update UniqueType.kt

* Update TechManager.kt

* Update core/src/com/unciv/models/ruleset/unique/UniqueType.kt

---------

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
EmperorPinguin 2025-03-02 15:19:09 +01:00 committed by GitHub
parent 9f2ffa5df1
commit 2927416f48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.models.translations.tr
import com.unciv.ui.components.MayaCalendar
import com.unciv.ui.components.extensions.toPercent
import com.unciv.ui.components.fonts.Fonts
import com.unciv.utils.withItem
import kotlin.math.ceil
@ -119,7 +120,10 @@ class TechManager : IsPartOfGameInfoSerialization {
techCost /= getScienceModifier(techName)
val mapSizePredef = civInfo.gameInfo.tileMap.mapParameters.mapSize.getPredefinedOrNextSmaller()
techCost *= mapSizePredef.techCostMultiplier
techCost *= 1 + (civInfo.cities.size - 1) * mapSizePredef.techCostPerCityModifier
var cityModifier = (civInfo.cities.size - 1) * mapSizePredef.techCostPerCityModifier
for (unique in civInfo.getMatchingUniques(UniqueType.LessTechCostFromCities)) cityModifier *= 1 - unique.params[0].toFloat() / 100
for (unique in civInfo.getMatchingUniques(UniqueType.LessTechCost)) techCost *= unique.params[0].toPercent()
techCost *= 1 + cityModifier
return techCost.toInt()
}

View File

@ -155,6 +155,10 @@ enum class UniqueType(
LessPolicyCostFromCities("Each city founded increases culture cost of policies [relativeAmount]% less than normal", UniqueTarget.Global),
LessPolicyCost("[relativeAmount]% Culture cost of adopting new Policies", UniqueTarget.Global),
/// Tech Cost
LessTechCostFromCities("Each city founded increases Science cost of Technologies [relativeAmount]% less than normal", UniqueTarget.Global),
LessTechCost("[relativeAmount]% Science cost of researching new Technologies", UniqueTarget.Global),
/// Natural Wonders
StatsFromNaturalWonders("[stats] for every known Natural Wonder", UniqueTarget.Global),
StatBonusWhenDiscoveringNaturalWonder("[stats] for discovering a Natural Wonder (bonus enhanced to [stats] if first to discover it)", UniqueTarget.Global),