mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-02 12:24:15 +07:00
Resolved #5494 using new overloads
This commit is contained in:
parent
3ae6d675cd
commit
50225101ea
@ -43,12 +43,11 @@ object BattleDamage {
|
|||||||
)
|
)
|
||||||
|
|
||||||
for (unique in combatant.unit.getMatchingUniques(
|
for (unique in combatant.unit.getMatchingUniques(
|
||||||
UniqueType.Strength, conditionalState)
|
UniqueType.Strength, conditionalState, true)) {
|
||||||
+ civInfo.getMatchingUniques(UniqueType.Strength, conditionalState)
|
|
||||||
) {
|
|
||||||
modifiers.add(getModifierStringFromUnique(unique), unique.params[0].toInt())
|
modifiers.add(getModifierStringFromUnique(unique), unique.params[0].toInt())
|
||||||
}
|
}
|
||||||
for (unique in combatant.unit.getMatchingUniques(UniqueType.StrengthNearCapital)) {
|
for (unique in combatant.unit.getMatchingUniques(UniqueType.StrengthNearCapital,
|
||||||
|
checkCivInfoUniques = true)) {
|
||||||
if (civInfo.cities.isEmpty()) break
|
if (civInfo.cities.isEmpty()) break
|
||||||
val distance = combatant.getTile().aerialDistanceTo(civInfo.getCapital().getCenterTile())
|
val distance = combatant.getTile().aerialDistanceTo(civInfo.getCapital().getCenterTile())
|
||||||
// https://steamcommunity.com/sharedfiles/filedetails/?id=326411722#464287
|
// https://steamcommunity.com/sharedfiles/filedetails/?id=326411722#464287
|
||||||
|
@ -752,7 +752,7 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getMatchingUniquesWithNonLocalEffects(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Sequence<Unique> {
|
fun getMatchingUniquesWithNonLocalEffects(uniqueType: UniqueType): Sequence<Unique> {
|
||||||
return cityConstructions.builtBuildingUniqueMap.getUniques(uniqueType)
|
return cityConstructions.builtBuildingUniqueMap.getUniques(uniqueType)
|
||||||
.filter { it.params.none { param -> param == "in this city" } }
|
.filter { it.params.none { param -> param == "in this city" } }
|
||||||
// Note that we don't query religion here, as those only have local effects
|
// Note that we don't query religion here, as those only have local effects
|
||||||
|
@ -372,7 +372,7 @@ class CivilizationInfo {
|
|||||||
.map { it.first }
|
.map { it.first }
|
||||||
.filter { it.isOfType(uniqueType) }
|
.filter { it.isOfType(uniqueType) }
|
||||||
)
|
)
|
||||||
yieldAll(getEra().getMatchingUniques(uniqueType))
|
yieldAll(getEra().getMatchingUniques(uniqueType, stateForConditionals))
|
||||||
if (religionManager.religion != null)
|
if (religionManager.religion != null)
|
||||||
yieldAll(religionManager.religion!!.getFounderUniques().filter { it.isOfType(uniqueType) })
|
yieldAll(religionManager.religion!!.getFounderUniques().filter { it.isOfType(uniqueType) })
|
||||||
}.filter {
|
}.filter {
|
||||||
|
@ -223,7 +223,8 @@ class MapUnit {
|
|||||||
return tempUniques.any { it.placeholderText == unique }
|
return tempUniques.any { it.placeholderText == unique }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Boolean {
|
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals
|
||||||
|
= StateForConditionals(civInfo, unit=this)): Boolean {
|
||||||
return tempUniques.any { it.type == uniqueType && it.conditionalsApply(stateForConditionals) }
|
return tempUniques.any { it.type == uniqueType && it.conditionalsApply(stateForConditionals) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,8 +346,10 @@ class MapUnit {
|
|||||||
private fun getVisibilityRange(): Int {
|
private fun getVisibilityRange(): Int {
|
||||||
var visibilityRange = 2
|
var visibilityRange = 2
|
||||||
|
|
||||||
if (isEmbarked() && !hasUnique(UniqueType.NormalVisionWhenEmbarked)
|
val conditionalState = StateForConditionals(civInfo = civInfo, unit = this)
|
||||||
&& !civInfo.hasUnique(UniqueType.NormalVisionWhenEmbarked)) {
|
|
||||||
|
if (isEmbarked() && !hasUnique(UniqueType.NormalVisionWhenEmbarked, conditionalState)
|
||||||
|
&& !civInfo.hasUnique(UniqueType.NormalVisionWhenEmbarked, conditionalState)) {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user