Deprecated old uniques

This commit is contained in:
Yair Morgenstern 2023-12-30 21:21:44 +02:00
parent a2fd43f840
commit c56df66c7e
4 changed files with 9 additions and 15 deletions

View File

@ -130,11 +130,10 @@ object ReligionAutomation {
if (validCitiesToBuy.isEmpty()) return
val citiesWithBonusCharges = validCitiesToBuy.filter { city ->
city.getMatchingUniques(UniqueType.UnitStartingActions).any { it.params[2] == Constants.spreadReligion }
|| city.getMatchingUniques(UniqueType.UnitStartingPromotions).any {
val promotionName = it.params[2]
val promotion = city.getRuleset().unitPromotions[promotionName] ?: return@any false
promotion.hasUnique(UniqueType.CanSpreadReligion)
city.getMatchingUniques(UniqueType.UnitStartingPromotions).any {
val promotionName = it.params[2]
val promotion = city.getRuleset().unitPromotions[promotionName] ?: return@any false
promotion.hasUnique(UniqueType.CanSpreadReligion)
}
}
val holyCity = validCitiesToBuy.firstOrNull { it.isHolyCityOf(civInfo.religionManager.religion!!.name) }

View File

@ -320,10 +320,6 @@ class TechManager : IsPartOfGameInfoSerialization {
obsoleteOldUnits(techName)
for (unique in civInfo.getMatchingUniques(UniqueType.ReceiveFreeUnitWhenDiscoveringTech)) {
if (unique.params[1] != techName) continue
civInfo.units.addUnit(unique.params[0])
}
for (unique in civInfo.getMatchingUniques(UniqueType.MayanGainGreatPerson)) {
if (unique.params[1] != techName) continue
civInfo.addNotification("You have unlocked [The Long Count]!",

View File

@ -169,8 +169,6 @@ enum class UniqueType(
UnitSupplyPerCity("[amount] Unit Supply per city", UniqueTarget.Global),
FreeUnits("[amount] units cost no maintenance", UniqueTarget.Global),
UnitsInCitiesNoMaintenance("Units in cities cost no Maintenance", UniqueTarget.Global),
@Deprecated("as of 4.8.5", ReplaceWith("Free [unit] appears <upon discovering [tech]>"))
ReceiveFreeUnitWhenDiscoveringTech("Receive free [unit] when you discover [tech]", UniqueTarget.Global),
// Units entering Tiles
// ToDo: make per unit and use unit filters? "Enables embarkation <for [land] units>"
@ -227,8 +225,6 @@ enum class UniqueType(
ReligionSpreadDistance("Religion naturally spreads to cities [amount] tiles away", UniqueTarget.Global, UniqueTarget.FollowerBelief),
MayNotGenerateGreatProphet("May not generate great prophet equivalents naturally", UniqueTarget.Global),
FaithCostOfGreatProphetChange("[relativeAmount]% Faith cost of generating Great Prophet equivalents", UniqueTarget.Global),
@Deprecated("as of 4.8.9", ReplaceWith("All newly-trained [baseUnitFilter] units [cityFilter] receive the [Devout] promotion"))
UnitStartingActions("[baseUnitFilter] units built [cityFilter] can [action] [amount] extra times", UniqueTarget.Global, UniqueTarget.FollowerBelief),
/// Things you get at the start of the game
StartingTech("Starting tech", UniqueTarget.Tech),
@ -812,6 +808,10 @@ enum class UniqueType(
///////////////////////////////////////////// region 99 DEPRECATED AND REMOVED /////////////////////////////////////////////
@Deprecated("as of 4.8.9", ReplaceWith("All newly-trained [baseUnitFilter] units [cityFilter] receive the [Devout] promotion"), DeprecationLevel.ERROR)
UnitStartingActions("[baseUnitFilter] units built [cityFilter] can [action] [amount] extra times", UniqueTarget.Global, UniqueTarget.FollowerBelief),
@Deprecated("as of 4.8.5", ReplaceWith("Free [unit] appears <upon discovering [tech]>"), DeprecationLevel.ERROR)
ReceiveFreeUnitWhenDiscoveringTech("Receive free [unit] when you discover [tech]", UniqueTarget.Global),
@Deprecated("as of 4.7.3", ReplaceWith("[+100]% unhappiness from the number of cities"), DeprecationLevel.ERROR)
UnhappinessFromCitiesDoubled("Unhappiness from number of Cities doubled", UniqueTarget.Global),
@Deprecated("as of 4.6.4", ReplaceWith("[+1] Sight <for [Embarked] units>\" OR \"[+1] Sight <when [Embarked]>"), DeprecationLevel.ERROR)

View File

@ -274,12 +274,11 @@ object UnitActionsFromUniques {
val unitCivBestRoad = unit.civ.tech.getBestRoadAvailable()
if (unitCivBestRoad == RoadStatus.None) return@sequence
var unitCanBuildRoad = false
val uniquesToCheck = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.BuildImprovements)
// If a unit has terrainFilter "Land" or improvementFilter "All", then we may proceed.
// If a unit only had improvement filter "Road" or "Railroad", then we need to also check if that tech is unlocked
unitCanBuildRoad = uniquesToCheck.any { it.params[0] == "Land" || it.params[0] == "All" }
val unitCanBuildRoad = uniquesToCheck.any { it.params[0] == "Land" || it.params[0] == "All" }
|| uniquesToCheck.any {it.params[0] == "Road" } && (unitCivBestRoad == RoadStatus.Road || unitCivBestRoad == RoadStatus.Railroad)
|| uniquesToCheck.any {it.params[0] == "Railroad"} && (unitCivBestRoad == RoadStatus.Railroad)