mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 23:08:35 +07:00
Resolved #8387 - Fixed Reliquary belief
Got rid of multiple uniques with the same text
This commit is contained in:
@ -370,7 +370,7 @@ object ReligionAutomation {
|
|||||||
unique.stats.values.sum()
|
unique.stats.values.sum()
|
||||||
UniqueType.StatsFromGlobalFollowers ->
|
UniqueType.StatsFromGlobalFollowers ->
|
||||||
4f * (unique.stats.values.sum() / unique.params[1].toFloat())
|
4f * (unique.stats.values.sum() / unique.params[1].toFloat())
|
||||||
UniqueType.StatsSpendingGreatPeople ->
|
UniqueType.ProvidesStatsWheneverGreatPersonExpended ->
|
||||||
unique.stats.values.sum() / 2f
|
unique.stats.values.sum() / 2f
|
||||||
UniqueType.Strength ->
|
UniqueType.Strength ->
|
||||||
unique.params[0].toFloat() / 4f
|
unique.params[0].toFloat() / 4f
|
||||||
|
@ -341,7 +341,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
|||||||
hasStrengthBonusInRadiusUnique = hasUnique(UniqueType.StrengthBonusInRadius)
|
hasStrengthBonusInRadiusUnique = hasUnique(UniqueType.StrengthBonusInRadius)
|
||||||
hasCitadelPlacementUnique = getMatchingUniques(UniqueType.ConstructImprovementConsumingUnit)
|
hasCitadelPlacementUnique = getMatchingUniques(UniqueType.ConstructImprovementConsumingUnit)
|
||||||
.mapNotNull { civInfo.gameInfo.ruleSet.tileImprovements[it.params[0]] }
|
.mapNotNull { civInfo.gameInfo.ruleSet.tileImprovements[it.params[0]] }
|
||||||
.any { it.hasUnique(UniqueType.TakeOverTilesAroundWhenBuilt) }
|
.any { it.hasUnique(UniqueType.TakesOverAdjacentTiles) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun copyStatisticsTo(newUnit: MapUnit) {
|
fun copyStatisticsTo(newUnit: MapUnit) {
|
||||||
|
@ -4,9 +4,9 @@ import com.unciv.logic.GameInfo
|
|||||||
import com.unciv.logic.IsPartOfGameInfoSerialization
|
import com.unciv.logic.IsPartOfGameInfoSerialization
|
||||||
import com.unciv.models.ruleset.Belief
|
import com.unciv.models.ruleset.Belief
|
||||||
import com.unciv.models.ruleset.BeliefType
|
import com.unciv.models.ruleset.BeliefType
|
||||||
|
import com.unciv.models.ruleset.unique.Unique
|
||||||
import com.unciv.models.ruleset.unique.UniqueType
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.models.stats.INamed
|
import com.unciv.models.stats.INamed
|
||||||
import com.unciv.models.stats.Stat
|
|
||||||
|
|
||||||
/** Data object for Religions */
|
/** Data object for Religions */
|
||||||
class Religion() : INamed, IsPartOfGameInfoSerialization {
|
class Religion() : INamed, IsPartOfGameInfoSerialization {
|
||||||
@ -85,8 +85,10 @@ class Religion() : INamed, IsPartOfGameInfoSerialization {
|
|||||||
mapToExistingBeliefs(founderBeliefs).asSequence().filter { it.type == BeliefType.Enhancer }
|
mapToExistingBeliefs(founderBeliefs).asSequence().filter { it.type == BeliefType.Enhancer }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUniquesOfBeliefs(beliefs: HashSet<String>) =
|
private fun getUniquesOfBeliefs(beliefs: HashSet<String>): Sequence<Unique> {
|
||||||
mapToExistingBeliefs(beliefs).asSequence().flatMap { it.uniqueObjects }
|
val result = mapToExistingBeliefs(beliefs).asSequence().flatMap { it.uniqueObjects }
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
fun getFollowerUniques() = getUniquesOfBeliefs(followerBeliefs)
|
fun getFollowerUniques() = getUniquesOfBeliefs(followerBeliefs)
|
||||||
|
|
||||||
|
@ -156,8 +156,6 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
FreeExtraAnyBeliefs("May choose [amount] additional belief(s) of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
FreeExtraAnyBeliefs("May choose [amount] additional belief(s) of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
||||||
StatsWhenAdoptingReligionSpeed("[stats] when a city adopts this religion for the first time (modified by game speed)", UniqueTarget.Global),
|
StatsWhenAdoptingReligionSpeed("[stats] when a city adopts this religion for the first time (modified by game speed)", UniqueTarget.Global),
|
||||||
StatsWhenAdoptingReligion("[stats] when a city adopts this religion for the first time", UniqueTarget.Global),
|
StatsWhenAdoptingReligion("[stats] when a city adopts this religion for the first time", UniqueTarget.Global),
|
||||||
StatsSpendingGreatPeople("[stats] whenever a Great Person is expended", UniqueTarget.Global),
|
|
||||||
|
|
||||||
|
|
||||||
UnhappinessFromPopulationTypePercentageChange("[relativeAmount]% Unhappiness from [populationFilter] [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
UnhappinessFromPopulationTypePercentageChange("[relativeAmount]% Unhappiness from [populationFilter] [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||||
FoodConsumptionBySpecialists("[relativeAmount]% Food consumption by specialists [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
FoodConsumptionBySpecialists("[relativeAmount]% Food consumption by specialists [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||||
@ -233,7 +231,6 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
GainInfluenceWithUnitGiftToCityState("Gain [amount] Influence with a [baseUnitFilter] gift to a City-State", UniqueTarget.Global),
|
GainInfluenceWithUnitGiftToCityState("Gain [amount] Influence with a [baseUnitFilter] gift to a City-State", UniqueTarget.Global),
|
||||||
FaithCostOfGreatProphetChange("[relativeAmount]% Faith cost of generating Great Prophet equivalents", UniqueTarget.Global),
|
FaithCostOfGreatProphetChange("[relativeAmount]% Faith cost of generating Great Prophet equivalents", UniqueTarget.Global),
|
||||||
RestingPointOfCityStatesFollowingReligionChange("Resting point for Influence with City-States following this religion [amount]", UniqueTarget.Global),
|
RestingPointOfCityStatesFollowingReligionChange("Resting point for Influence with City-States following this religion [amount]", UniqueTarget.Global),
|
||||||
StatBonusPercentFromCityStates("[relativeAmount]% [stat] from City-States", UniqueTarget.Global),
|
|
||||||
|
|
||||||
ProvidesGoldWheneverGreatPersonExpended("Provides a sum of gold each time you spend a Great Person", UniqueTarget.Global),
|
ProvidesGoldWheneverGreatPersonExpended("Provides a sum of gold each time you spend a Great Person", UniqueTarget.Global),
|
||||||
ProvidesStatsWheneverGreatPersonExpended("[stats] whenever a Great Person is expended", UniqueTarget.Global),
|
ProvidesStatsWheneverGreatPersonExpended("[stats] whenever a Great Person is expended", UniqueTarget.Global),
|
||||||
@ -570,7 +567,6 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
//@Deprecated("as of 4.3.9", ReplaceWith("Costs [amount] [stats] per turn when in your territory"), DeprecationLevel.ERROR)
|
//@Deprecated("as of 4.3.9", ReplaceWith("Costs [amount] [stats] per turn when in your territory"), DeprecationLevel.ERROR)
|
||||||
OldImprovementMaintenance("Costs [amount] gold per turn when in your territory", UniqueTarget.Improvement), // unused
|
OldImprovementMaintenance("Costs [amount] gold per turn when in your territory", UniqueTarget.Improvement), // unused
|
||||||
DamagesAdjacentEnemyUnits("Adjacent enemy units ending their turn take [amount] damage", UniqueTarget.Improvement),
|
DamagesAdjacentEnemyUnits("Adjacent enemy units ending their turn take [amount] damage", UniqueTarget.Improvement),
|
||||||
TakeOverTilesAroundWhenBuilt("Constructing it will take over the tiles around it and assign them to your closest city", UniqueTarget.Improvement),
|
|
||||||
|
|
||||||
GreatImprovement("Great Improvement", UniqueTarget.Improvement),
|
GreatImprovement("Great Improvement", UniqueTarget.Improvement),
|
||||||
IsAncientRuinsEquivalent("Provides a random bonus when entered", UniqueTarget.Improvement),
|
IsAncientRuinsEquivalent("Provides a random bonus when entered", UniqueTarget.Improvement),
|
||||||
@ -828,7 +824,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
@Deprecated("as of 3.19.2", ReplaceWith("[amount]% Food is carried over after population increases [cityFilter]"), DeprecationLevel.ERROR)
|
@Deprecated("as of 3.19.2", ReplaceWith("[amount]% Food is carried over after population increases [cityFilter]"), DeprecationLevel.ERROR)
|
||||||
CarryOverFoodAlsoDeprecated("[amount]% of food is carried over [cityFilter] after population increases", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
CarryOverFoodAlsoDeprecated("[amount]% of food is carried over [cityFilter] after population increases", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||||
@Deprecated("as of 3.19.2", ReplaceWith("[amount]% Culture cost of natural border growth [cityFilter]"), DeprecationLevel.ERROR)
|
@Deprecated("as of 3.19.2", ReplaceWith("[amount]% Culture cost of natural border growth [cityFilter]"), DeprecationLevel.ERROR)
|
||||||
BorderGrowthPercentageWithoutPercentageSign("[amount]% Culture cost of natural border growth [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
BorderGrowthPercentageWithoutPercentageSign("[amount] Culture cost of natural border growth [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||||
@Deprecated("as of 3.19.1", ReplaceWith("[-amount]% Culture cost of natural border growth [cityFilter]"), DeprecationLevel.ERROR)
|
@Deprecated("as of 3.19.1", ReplaceWith("[-amount]% Culture cost of natural border growth [cityFilter]"), DeprecationLevel.ERROR)
|
||||||
DecreasedAcquiringTilesCost("-[amount]% Culture cost of acquiring tiles [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
DecreasedAcquiringTilesCost("-[amount]% Culture cost of acquiring tiles [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||||
@Deprecated("as of 3.19.1", ReplaceWith("[amount]% Culture cost of natural border growth [in all cities]"), DeprecationLevel.ERROR)
|
@Deprecated("as of 3.19.1", ReplaceWith("[amount]% Culture cost of natural border growth [in all cities]"), DeprecationLevel.ERROR)
|
||||||
|
@ -297,11 +297,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||||||
|
|
||||||
Applicable to: Global
|
Applicable to: Global
|
||||||
|
|
||||||
??? example "[stats] whenever a Great Person is expended"
|
|
||||||
Example: "[+1 Gold, +2 Production] whenever a Great Person is expended"
|
|
||||||
|
|
||||||
Applicable to: Global
|
|
||||||
|
|
||||||
??? example "[relativeAmount]% Unhappiness from [populationFilter] [cityFilter]"
|
??? example "[relativeAmount]% Unhappiness from [populationFilter] [cityFilter]"
|
||||||
Example: "[+20]% Unhappiness from [Followers of this Religion] [in all cities]"
|
Example: "[+20]% Unhappiness from [Followers of this Religion] [in all cities]"
|
||||||
|
|
||||||
@ -533,11 +528,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||||||
|
|
||||||
Applicable to: Global
|
Applicable to: Global
|
||||||
|
|
||||||
??? example "[relativeAmount]% [stat] from City-States"
|
|
||||||
Example: "[+20]% [Culture] from City-States"
|
|
||||||
|
|
||||||
Applicable to: Global
|
|
||||||
|
|
||||||
??? example "Provides a sum of gold each time you spend a Great Person"
|
??? example "Provides a sum of gold each time you spend a Great Person"
|
||||||
Applicable to: Global
|
Applicable to: Global
|
||||||
|
|
||||||
@ -1520,9 +1510,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||||||
|
|
||||||
Applicable to: Improvement
|
Applicable to: Improvement
|
||||||
|
|
||||||
??? example "Constructing it will take over the tiles around it and assign them to your closest city"
|
|
||||||
Applicable to: Improvement
|
|
||||||
|
|
||||||
??? example "Great Improvement"
|
??? example "Great Improvement"
|
||||||
Applicable to: Improvement
|
Applicable to: Improvement
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.uniques
|
package com.unciv.uniques
|
||||||
|
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.testing.GdxTestRunner
|
import com.unciv.testing.GdxTestRunner
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@ -8,6 +9,20 @@ import org.junit.runner.RunWith
|
|||||||
|
|
||||||
@RunWith(GdxTestRunner::class)
|
@RunWith(GdxTestRunner::class)
|
||||||
class UniqueErrorTests {
|
class UniqueErrorTests {
|
||||||
|
@Test
|
||||||
|
fun testMultipleUniqueTypesSameText(){
|
||||||
|
val textToUniqueType = HashMap<String, UniqueType>()
|
||||||
|
var errors = false
|
||||||
|
for (uniqueType in UniqueType.values()){
|
||||||
|
if (textToUniqueType.containsKey(uniqueType.placeholderText)){
|
||||||
|
println("UniqueTypes ${uniqueType.name} and ${textToUniqueType[uniqueType.placeholderText]!!.name} have the same text!")
|
||||||
|
errors = true
|
||||||
|
}
|
||||||
|
else textToUniqueType[uniqueType.placeholderText] = uniqueType
|
||||||
|
}
|
||||||
|
assert(!errors)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCodependantTechs() {
|
fun testCodependantTechs() {
|
||||||
RulesetCache.loadRulesets()
|
RulesetCache.loadRulesets()
|
||||||
|
Reference in New Issue
Block a user