mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
Better stat-related check for buildings - #12180
This commit is contained in:
parent
938cd9008a
commit
83baecd8a5
@ -498,10 +498,16 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isStatRelated(stat: Stat): Boolean {
|
fun isStatRelated(stat: Stat, city: City? = null): Boolean {
|
||||||
if (get(stat) > 0) return true
|
if (city != null) {
|
||||||
if (getStatPercentageBonuses(null)[stat] > 0) return true
|
if (getStats(city)[stat] > 0) return true
|
||||||
if (getMatchingUniques(UniqueType.Stats).any { it.stats[stat] > 0 }) return true
|
if (getStatPercentageBonuses(city)[stat] > 0) return true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (get(stat) > 0) return true
|
||||||
|
if (getMatchingUniques(UniqueType.Stats).any { it.stats[stat] > 0 }) return true
|
||||||
|
if (getStatPercentageBonuses(null)[stat] > 0) return true
|
||||||
|
}
|
||||||
if (getMatchingUniques(UniqueType.StatsFromTiles).any { it.stats[stat] > 0 }) return true
|
if (getMatchingUniques(UniqueType.StatsFromTiles).any { it.stats[stat] > 0 }) return true
|
||||||
if (getMatchingUniques(UniqueType.StatsPerPopulation).any { it.stats[stat] > 0 }) return true
|
if (getMatchingUniques(UniqueType.StatsPerPopulation).any { it.stats[stat] > 0 }) return true
|
||||||
if (stat == Stat.Happiness && hasUnique(UniqueType.RemoveAnnexUnhappiness)) return true
|
if (stat == Stat.Happiness && hasUnique(UniqueType.RemoveAnnexUnhappiness)) return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user