mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Pre-solved potential bugs, unique typing for deprecated uniques
This commit is contained in:
@ -70,11 +70,7 @@ object BackwardCompatibility {
|
||||
if (!ruleSet.technologies.containsKey(tech))
|
||||
civInfo.tech.techsResearched.remove(tech)
|
||||
for (policy in civInfo.policies.adoptedPolicies.toList())
|
||||
if (!ruleSet.policies.containsKey(policy)
|
||||
// Conversion code for deprecated policies since 3.16.15
|
||||
&& !(policy == "Patronage " || policy == "Patronage Complete")
|
||||
//
|
||||
)
|
||||
if (!ruleSet.policies.containsKey(policy))
|
||||
civInfo.policies.adoptedPolicies.remove(policy)
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ object Battle {
|
||||
/** Alternatively, maybe we DID reach that tile, but it turned out to be a hill or something,
|
||||
* so we expended all of our movement points!
|
||||
*/
|
||||
if (attacker.unit.currentMovement != attackableTile.movementLeftAfterMovingToAttackTile)
|
||||
if (attacker.unit.currentMovement == 0f)
|
||||
return
|
||||
if (attacker.unit.hasUnique(UniqueType.MustSetUp) && !attacker.unit.isSetUpForSiege()) {
|
||||
attacker.unit.action = UnitActionType.SetUp.value
|
||||
|
@ -614,11 +614,11 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
var foodEatenBySpecialists = 2f * cityInfo.population.getNumberOfSpecialists()
|
||||
|
||||
// Deprecated since 3.16.11
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques("-[]% food consumption by specialists"))
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques(UniqueType.FoodConsumptionBySpecialistsDeprecated))
|
||||
foodEatenBySpecialists *= 1f - unique.params[0].toFloat() / 100f
|
||||
//
|
||||
|
||||
for (unique in cityInfo.getMatchingUniques("[]% food consumption by specialists []"))
|
||||
for (unique in cityInfo.getMatchingUniques(UniqueType.FoodConsumptionBySpecialists))
|
||||
if (cityInfo.matchesFilter(unique.params[1]))
|
||||
foodEatenBySpecialists *= unique.params[0].toPercent()
|
||||
|
||||
|
@ -182,7 +182,7 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
||||
}
|
||||
|
||||
// Deprecated since 3.16.15
|
||||
if (civInfo.hasUnique("50% of excess happiness added to culture towards policies")) {
|
||||
if (civInfo.hasUnique(UniqueType.ExcessHappinessToCultureDeprecated)) {
|
||||
val happiness = civInfo.getHappiness()
|
||||
if (happiness > 0) statMap.add("Policies", Stats(culture = happiness / 2f))
|
||||
}
|
||||
|
@ -155,6 +155,15 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
|
||||
FreeExtraBeliefs("May choose [amount] additional [beliefType] beliefs when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
||||
FreeExtraAnyBeliefs("May choose [amount] additional belief(s) of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
||||
|
||||
FoodConsumptionBySpecialists("[amount]% food consumption by specialists [cityFilter]", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.18.2", ReplaceWith("[-amount]% food consumption by specialists [cityFilter]"), DeprecationLevel.WARNING)
|
||||
FoodConsumptionBySpecialistsDeprecated("-[amount]% food consumption by specialists [cityFilter]", UniqueTarget.Global),
|
||||
|
||||
ExcessHappinessToGlobalStat("[amount]% of excess happiness converted to [stat]", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.18.2", ReplaceWith("[50]% of excess happiness converted to [Culture]"), DeprecationLevel.WARNING)
|
||||
ExcessHappinessToCultureDeprecated("50% of excess happiness added to culture towards policies", UniqueTarget.Global),
|
||||
|
||||
|
||||
// There is potential to merge these
|
||||
BuyUnitsIncreasingCost("May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount])", UniqueTarget.Global),
|
||||
BuyBuildingsIncreasingCost("May buy [buildingFilter] buildings for [amount] [stat] [cityFilter] at an increasing price ([amount])", UniqueTarget.Global),
|
||||
|
@ -22,8 +22,8 @@ object TileSetCache : HashMap<String, TileSetConfig>() {
|
||||
val mods = mutableListOf("")
|
||||
if (UncivGame.isCurrentInitialized()) {
|
||||
mods.addAll(UncivGame.Current.settings.visualMods)
|
||||
mods.addAll(ruleSetMods)
|
||||
}
|
||||
mods.addAll(ruleSetMods)
|
||||
clear()
|
||||
for (mod in mods.distinct()) {
|
||||
val entry = allConfigs.entries.firstOrNull { it.key.mod == mod } ?: continue
|
||||
|
Reference in New Issue
Block a user