Resolved #5435 - all civ + unit uniques are accounted for in both ways

This commit is contained in:
yairm210 2021-10-09 20:22:29 +03:00
parent 185050bd9f
commit fd3bfbade4
2 changed files with 12 additions and 6 deletions

View File

@ -302,11 +302,13 @@ class MapUnit {
if (isEmbarked()) 2
else baseUnit.movement
movement += getMatchingUniques(UniqueType.Movement, StateForConditionals(civInfo = civInfo, unit = this))
movement += (getMatchingUniques(UniqueType.Movement, StateForConditionals(civInfo = civInfo, unit = this)) +
civInfo.getMatchingUniques(UniqueType.Movement, StateForConditionals(civInfo = civInfo, unit = this)))
.sumOf { it.params[0].toInt() }
// Deprecated since 3.17.5
for (unique in civInfo.getMatchingUniques(UniqueType.MovementUnits))
for (unique in civInfo.getMatchingUniques(UniqueType.MovementUnits)
+ getMatchingUniques(UniqueType.MovementUnits))
if (matchesFilter(unique.params[1]))
movement += unique.params[0].toInt()
@ -335,12 +337,14 @@ class MapUnit {
private fun getVisibilityRange(): Int {
var visibilityRange = 2
if (isEmbarked() && !hasUnique("Normal vision when embarked")) {
if (isEmbarked() && !hasUnique(UniqueType.NormalVisionWhenEmbarked)
&& !civInfo.hasUnique(UniqueType.NormalVisionWhenEmbarked)) {
return 1
}
visibilityRange += getMatchingUniques(UniqueType.Sight, StateForConditionals(civInfo = civInfo, unit = this))
.sumOf { it.params[0].toInt() }
visibilityRange += (getMatchingUniques(UniqueType.Sight, StateForConditionals(civInfo = civInfo, unit = this))
+ civInfo.getMatchingUniques(UniqueType.Sight, StateForConditionals(civInfo = civInfo, unit = this))
).sumOf { it.params[0].toInt() }
// Deprecated since 3.17.5
for (unique in getMatchingUniques(UniqueType.SightUnits))
@ -1098,7 +1102,8 @@ class MapUnit {
pressureAdded *= unique.params[0].toPercent()
//
for (unique in getMatchingUniques(UniqueType.SpreadReligionStrength, StateForConditionals(civInfo = civInfo, unit = this)))
for (unique in getMatchingUniques(UniqueType.SpreadReligionStrength, StateForConditionals(civInfo = civInfo, unit = this))
+ civInfo.getMatchingUniques(UniqueType.SpreadReligionStrength, StateForConditionals(civInfo = civInfo, unit = this)))
pressureAdded *= unique.params[0].toPercent()
return pressureAdded.toInt()

View File

@ -167,6 +167,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
SpreadReligionStrength("[amount]% Spread Religion Strength", UniqueTarget.Unit, UniqueTarget.Global),
MayFoundReligion("May found a religion", UniqueTarget.Unit),
MayEnhanceReligion("May enhance a religion", UniqueTarget.Unit),
NormalVisionWhenEmbarked("Normal vision when embarked", UniqueTarget.Unit, UniqueTarget.Global),
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Movement <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
MovementUnits("+[amount] Movement for all [mapUnitFilter] units", UniqueTarget.Global),