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(
|
||||
UniqueType.Strength, conditionalState)
|
||||
+ civInfo.getMatchingUniques(UniqueType.Strength, conditionalState)
|
||||
) {
|
||||
UniqueType.Strength, conditionalState, true)) {
|
||||
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
|
||||
val distance = combatant.getTile().aerialDistanceTo(civInfo.getCapital().getCenterTile())
|
||||
// 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)
|
||||
.filter { it.params.none { param -> param == "in this city" } }
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
|
@ -372,7 +372,7 @@ class CivilizationInfo {
|
||||
.map { it.first }
|
||||
.filter { it.isOfType(uniqueType) }
|
||||
)
|
||||
yieldAll(getEra().getMatchingUniques(uniqueType))
|
||||
yieldAll(getEra().getMatchingUniques(uniqueType, stateForConditionals))
|
||||
if (religionManager.religion != null)
|
||||
yieldAll(religionManager.religion!!.getFounderUniques().filter { it.isOfType(uniqueType) })
|
||||
}.filter {
|
||||
|
@ -223,7 +223,8 @@ class MapUnit {
|
||||
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) }
|
||||
}
|
||||
|
||||
@ -345,8 +346,10 @@ class MapUnit {
|
||||
private fun getVisibilityRange(): Int {
|
||||
var visibilityRange = 2
|
||||
|
||||
if (isEmbarked() && !hasUnique(UniqueType.NormalVisionWhenEmbarked)
|
||||
&& !civInfo.hasUnique(UniqueType.NormalVisionWhenEmbarked)) {
|
||||
val conditionalState = StateForConditionals(civInfo = civInfo, unit = this)
|
||||
|
||||
if (isEmbarked() && !hasUnique(UniqueType.NormalVisionWhenEmbarked, conditionalState)
|
||||
&& !civInfo.hasUnique(UniqueType.NormalVisionWhenEmbarked, conditionalState)) {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user